/* ============================================================================
   ΑΙΣΘΗΤΙΚΗ — «Στα αρχαία χρόνια»
   Παλέτα αρχαίου αγγείου: τερακότα, μαύρο, χρυσό, μάρμαρο, αιγαιοπελαγίτικο μπλε
   Διακόσμηση: μαίανδρος, κίονες, αμφορείς, δάφνες. Responsive (tablet/desktop).
   ========================================================================== */

:root {
  --clay:    #c0552b;   /* τερακότα */
  --clay-dk: #9c3f1e;
  --ink:     #211a14;   /* μελανό αγγείου */
  --gold:    #c8a24a;
  --gold-dk: #a9842f;
  --marble:  #f4ecdd;   /* μαρμάρινο μπεζ */
  --ivory:   #fbf6ec;
  --aegean:  #2a6f97;   /* αιγαιοπελαγίτικο μπλε */
  --aegean-dk:#1d557a;
  --leaf:    #6f8f4a;   /* δάφνη */
  --bronze:  #9c6b3f;
  --paper:   #efe4cf;

  --ok:      #4f8a3a;
  --bad:     #c23b22;

  --shadow:  0 6px 18px rgba(33,26,20,.16);
  --radius:  16px;

  --font-body: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-head: Georgia, "Times New Roman", "Palatino Linotype", serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 50% -10%, #fff8ec 0%, transparent 60%),
    var(--marble);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  line-height: 1.5;
}

/* ---- Μαίανδρος (Greek key) ως επαναλαμβανόμενη ταινία ---- */
.meander-strip {
  height: 16px;
  background-color: var(--ink);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='16' viewBox='0 0 48 16'%3E%3Cg fill='none' stroke='%23c8a24a' stroke-width='2'%3E%3Cpath d='M2 14 V4 H14 V11 H7'/%3E%3Cpath d='M26 2 V12 H38 V5 H31'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-size: 48px 16px;
}

/* =========================== TOPBAR =========================== */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--marble);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-head);
  font-size: 1.15rem; font-weight: bold; letter-spacing: .5px; }
