@font-face {
  font-family: "Play";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../../assets/fonts/play-latin-700-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Play";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../../assets/fonts/play-greek-700-normal.woff2") format("woff2");
  unicode-range: U+0370-03FF;
}

:root {
  --green: #00f260;
  --blue: #3aa0ff;
  --text: #eef2ff;
  --muted: #b8bedc;
  --panel: rgba(16, 14, 44, 0.88);
  --line: rgba(255, 255, 255, 0.14);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(1px 1px at 12% 18%, rgba(0, 242, 96, 0.6), transparent 60%),
    radial-gradient(1px 1px at 78% 30%, rgba(0, 242, 96, 0.5), transparent 60%),
    radial-gradient(1.5px 1.5px at 35% 82%, rgba(58, 160, 255, 0.5), transparent 60%),
    radial-gradient(1px 1px at 88% 76%, rgba(0, 242, 96, 0.5), transparent 60%),
    radial-gradient(ellipse at 50% 0%, #302b63, #0f0c29 70%);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

button:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 2px;
}

/* ---------- Πάνω μπάρα ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
}

.title {
  font: 700 26px/1 "Play", system-ui, sans-serif;
  letter-spacing: 1px;
  background: linear-gradient(90deg, var(--green), var(--blue));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
}

.title span {
  color: initial;
}

.scores {
  display: flex;
  gap: 8px;
}

.chip {
  padding: 6px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
}

.chip b {
  color: var(--green);
  font: 700 18px/1 "Play", system-ui, sans-serif;
  margin-left: 4px;
}

.btns {
  display: flex;
  gap: 6px;
}

.icon-btn {
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.07);
  font-size: 16px;
  font-weight: 700;
}

.icon-btn svg {
  display: block;
  margin: auto;
}

.icon-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.16);
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ---------- Ταμπλό ---------- */
.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 44px;
}

.board-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  display: grid;
  place-items: center;
  touch-action: none;
  contain: size; /* το μέγεθος βγαίνει από τη διάταξη, όχι από τον καμβά */
}

canvas {
  display: block;
  border-radius: 14px;
  border: 1px solid rgba(0, 242, 96, 0.35);
  box-shadow: 0 0 40px rgba(0, 242, 96, 0.18), 0 20px 50px rgba(0, 0, 0, 0.5);
  outline: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 12px;
  z-index: 2;
  animation: fade 0.25s ease both;
}

.panel {
  width: min(420px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 22px 20px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: pop 0.3s ease both;
}

.panel h2 {
  font: 700 28px/1.1 "Play", system-ui, sans-serif;
  color: var(--green);
}

.panel h2.big {
  font-size: 38px;
}

.tips {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 15px;
  text-align: left;
}

.keys-line {
  color: var(--muted);
  font-size: 14px;
}

.final {
  font-size: 18px;
  color: var(--muted);
}

.final b {
  font: 700 34px/1 "Play", system-ui, sans-serif;
  color: var(--green);
  margin-left: 6px;
}

.record {
  color: #ffd23f;
  font-weight: 700;
}

.btn {
  min-width: 180px;
  padding: 13px 26px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--green), #0575e6);
  color: #041018;
  font-weight: 800;
  font-size: 17px;
  box-shadow: 0 8px 22px rgba(0, 242, 96, 0.25);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.btn.alt {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
}

.btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.lang {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.lang button {
  border: 0;
  background: transparent;
  min-width: 48px;
  min-height: 38px;
  font-weight: 700;
  color: var(--muted);
}

.lang button[aria-pressed="true"] {
  background: rgba(255, 255, 255, 0.14);
  color: var(--text);
}

/* ---------- Βελάκια (μόνο σε οθόνες αφής) ---------- */
.pad {
  display: none;
  grid-template-columns: repeat(3, 62px);
  grid-template-rows: repeat(2, 56px);
  grid-template-areas: ". up ." "left down right";
  gap: 8px;
  flex-shrink: 0;
}

.touch .pad {
  display: grid;
}

.arrow {
  border-radius: 16px;
  border: 1px solid rgba(0, 242, 96, 0.45);
  background: linear-gradient(160deg, rgba(0, 242, 96, 0.22), rgba(5, 117, 230, 0.18));
  font-size: 24px;
  font-weight: 800;
  touch-action: none;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.arrow:active {
  transform: scale(0.94);
  background: rgba(0, 242, 96, 0.4);
}

.up {
  grid-area: up;
}

.down {
  grid-area: down;
}

.left {
  grid-area: left;
}

.right {
  grid-area: right;
}

/* Οριζόντια οθόνη αφής: βελάκια δίπλα στο ταμπλό */
@media (orientation: landscape) and (max-height: 600px) {
  .touch .stage {
    flex-direction: row;
    justify-content: center;
    padding: 4px 12px 8px 12px;
  }
  .touch .board-wrap {
    flex: 1 1 0;
    height: 100%;
  }
  .touch .pad {
    align-self: center;
  }
  .top {
    padding: 4px 12px;
  }
  .title {
    font-size: 20px;
  }
}

@media (max-width: 560px) {
  .top {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "title btns" "scores scores";
    row-gap: 6px;
    padding: 6px 8px;
  }
  .title {
    grid-area: title;
  }
  .btns {
    grid-area: btns;
  }
  .scores {
    grid-area: scores;
    justify-content: center;
  }
  .title {
    font-size: 20px;
  }
  .chip {
    padding: 5px 9px;
    font-size: 13px;
  }
  .stage {
    padding: 4px 8px 42px;
  }
  .panel {
    padding: 18px 14px;
  }
  .panel h2.big {
    font-size: 30px;
  }
  .tips {
    font-size: 14px;
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
