/* Intellia look & feel: λευκό, teal, ανθρακί */
:root {
  --bg: #f2f6f6;
  --panel: #ffffff;
  --text: #35393b;
  --muted: #7d8689;
  --accent: #0aa8a8;
  --accent-dark: #078f8f;
  --error: #d64541;
  --line: #e2eaea;
  --board-light: #edf3f3;
  --board-dark: #b6d4d2;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, sans-serif;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: .75rem .75rem 1.5rem;
}
/* Σκακιέρα και panel δίπλα-δίπλα. Η σκακιέρα παίρνει όλο το διαθέσιμο πλάτος
   (οθόνη μείον panel και κενά), με όριο το ύψος της οθόνης ώστε να μη θέλει scroll. */
.layout {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  align-items: flex-start;
}
#board {
  /* Όριο μόνο το ύψος της οθόνης (τετράγωνη σκακιέρα) και το πλάτος μείον το panel. */
  width: min(92vh, calc(100vw - 420px));
  aspect-ratio: 1;
  box-shadow: 0 6px 24px rgb(30 70 70 / .18);
  border-radius: 4px;
  margin-bottom: 14px; /* χώρος για τα γράμματα a-h */
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  width: 340px;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  max-height: 92vh;
  box-shadow: 0 2px 12px rgb(40 70 70 / .06);
}
/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: .01em;
}
.brand b { font-weight: 700; }
.brand-mark {
  width: .8em;
  height: .8em;
  border: 3px solid var(--accent);
  border-radius: 2px;
  display: inline-block;
}
/* Σκακιέρα σε χρώματα Intellia: CSS checkerboard αντί για το SVG του brown theme */
cg-board {
  background-color: var(--board-light);
  background-image: repeating-conic-gradient(var(--board-dark) 0% 25%, var(--board-light) 0% 50%);
  background-size: 25% 25%;
}
cg-board square.move-dest {
  background: radial-gradient(rgba(10, 140, 140, .55) 22%, #0a8c8c 0, rgba(0, 0, 0, .3) 0, rgba(0, 0, 0, 0) 0);
}
cg-board square.move-dest:hover,
cg-board square.move-dest.hover { background: rgba(10, 140, 140, .3); }
/* Κεχριμπαρί για την τελευταία κίνηση — ξεχωρίζει πάνω στο teal board */
cg-board square.last-move { background-color: rgba(244, 190, 70, .45); }
cg-board square.selected { background-color: rgba(7, 143, 143, .45); }
/* Στενές οθόνες: το panel πέφτει κάτω από τη σκακιέρα */
@media (max-width: 900px) {
  #board { width: min(94vw, 88vh); }
  .panel { width: min(94vw, 520px); max-height: none; }
}
.panel h1 { font-size: 1.1rem; margin: 0; }
.panel h1 a { color: var(--text); text-decoration: none; }
#mode { font-size: .85rem; color: var(--muted); }
#status { font-size: 1rem; min-height: 2.4em; }
#status.error { color: var(--error); }
#status.success { color: var(--accent); }
#moves {
  flex: 1;
  overflow-y: auto;
  font-variant-numeric: tabular-nums;
  line-height: 1.7;
  color: var(--muted);
  min-height: 4em;
  max-height: 16em;
}
#moves b { color: var(--text); font-weight: 600; }
#coach {
  background: #e9f7f6;
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: .6rem .8rem;
  font-size: .9rem;
  line-height: 1.5;
}
#coach .eval { color: var(--accent); font-weight: 600; }
.buttons { display: flex; gap: .5rem; }
button, a.btn {
  flex: 1;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: .55rem .8rem;
  font-size: .95rem;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}
button:hover:not(:disabled):not(.secondary) { background: var(--accent-dark); }
button.secondary, a.btn.secondary { background: #e7eeee; color: var(--text); }
button:disabled { opacity: .4; cursor: default; }
button.active { outline: 2px solid rgb(10 168 168 / .35); }
.toplink {
  font-size: .85rem;
  color: var(--muted);
  text-decoration: none;
}
.toplink:hover { color: var(--text); }

/* Promotion picker */
#promo {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / .55);
  display: none;
  align-items: center;
  justify-content: center;
}
#promo.open { display: flex; }
#promo .choices {
  background: var(--panel);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  gap: .6rem;
}
#promo button {
  font-size: 2.4rem;
  line-height: 1;
  width: 4rem;
  height: 4rem;
  background: #e7eeee;
  color: var(--text);
}
#promo button:hover { background: var(--accent); }

/* Φόρμα νέας παρτίδας */
.newgame summary {
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  padding: .55rem .8rem;
  text-align: center;
  list-style: none;
}
.newgame form {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  padding-top: .75rem;
  font-size: .9rem;
  color: var(--muted);
}
.newgame label { display: flex; flex-direction: column; gap: .25rem; }
.newgame select {
  background: #f2f6f6;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .45rem;
  font-size: .95rem;
}

/* Λίστα ανοιγμάτων */
.page {
  width: min(700px, 94vw);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.search input {
  width: 100%;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .7rem 1rem;
  font-size: 1rem;
}
.search input:focus { outline: 2px solid rgb(10 168 168 / .4); }
.section-title { color: var(--muted); font-size: .9rem; margin: .5rem 0 0; }
.op-list { display: flex; flex-direction: column; gap: .4rem; }
.op-item {
  display: flex;
  align-items: center;
  gap: .8rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .65rem .9rem;
  text-decoration: none;
  color: var(--text);
}
.op-item:hover { background: #e9f7f6; border-color: var(--accent); }
.op-item .eco {
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  font-size: .75rem;
  padding: .15rem .4rem;
  font-weight: 600;
}
.op-item .pgn { margin-left: auto; color: var(--muted); font-size: .8rem; }

/* Συντεταγμένες σκακιέρας (a-h, 1-8) — το default styling είναι σχεδόν αόρατο. */
.cg-wrap coords {
  font-size: min(1.9vw, 12px);
  font-weight: 700;
  opacity: 1;
}
/* Στο φωτεινό teal board ένα σκούρο χρώμα διαβάζεται σε όλα τα τετράγωνα. */
.cg-wrap coords coord { color: #4f6a6d !important; }
/* Γράμματα: καθαρά κάτω από τη σκακιέρα. */
.cg-wrap coords.files {
  bottom: -20px;
  text-transform: lowercase;
}
.cg-wrap coords.files coord { color: #6b7d80 !important; }

/* Trainer */
#pgnview { line-height: 1.9; color: var(--muted); }
#pgnview .done { color: var(--text); }
#pgnview .current {
  color: var(--accent);
  font-weight: 700;
  border-bottom: 2px solid var(--accent);
}
#progress { font-size: .85rem; color: var(--muted); }