.brand-ic { width: 26px; height: 26px; color: var(--gold); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.hud { display: flex; align-items: center; gap: 12px; background: rgba(255,255,255,.08);
  padding: 6px 12px; border-radius: 999px; font-size: .95rem; }
.hud-name { font-weight: 600; }
.hud-stars { display: flex; align-items: center; gap: 4px; color: var(--gold); }
.hud-stars .ic { width: 18px; height: 18px; }
.icon-btn { background: rgba(255,255,255,.12); border: 0; color: inherit;
  font-size: 1.2rem; width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  transition: transform .1s, background .2s; }
.icon-btn:hover { background: rgba(255,255,255,.22); }
.icon-btn:active { transform: scale(.92); }

/* =========================== APP / SCREENS =========================== */
#app { flex: 1; width: 100%; max-width: 920px; margin: 0 auto; padding: 18px 16px 30px; }
.screen { animation: fadein .35s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.ic { width: 1em; height: 1em; vertical-align: middle; fill: currentColor; }

/* =========================== ΚΟΥΜΠΙΑ =========================== */
.btn {
  font-family: var(--font-body); font-size: 1.05rem; font-weight: 700;
  color: var(--ivory); background: linear-gradient(180deg, var(--clay), var(--clay-dk));
  border: 0; border-radius: var(--radius); padding: 14px 26px; cursor: pointer;
  box-shadow: var(--shadow); transition: transform .08s, filter .2s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(2px); }
.btn-big { display: block; width: 100%; font-size: 1.3rem; padding: 18px; margin-top: 10px; }
.btn-secondary { background: linear-gradient(180deg, var(--aegean), var(--aegean-dk)); }
.btn-next { display: block; width: 100%; margin-top: 16px;
  background: linear-gradient(180deg, var(--leaf), #567030); }

.link-btn { background: none; border: 0; color: var(--clay-dk); cursor: pointer;
  font-size: .95rem; text-decoration: underline; }

/* =========================== ΟΘΟΝΗ ΕΝΑΡΞΗΣ =========================== */
.start-screen {
  max-width: 560px; margin: 0 auto; background: var(--ivory);
  border: 3px solid var(--clay); border-radius: 22px; padding: 26px 24px 30px;
  box-shadow: var(--shadow); text-align: center;
}
.vase-emblem { width: 92px; height: 92px; margin: 0 auto 6px; color: var(--clay); }
.vase-emblem svg { width: 100%; height: 100%; }
.title { font-family: var(--font-head); font-size: 2.1rem; margin: 4px 0 2px; color: var(--ink); }
.subtitle { margin: 0 0 18px; color: var(--bronze); font-size: 1rem; }
.field-label { display: block; text-align: left; font-weight: 700; color: var(--clay-dk);
  margin: 16px 0 8px; font-size: .95rem; }
.name-input {
  width: 100%; font-size: 1.15rem; padding: 14px 16px; border-radius: 14px;
  border: 2px solid var(--gold); background: #fff; color: var(--ink); outline: none;
}
.name-input:focus { border-color: var(--clay); box-shadow: 0 0 0 3px rgba(200,85,43,.15); }

.avatar-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.avatar-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--paper); border: 2px solid transparent; border-radius: 14px;
  padding: 10px 6px; cursor: pointer; transition: transform .1s, border-color .2s;
}
.avatar-card:hover { transform: translateY(-2px); }
.avatar-card.selected { border-color: var(--clay); background: #fff;
  box-shadow: 0 0 0 3px rgba(200,85,43,.18); }
.avatar-pic { width: 64px; height: 64px; }
.avatar-pic svg { width: 100%; height: 100%; }
.avatar-name { font-size: .85rem; font-weight: 600; color: var(--ink); }

.diff-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.diff-btn { display: flex; flex-direction: column; gap: 2px; align-items: center;
  background: var(--paper); border: 2px solid transparent; border-radius: 14px;
  padding: 12px; cursor: pointer; color: var(--ink); }
.diff-btn b { font-size: 1.05rem; }
.diff-btn small { color: var(--bronze); }
.diff-btn.selected { border-color: var(--aegean); background: #fff;
  box-shadow: 0 0 0 3px rgba(42,111,151,.16); }
.welcome-back { margin-top: 14px; color: var(--leaf); font-weight: 600; }

/* =========================== ΧΑΡΤΗΣ =========================== */
.map-head { text-align: center; margin-bottom: 18px; }
.map-title { font-family: var(--font-head); font-size: 1.9rem; margin: 0 0 4px; }
.map-sub { color: var(--bronze); margin: 0 auto 14px; max-width: 560px; }

.progress { background: var(--paper); border-radius: 999px; height: 16px; overflow: hidden;
  border: 1px solid rgba(33,26,20,.12); max-width: 560px; margin: 0 auto; }
.progress.thin { height: 8px; max-width: none; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--gold), var(--clay));
  transition: width .5s ease; }
.progress-label { text-align: center; color: var(--bronze); font-size: .9rem; margin: 8px 0 0; }

