@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 {
  --bg: #06140d;
  --panel: rgba(8, 22, 15, 0.92);
  --line: rgba(255, 255, 255, 0.1);
  --p1: #5fe08a;
  --p2: #ff7a6b;
  --gold: #ffd23f;
  --text: #f3f1ea;
  --muted: #b9c4bd;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  background: radial-gradient(ellipse at 50% 30%, #123a24, var(--bg) 70%);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -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(--gold);
  outline-offset: 2px;
}

/* ---------- Μενού ---------- */
.menu {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
  text-align: center;
  animation: rise 0.6s ease both;
}

.menu-title {
  margin: 0;
  font: 700 clamp(40px, 9vw, 72px) / 1 "Play", system-ui, sans-serif;
  letter-spacing: 1px;
  text-shadow: 0 6px 24px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  gap: 0.25em;
}

.ball8 {
  display: inline-grid;
  place-items: center;
  position: relative;
  isolation: isolate;
  width: 1.15em;
  height: 1.15em;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #555, #111 55%, #000);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  color: #111;
  font-size: 0.8em;
}

.ball8::before {
  content: "";
  position: absolute;
  inset: 24%;
  z-index: -1;
  border-radius: 50%;
  background: #fbf8ee;
}

.menu-sub {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(320px, 100%);
  margin-top: 8px;
}

.menu-btn {
  padding: 15px 24px;
  font-size: 20px;
  font-weight: 700;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #3ccf6e, #17863f);
  color: #04130a;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.menu-btn.alt {
  background: linear-gradient(135deg, #f1d79a, #b8873e);
}

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

.menu-btn:active {
  transform: translateY(1px);
}

.menu-opts {
  display: flex;
  gap: 10px;
  align-items: center;
}

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

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

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

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

.menu-rec {
  margin: 0;
  min-height: 1.3em;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- Παιχνίδι ---------- */
.game {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.pl {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 8px;
  padding: 5px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  min-width: 0;
  transition: background 0.2s, border-color 0.2s;
}

#p1 {
  justify-self: start;
}

#p2 {
  justify-self: end;
  justify-content: flex-end;
  text-align: right;
}

.pl.on {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.18);
}

.pl .name {
  font: 700 16px/1.2 "Play", system-ui, sans-serif;
}

#p1 .name {
  color: var(--p1);
}

#p2 .name {
  color: var(--p2);
}

.pl .grp {
  font-size: 12px;
  color: var(--muted);
}

.pips {
  display: flex;
  gap: 3px;
  flex-basis: 100%;
}

#p2 .pips {
  justify-content: flex-end;
}

.pips:empty {
  visibility: hidden;
  height: 12px;
}

.pip {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: inset -2px -2px 3px rgba(0, 0, 0, 0.4);
}

.pip.st {
  background: linear-gradient(#f6f3e8 22%, var(--c) 22%, var(--c) 78%, #f6f3e8 78%);
}

.pip.gone {
  opacity: 0.18;
}

.status {
  text-align: center;
  min-width: 0;
}

.turn {
  font: 700 15px/1.3 "Play", system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.turn.p1 {
  color: var(--p1);
}

.turn.p2 {
  color: var(--p2);
}

.msg {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
  color: var(--gold);
  min-height: 1.3em;
  max-width: 46vw;
}

.table-wrap {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 8px;
}

canvas {
  display: block;
  touch-action: none;
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.65);
  cursor: crosshair;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  background: var(--panel);
  border-top: 1px solid var(--line);
}

/* Χώρος για το κουμπί «← TzinGames» κάτω αριστερά (μόνο έξω από τη σελίδα του site). */
.standalone .bar {
  padding-left: 116px;
}

.hint {
  font-size: 13px;
  color: var(--muted);
  min-width: 0;
}

.bar-btns {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.small-btn {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

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

/* ---------- Τέλος παιχνιδιού ---------- */
.over {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.55);
  padding: 16px;
  z-index: 10;
  animation: fade 0.25s ease both;
}

.over-box {
  width: min(420px, 100%);
  padding: 26px 22px;
  border-radius: 20px;
  background: linear-gradient(160deg, #173b27, #0a1d12);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  text-align: center;
  animation: rise 0.35s ease both;
}

.over-box h2 {
  margin: 0 0 8px;
  font: 700 32px/1.15 "Play", system-ui, sans-serif;
  color: var(--gold);
}

.over-box p {
  margin: 0 0 20px;
  color: var(--muted);
}

.over-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.over-btns .menu-btn {
  font-size: 17px;
  padding: 12px 22px;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

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

/* Κινητό: πιο μαζεμένο HUD */
@media (max-width: 640px) {
  .hud {
    padding: 4px 6px;
    gap: 4px;
  }
  .pl {
    padding: 4px 6px;
  }
  .pl .name {
    font-size: 14px;
  }
  .pl .grp {
    font-size: 11px;
  }
  .pip {
    width: 9px;
    height: 9px;
  }
  .turn {
    font-size: 12px;
    letter-spacing: 0;
  }
  .msg {
    font-size: 12px;
    height: 2.6em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
  }
  .pips:empty {
    height: 9px;
  }
  .hint {
    font-size: 12px;
  }
  .small-btn {
    min-width: 40px;
    justify-content: center;
    padding: 0 10px;
    font-size: 16px;
  }
  .small-btn .lbl {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .bar {
    flex-wrap: wrap;
    row-gap: 4px;
  }
  .hint {
    flex: 1 1 100%;
    text-align: center;
  }
  .standalone .bar {
    padding-left: 10px;
  }
  .bar-btns {
    margin-left: auto;
  }
  .table-wrap {
    padding: 6px;
  }
}

/* Κινητό οριζόντια: χαμηλό ύψος, όσο περισσότερο τραπέζι γίνεται */
@media (max-height: 500px) {
  .hud {
    padding: 2px 8px;
  }
  .pl {
    padding: 2px 8px;
    flex-wrap: nowrap;
  }
  .pips {
    flex-basis: auto;
  }
  .table-wrap {
    padding: 4px;
  }
  .bar {
    padding: 3px 8px;
  }
  .small-btn,
  .icon-btn {
    min-height: 34px;
  }
  .menu {
    gap: 10px;
  }
  .menu-title {
    font-size: 40px;
  }
  .menu-buttons {
    flex-direction: row;
    width: auto;
  }
  .menu-btn {
    font-size: 17px;
    padding: 12px 20px;
  }
}

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