/* TzinBlocks – ίδια παλέτα και γραμματοσειρές με το TzinGames. */
@font-face {
  font-family: "Play"; font-weight: 700; font-display: swap;
  src: url(../../assets/fonts/play-greek-700-normal.woff2) format("woff2");
  unicode-range: U+0370-03FF;
}
@font-face {
  font-family: "Play"; font-weight: 700; font-display: swap;
  src: url(../../assets/fonts/play-latin-700-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+2000-206F, U+2190-21FF, U+25A0-25FF;
}
@font-face {
  font-family: "Manrope"; font-weight: 200 800; font-display: swap;
  src: url(../../assets/fonts/manrope-greek-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0370-03FF;
}
@font-face {
  font-family: "Manrope"; font-weight: 200 800; font-display: swap;
  src: url(../../assets/fonts/manrope-latin-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+2000-206F;
}

:root {
  --bg: #0B1226; --surface: #141D38; --surface-2: #1B2648;
  --text: #E3E9F7; --muted: #A3AECB; --primary: #5B95FF; --on-primary: #0B1226; --secondary: #FF9A45;
  --border: #E3E9F72E; --border-soft: #E3E9F717;
  --top: 48px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background: radial-gradient(900px 500px at 50% -20%, #5B95FF22, transparent), var(--bg);
  color: var(--text); font: 15px/1.45 "Manrope", system-ui, sans-serif;
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; }
h1, h2 { font-family: "Play", "Manrope", sans-serif; font-weight: 700; }

#app { height: 100%; display: flex; flex-direction: column; }

/* Πάνω μπάρα – αριστερά αφήνει χώρο για το κουμπί «← TzinGames» */
.topbar {
  flex: none; height: calc(var(--top) + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 10px 0 118px;
  display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border-soft);
}
.brand { margin: 0; font-size: 1.25rem; letter-spacing: .02em; }
.brand span { color: var(--primary); }
.tb-actions { margin-left: auto; display: flex; gap: 6px; }
.icon-btn {
  min-width: 38px; height: 34px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-weight: 800; font-size: .85rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn svg { width: 16px; height: 16px; fill: currentColor; }
.icon-btn:hover { border-color: var(--primary); }

/* Σκηνή: πλαϊνά πάνελ + ταμπλό */
.stage { flex: 1; min-height: 0; display: flex; justify-content: center; align-items: center; gap: 16px; padding: 12px; touch-action: none; }
.side { display: flex; flex-direction: column; gap: 12px; width: 150px; align-self: center; }
.panel { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 14px; padding: 10px 12px; }
.panel h2 { margin: 0 0 6px; font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.mini { display: block; width: 100%; }
.stats { display: grid; gap: 6px; }
.stats div { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.stats span { color: var(--muted); font-size: .85rem; }
.stats b { font-family: "Play", sans-serif; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.keys { font-size: .8rem; color: var(--muted); }
.keys p { margin: 0 0 4px; }
.keys kbd { display: inline-block; min-width: 20px; padding: 0 5px; border-radius: 5px; background: var(--surface-2); color: var(--text); font: 700 .75rem "Manrope", sans-serif; text-align: center; }

.board-wrap { position: relative; flex: none; }
#cvBoard { display: block; border-radius: 10px; background: #0A1022; box-shadow: 0 0 0 1px var(--border), 0 24px 60px -20px #000; }
.board-wrap.bump { animation: bump .12s ease-out; }
@keyframes bump { 40% { transform: translateY(3px); } }

/* Οθόνες (αρχική, οδηγίες, παύση, τέλος) πάνω στο ταμπλό */
.overlay {
  position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: safe center; gap: 10px;
  padding: 16px; text-align: center; border-radius: 10px; background: #0B1226E8; backdrop-filter: blur(3px);
  overflow-y: auto; overscroll-behavior: contain; /* σε χαμηλές οθόνες (κινητό οριζόντια) κυλάει αντί να κόβεται */
}
.overlay.show { display: flex; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.overlay h2 { margin: 0; font-size: clamp(1.4rem, 7vw, 2rem); }
.overlay h2 span { color: var(--primary); }
.overlay p { margin: 0; color: var(--muted); }
.overlay .big { font-family: "Play", sans-serif; font-size: 2rem; color: var(--text); }
.overlay .btns { display: flex; flex-direction: column; gap: 8px; width: min(220px, 100%); margin-top: 6px; }
.btn {
  padding: 11px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2);
  font-weight: 800; cursor: pointer; transition: filter .15s, transform .1s;
}
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: transparent; }
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: scale(.97); }
.record { padding: 4px 12px; border-radius: 999px; background: var(--secondary); color: var(--on-primary); font-weight: 800; animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.08); } }
.howto { text-align: left; font-size: .85rem; max-height: 100%; overflow: auto; }
.howto h3 { margin: 8px 0 4px; font: 700 .8rem "Play", sans-serif; text-transform: uppercase; letter-spacing: .08em; color: var(--primary); }
.howto ul { margin: 0; padding-left: 18px; }
.howto li { margin: 2px 0; }
.mode-tag { margin: 0; font: 700 .72rem "Play", sans-serif; letter-spacing: .12em; text-transform: uppercase; color: var(--secondary) !important; }
.modes { display: grid; gap: 8px; width: min(280px, 100%); }
.mode-btn {
  display: grid; gap: 2px; text-align: left; padding: 10px 14px; border-radius: 14px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); transition: border-color .15s, background .15s, transform .1s;
}
.mode-btn b { font: 700 1rem "Play", sans-serif; color: var(--text); }
.mode-btn span { font-size: .8rem; color: var(--muted); }
.mode-btn small { font-size: .74rem; color: var(--primary); font-weight: 700; }
.mode-btn:hover, .mode-btn:focus-visible { border-color: var(--primary); background: var(--surface-2); outline: none; }
.mode-btn:active { transform: scale(.98); }
.endstats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; width: min(260px, 100%); font-size: .8rem; }
.endstats div { display: flex; justify-content: space-between; gap: 8px; }
.endstats span { color: var(--muted); }
.endstats b { font-variant-numeric: tabular-nums; }
.logo-blocks { display: grid; grid-template-columns: repeat(4, 14px); gap: 3px; margin-bottom: 4px; }
.logo-blocks i { width: 14px; height: 14px; border-radius: 3px; }

/* Μηνύματα («Δύο γραμμές!», «Επίπεδο 3») */
.overlay.show ~ .pops { display: none; } /* μηνύματα δεν πέφτουν πάνω στις οθόνες */
.pops { position: absolute; left: 0; right: 0; top: 30%; display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.pop {
  font: 700 1.15rem "Play", sans-serif; color: var(--text); text-shadow: 0 2px 12px #000, 0 0 18px var(--glow, #5B95FF);
  animation: pop 1.1s ease-out forwards;
}
.pop small { display: block; text-align: center; font-size: .85rem; color: var(--secondary); }
@keyframes pop { 0% { opacity: 0; transform: translateY(10px) scale(.9); } 15% { opacity: 1; transform: none; } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-24px); } }

/* Κουμπιά αφής */
.touch { display: none; }
body.is-touch .touch { display: flex; }
.touch button {
  width: 58px; height: 58px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface);
  font-size: 1.35rem; font-weight: 800; touch-action: none;
}
.touch button.small { font-size: .72rem; letter-spacing: .02em; }
.touch button.on { background: var(--primary); color: var(--on-primary); }
.pad { display: flex; gap: 8px; }