.trail { display: flex; flex-direction: column; gap: 14px; margin: 20px 0; position: relative; }
.station {
  display: flex; align-items: center; gap: 16px; text-align: left;
  background: var(--ivory); border: 2px solid var(--gold); border-radius: var(--radius);
  padding: 14px 16px; cursor: pointer; width: 100%;
  box-shadow: var(--shadow); transition: transform .12s, border-color .2s;
}
.station:hover { transform: translateX(4px); border-color: var(--clay); }
.station.locked { opacity: .65; filter: grayscale(.5); cursor: not-allowed; border-color: #bbb; }
.station.done { border-color: var(--leaf); }
.station-badge { flex: 0 0 auto; width: 58px; height: 58px; border-radius: 50%;
  display: grid; place-items: center; background: var(--ink); color: var(--gold); }
.station.done .station-badge { background: var(--leaf); color: #fff; }
.station-ic { width: 34px; height: 34px; }
.station-info { flex: 1; }
.station-num { font-size: .78rem; text-transform: uppercase; letter-spacing: 1px; color: var(--bronze); }
.station-name { font-family: var(--font-head); font-size: 1.25rem; color: var(--ink); }
.station-desc { font-size: .9rem; color: var(--bronze); }
.station-stars { margin-top: 4px; display: flex; gap: 2px; }
.station-stars .ic { width: 18px; height: 18px; }
.star-on { color: var(--gold); }
.star-off { color: #d8cdb6; }
.station-medal { color: var(--leaf); }
.medal-ic { width: 30px; height: 30px; }

.badges-shelf { margin-top: 24px; }
.shelf-title { font-family: var(--font-head); text-align: center; color: var(--clay-dk); }
.badge-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.badge-chip { display: flex; align-items: center; gap: 8px; background: var(--ink);
  color: var(--gold); padding: 8px 14px; border-radius: 999px; font-size: .9rem; font-weight: 600; }
.badge-chip .badge-medal .ic { width: 20px; height: 20px; }

.finale-banner { margin-top: 22px; text-align: center; background: linear-gradient(180deg, var(--gold), var(--gold-dk));
  color: var(--ink); font-weight: 700; padding: 16px; border-radius: var(--radius); font-size: 1.1rem; }

/* =========================== ΕΡΩΤΗΣΕΙΣ =========================== */
.q-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.back-link { background: none; border: 0; color: var(--aegean-dk); cursor: pointer; font-size: .95rem; font-weight: 600; }
.q-station { font-family: var(--font-head); color: var(--clay-dk); font-weight: bold; }
.q-count { font-size: .9rem; color: var(--bronze); font-weight: 600; }

.q-card { background: var(--ivory); border: 2px solid var(--gold); border-radius: 20px;
  padding: 20px; margin-top: 12px; box-shadow: var(--shadow); }
.q-type { display: inline-block; background: var(--aegean); color: #fff; font-size: .78rem;
  font-weight: 700; padding: 4px 12px; border-radius: 999px; text-transform: uppercase; letter-spacing: .5px; }
.q-text { font-family: var(--font-head); font-size: 1.45rem; line-height: 1.35; margin: 14px 0 18px; }

.options, .tf-options { display: grid; gap: 12px; }
.tf-options { grid-template-columns: 1fr 1fr; }
.option {
  text-align: left; font-size: 1.1rem; padding: 16px 18px; border-radius: 14px;
  background: #fff; border: 2px solid var(--gold); color: var(--ink); cursor: pointer;
  transition: transform .08s, background .2s, border-color .2s;
}
.option:hover:not(:disabled) { border-color: var(--clay); transform: translateY(-1px); }
.option:disabled { cursor: default; }
.option.correct { background: var(--ok); color: #fff; border-color: var(--ok); }
.option.wrong { background: #f6d7d0; border-color: var(--bad); color: var(--bad); }
.option.removed { opacity: .35; text-decoration: line-through; }

.tf-btn { font-size: 1.3rem; font-weight: 700; padding: 22px; border-radius: 16px;
  border: 2px solid; cursor: pointer; }
.tf-true { background: #eaf3e4; border-color: var(--leaf); color: #3f5e26; }
.tf-false { background: #fdeee6; border-color: var(--clay); color: var(--clay-dk); }
.tf-btn.correct { background: var(--ok); color: #fff; border-color: var(--ok); }
.tf-btn.wrong { background: #f6d7d0; border-color: var(--bad); color: var(--bad); }

.q-tools { margin-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; }
.tool-btn { background: var(--paper); border: 2px dashed var(--gold-dk); color: var(--clay-dk);
  font-weight: 700; padding: 10px 16px; border-radius: 12px; cursor: pointer; }
.tool-btn:disabled { opacity: .45; cursor: default; }

/* Χρονόμετρο */
.timer-bar { height: 10px; background: var(--paper); border-radius: 999px; overflow: hidden;
  margin: 6px 0 4px; border: 1px solid rgba(33,26,20,.1); }
.timer-fill { height: 100%; width: 100%; background: linear-gradient(90deg, var(--leaf), var(--gold)); transition: width .12s linear; }
.timer-fill.low { background: linear-gradient(90deg, var(--clay), var(--bad)); }
.timer-bar.done .timer-fill { width: 0 !important; }

/* Εξήγηση */
.explain { margin-top: 18px; border-radius: 14px; padding: 14px 16px; border-left: 6px solid; }
.explain.ok { background: #eef6e9; border-color: var(--ok); }
.explain.info { background: #fdf3e6; border-color: var(--gold-dk); }
.explain-head { font-weight: 800; margin-bottom: 4px; }
.explain.ok .explain-head { color: var(--ok); }
.explain-text { margin: 0; font-size: 1.02rem; }

/* =========================== ΤΑΙΡΙΑΣΜΑ =========================== */
.match-help { color: var(--bronze); font-size: .92rem; margin: 0 0 10px; }
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.match-col { display: flex; flex-direction: column; gap: 10px; }
.match-item { text-align: center; font-size: 1.02rem; padding: 14px 12px; border-radius: 12px;
  border: 2px solid var(--gold); background: #fff; cursor: pointer; color: var(--ink); transition: .15s; }
.match-item.left { border-color: var(--aegean); }
.match-item.sel { background: var(--aegean); color: #fff; border-color: var(--aegean-dk); }
.match-item.matched { background: var(--ok); color: #fff; border-color: var(--ok); cursor: default; }
.match-item:disabled { cursor: default; }

/* =========================== ΧΡΟΝΟΛΟΓΙΚΗ ΣΕΙΡΑ =========================== */
.order-section-label { font-weight: 700; color: var(--clay-dk); margin: 10px 0 6px; }
.order-seq { display: flex; flex-direction: column; gap: 8px; min-height: 56px;
  background: var(--paper); border: 2px dashed var(--gold-dk); border-radius: 14px; padding: 10px; }
.order-empty { color: var(--bronze); margin: 4px; font-size: .92rem; }
.order-slot { display: flex; align-items: center; gap: 10px; background: #fff;
  border: 2px solid var(--gold); border-radius: 10px; padding: 10px 12px; }
.order-slot.ok { border-color: var(--ok); background: #eef6e9; }
.order-slot.bad { border-color: var(--bad); background: #f9e3dc; }
.order-rank { font-weight: 800; color: var(--clay); }
.order-label { flex: 1; }
.order-remove { background: none; border: 0; color: var(--bad); font-size: 1rem; cursor: pointer; }
.order-pool { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.order-chip { background: var(--ink); color: var(--marble); border: 0; border-radius: 10px;
  padding: 12px 14px; cursor: pointer; font-size: 1rem; }
.order-chip:hover { background: var(--clay-dk); }

/* =========================== ΑΠΟΤΕΛΕΣΜΑΤΑ =========================== */
.result-screen { max-width: 520px; margin: 0 auto; text-align: center; background: var(--ivory);
  border: 3px solid var(--gold); border-radius: 22px; padding: 28px 24px; box-shadow: var(--shadow); }
.result-emblem { width: 80px; height: 80px; margin: 0 auto 6px; color: var(--clay); }
.result-ic { width: 100%; height: 100%; }
.result-title { font-family: var(--font-head); font-size: 1.6rem; margin: 4px 0 12px; }
.result-stars { display: flex; justify-content: center; gap: 10px; margin: 10px 0; }
.result-star { width: 56px; height: 56px; display: inline-grid; place-items: center; }
.result-star .ic { width: 100%; height: 100%; }
.result-star.on { color: var(--gold); animation: pop .5s ease backwards; }
.result-star.off { color: #d8cdb6; }
@keyframes pop { 0% { transform: scale(0) rotate(-40deg); } 70% { transform: scale(1.25); } 100% { transform: scale(1); } }
.result-score { font-weight: 700; color: var(--bronze); }
.badge-won { display: flex; align-items: center; gap: 12px; justify-content: center;
  background: var(--ink); color: var(--gold); border-radius: 14px; padding: 14px; margin: 14px 0; }
.badge-won .badge-medal.big .ic { width: 44px; height: 44px; }
.badge-won-label { font-size: .85rem; color: var(--marble); }
.badge-won b { font-size: 1.1rem; }
.result-msg { color: var(--leaf); font-weight: 600; font-size: 1.05rem; }
.result-actions { display: flex; gap: 12px; margin-top: 18px; }
.result-actions .btn { flex: 1; }

/* =========================== CONFETTI =========================== */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
.confetti { position: absolute; top: -16px; width: 11px; height: 16px; border-radius: 2px;
  animation: fall 2.4s linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); opacity: .2; } }

/* =========================== FLOATING SVG ICONS =========================== */
.hist-bg-icons{ position:fixed; inset:0; pointer-events:none; z-index:0; overflow:hidden; }
.hbi{ position:absolute; opacity:.07; color:var(--clay); }
.h1{ width:160px; height:160px; left:2%;  top:28%; animation:edu-bob 11s ease-in-out infinite; }
.h2{ width:130px; height:130px; right:3%; top:20%; animation:edu-bob 13s ease-in-out infinite; animation-delay:-3s; }
.h3{ width:110px; height:110px; left:72%; top:55%; animation:edu-bob 10s ease-in-out infinite; animation-delay:-6s; }
.h4{ width:120px; height:120px; left:8%;  top:72%; animation:edu-bob 12s ease-in-out infinite; animation-delay:-4s; }
.h5{ width:100px; height:100px; right:5%; top:80%; animation:edu-bob  9s ease-in-out infinite; animation-delay:-2s; }

/* station cards σε grid (όπως τα 3): χρυσά αστέρια στο meta + κεντραρισμένο icon */
.station-stars-txt { color: var(--gold); letter-spacing: 2px; font-size: 1rem; }
.trail .station .station-badge.ec-emoji { margin-bottom: 4px; }

/* =========================== CORNER WATERMARKS =========================== */
.hist-amphora{
  position:fixed; left:-20px; bottom:-20px;
  font-size:220px; opacity:.06; pointer-events:none; z-index:0;
  animation: edu-bob 14s ease-in-out infinite;
  user-select:none;
}
.hist-temple{
  position:fixed; right:-20px; top:60px;   /* 60px κάτω από το gamebar */
  font-size:200px; opacity:.06; pointer-events:none; z-index:0;
  animation: edu-bob 14s ease-in-out infinite;
  animation-delay: -7s;   /* αντίθετη φάση → ένα bob-άρει πάνω ενώ το άλλο κάτω */
  user-select:none;
}

/* =========================== ΜΑΙΑΝΔΡΟΣ (renderMap) =========================== */
.hist-meander{
  height:16px; margin:10px 0 4px;
  background-color:var(--ink);
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='16' viewBox='0 0 48 16'%3E%3Cg fill='none' stroke='%23c8a24a' stroke-width='2'%3E%3Cpath d='M2 14 V4 H14 V11 H7'/%3E%3Cpath d='M26 2 V12 H38 V5 H31'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat:repeat-x; background-size:48px 16px;
  border-radius:6px; opacity:.75;
}

/* =========================== FOOTER =========================== */
.footer { text-align: center; padding: 14px; color: var(--bronze); font-size: .88rem;
  border-top: 1px solid rgba(33,26,20,.1); display: flex; gap: 8px; justify-content: center; align-items: center; }
.footer-sep { opacity: .5; }

/* =========================== SHAKE (λάθος) =========================== */
.shake { animation: shake .4s; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-7px); } 40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); } 80% { transform: translateX(5px); }
}

/* =========================== RESPONSIVE =========================== */
@media (max-width: 600px) {
  .title { font-size: 1.7rem; }
  .q-text { font-size: 1.25rem; }
  .avatar-grid { grid-template-columns: repeat(3, 1fr); }
  .avatar-pic { width: 54px; height: 54px; }
  .match-item { font-size: .95rem; padding: 12px 8px; }
  .hud-name { display: none; } /* εξοικονόμηση χώρου σε μικρές οθόνες */
  .result-actions { flex-direction: column; }
}

/* Μεγάλες οθόνες / tablet landscape: άνετα κουμπιά */
@media (min-width: 900px) {
  .options { grid-template-columns: 1fr 1fr; }
}