/* Κινητό όρθιο: πληροφορίες σε μια σειρά πάνω, κουμπιά κάτω */
body.portrait .stage { flex-direction: column; gap: 8px; padding: 8px 10px; }
body.portrait .side { flex-direction: row; width: 100%; max-width: 520px; align-items: stretch; gap: 8px; }
body.portrait .side-left { order: 0; }
body.portrait .board-wrap { order: 1; }
body.portrait .side-right { display: none; }
body.portrait .side-left .panel:first-child { flex: none; width: 76px; padding: 6px 8px; }
body.portrait .stats { flex: 1; grid-template-columns: 1fr 1fr; gap: 0 10px; padding: 5px 9px; font-size: .9em; }
body.portrait .stats div:last-child { grid-column: 1 / -1; }
body.portrait .stats b { font-size: 1rem; }
body.portrait .next-strip { flex: none; width: 120px; padding: 6px 8px; }
body.portrait .stats { min-width: 0; }
body.portrait .panel h2 { margin-bottom: 2px; font-size: .68rem; }
body.portrait .touch { gap: 12px; padding: 6px 10px calc(10px + env(safe-area-inset-bottom, 0px)); }
body.portrait .pad { flex: 1; gap: 6px; }
body.portrait .touch button { flex: 1; width: auto; min-width: 0; height: 56px; }
body.portrait .keys { display: none; }

/* Κινητό οριζόντιο: τα κουμπιά στις δύο πλευρές */
body.landscape.is-touch .touch { position: fixed; left: 0; right: 0; bottom: 10px; justify-content: space-between; padding: 0 calc(12px + env(safe-area-inset-left, 0px)); pointer-events: none; }
body.landscape.is-touch .pad { gap: 6px; pointer-events: auto; }
body.landscape.is-touch .touch button { width: 46px; height: 46px; border-radius: 12px; font-size: 1.05rem; }
body.landscape.is-touch .touch button.small { font-size: .6rem; }
body.landscape.is-touch .keys { display: none; }
body.landscape .side { width: 128px; }

/* Κινητό οριζόντια: πιο μικρά κείμενα στις οθόνες πάνω στο στενό ταμπλό */
@media (max-height: 500px) {
  .overlay { gap: 6px; padding: 10px 8px; }
  .overlay h2 { font-size: 1.15rem; }
  .overlay p, .overlay .btn { font-size: .78rem; }
}
