/* GeoLudo Voyage (index.html). Builds on style.css. */
body.voyage { min-height: 100vh; min-height: 100dvh; }
body.voyage.in-game { overflow: hidden; }
.v-screen { display: none; position: relative; z-index: 1; }
.v-screen.active { display: block; }
#setup.active, #lobby.active { display: grid; place-items: start center; min-height: 100vh; min-height: 100dvh; padding: 20px 14px 32px; }

/* ---------- setup ---------- */
.v-card {
  width: min(560px, 100%); background: linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.04));
  border: 1px solid var(--panel-border); border-radius: 28px; padding: 26px clamp(16px, 4vw, 32px);
  box-shadow: var(--shadow); backdrop-filter: blur(14px); animation: rise .6s cubic-bezier(.2,.9,.3,1.2) both;
}
.v-card .logo h1 small { font-size: .45em; color: var(--accent-2); vertical-align: middle; letter-spacing: 1px; }
.v-section { margin: 20px 0; }
.v-section[hidden] { display: none; }
.v-section h2, .v-card h3 {
  font-family: var(--font-display); font-weight: 600; font-size: 14px; text-transform: uppercase;
  letter-spacing: 2px; color: var(--muted); margin: 0 0 10px;
}
.hint-line { font-size: 13px; color: var(--muted); margin: 8px 0 0; text-align: center; }
.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cat-btn, .format-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; border-radius: 16px;
  border: 1px solid var(--panel-border); background: rgba(0,0,0,.2); color: var(--text); transition: all .18s;
  -webkit-tap-highlight-color: transparent;
}
.cat-btn span, .format-btn span { font-size: 26px; }
.cat-btn b, .format-btn b { font-family: var(--font-display); font-weight: 600; font-size: 15px; }
.format-btn small { color: var(--muted); font-size: 12px; }
.cat-btn:hover, .format-btn:hover { background: rgba(255,255,255,.08); }
.cat-btn.active, .format-btn.active { border-color: var(--accent); background: rgba(255,209,102,.13); box-shadow: 0 0 0 1px var(--accent) inset; }
.format-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 18px; margin-bottom: 12px; }
.stepper button {
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--panel-border); background: rgba(255,255,255,.08);
  color: var(--text); font-size: 24px; line-height: 1;
}
.stepper b { font-family: var(--font-display); font-size: 34px; min-width: 32px; text-align: center; }
.name-list { display: grid; gap: 8px; margin-bottom: 14px; }
.name-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 8px; border-radius: 14px; background: rgba(0,0,0,.2); }
.name-row .pawn-icon { width: 26px; height: 26px; }
.name-row input { flex: 1 1 0; width: 0; min-width: 60px; background: transparent; border: 0; color: var(--text); font: 600 16px var(--font-body); padding: 8px 2px; outline: none; }
.name-row small { color: var(--muted); font-size: 11px; font-style: italic; white-space: nowrap; }
.name-input {
  width: 100%; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--panel-border); background: rgba(0,0,0,.25);
  color: var(--text); font: 600 17px var(--font-body); outline: none; margin-bottom: 12px;
}
.name-input:focus { border-color: var(--accent); }
.join-banner { display: flex; flex-direction: column; gap: 4px; text-align: center; padding: 14px; border-radius: 16px; background: rgba(6,214,160,.14); border: 1px solid rgba(6,214,160,.5); margin-top: 6px; }
.join-banner[hidden] { display: none; }
.join-banner code, .lobby-title code { font-family: var(--font-display); color: var(--accent); letter-spacing: 2px; }
.v-links { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; font-size: 14px; }
.v-links a {
  color: var(--text); text-decoration: none; padding: 9px 14px; border-radius: 99px; border: 1px solid var(--panel-border);
  background: rgba(255,255,255,.05); font-weight: 600;
}
.v-links a:hover { background: rgba(255,255,255,.12); }
.v-links details { flex-basis: 100%; color: var(--muted); margin-top: 6px; }
.v-links summary { cursor: pointer; font-weight: 600; color: #d8def5; text-align: center; }
.v-links ul { line-height: 1.6; padding-left: 20px; }
.resume-card { margin: 12px 0 0; }

/* ---------- lobby ---------- */
.lobby-title { text-align: center; font-family: var(--font-display); font-size: 24px; margin: 0 0 14px; }
.share-box { display: flex; gap: 6px; }
.share-box input { flex: 1; min-width: 0; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--panel-border); background: rgba(0,0,0,.25); color: var(--text); font: 13px var(--font-body); }
.share-box .btn-ghost { padding: 10px 14px; }
.share-box .btn-ghost[hidden] { display: none; }
.crew { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.crew li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: rgba(0,0,0,.2); animation: rise .35s both; }
.crew li .pawn-icon { width: 24px; height: 24px; }
.crew small { color: var(--muted); font-size: 12px; }
#lobby .btn-primary.big { margin-top: 8px; width: 100%; }
#lobby .link-btn { display: block; margin: 14px auto 0; }

/* ---------- game ---------- */
#game.active { display: flex; flex-direction: column; height: 100vh; height: 100dvh; min-height: 0; /* not the shared 100vh: on phones it hides the bottom panel under the browser bar */ padding: max(6px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom)); gap: 6px; }
.v-top { display: flex; align-items: center; gap: 8px; flex: none; min-width: 0; }
.v-round { font-size: 13px; color: var(--muted); white-space: nowrap; }
.v-round b { color: var(--text); }
.v-players { flex: 1; min-width: 0; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.v-players::-webkit-scrollbar { display: none; }
.vp {
  flex: 1 0 auto; min-width: 92px; max-width: 200px; padding: 5px 9px; border-radius: 12px; background: rgba(0,0,0,.25);
  border: 1px solid transparent; display: grid; grid-template-columns: 1fr auto; column-gap: 6px; align-items: center; transition: all .3s;
}
.vp.active { border-color: var(--pc); background: color-mix(in srgb, var(--pc) 18%, rgba(0,0,0,.2)); box-shadow: 0 0 12px color-mix(in srgb, var(--pc) 40%, transparent); }
.vp.off { opacity: .45; }
.vp-name { font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vp-num { font-size: 11px; color: var(--muted); text-align: right; white-space: nowrap; }
.vp-bar { grid-column: 1 / -1; height: 4px; border-radius: 99px; background: rgba(255,255,255,.12); overflow: hidden; margin-top: 3px; }
.vp-bar i { display: block; height: 100%; background: var(--pc); transition: width .8s; }
.v-map { flex: 1; min-height: 0; }
.v-map .map-controls { top: auto; bottom: 10px; right: 10px; }
.v-map .map-hint { display: none; }

/* question card over the map */
.v-quiz {
  position: absolute; z-index: 4; top: 8px; left: 50%; transform: translateX(-50%); width: min(760px, calc(100% - 16px));
  padding: 10px 14px; border-color: var(--pc, var(--panel-border)); animation: drop-in .35s cubic-bezier(.2,.9,.3,1.2) both;
}
.v-quiz[hidden] { display: none; }
@keyframes drop-in { from { transform: translate(-50%, -20px); opacity: 0; } }
.v-quiz .q-flag { height: 54px; }
.v-quiz .q-prompt { font-size: clamp(20px, 3.6vw, 30px); }
.v-quiz .q-prompt.long { font-size: clamp(15px, 2.2vw, 20px); }
.q-note { font-size: 12.5px; color: #ffe08a; }
.q-note:empty { display: none; }

/* bottom panel */
.v-panel {
  position: absolute; z-index: 4; left: 50%; bottom: 10px; transform: translateX(-50%); width: min(780px, calc(100% - 16px));
  padding: 10px 14px 12px; border-radius: 20px; background: rgba(8, 14, 36, .92); border: 2px solid var(--pc, var(--panel-border));
  box-shadow: 0 18px 50px rgba(0,0,0,.5); backdrop-filter: blur(10px); display: flex; flex-direction: column; gap: 8px;
}
.v-panel-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.v-panel-head .dot { width: 14px; height: 14px; border-radius: 50%; box-shadow: 0 0 10px currentColor; flex: none; }
.v-panel-head b { font-family: var(--font-display); font-size: 18px; font-weight: 600; }
#panel-sub { font-size: 13.5px; color: var(--muted); }
.v-levels { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.v-levels[hidden] { display: none; }
.v-levels button {
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 2px; border-radius: 12px; min-width: 0;
  border: 2px solid color-mix(in srgb, var(--c) 70%, transparent); background: color-mix(in srgb, var(--c) 15%, rgba(0,0,0,.3));
  color: var(--text); transition: transform .12s, background .15s;
}
.v-levels button:hover, .v-levels button:focus-visible { background: var(--c); color: #10142a; transform: translateY(-3px); outline: none; }
.v-levels b { font-family: var(--font-display); font-size: 22px; line-height: 1; }
.v-levels span { font-size: 10.5px; font-weight: 700; white-space: nowrap; }
.v-levels em { font-style: normal; font-size: 10.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .85; }
.v-result { display: flex; align-items: center; gap: 12px; }
.v-result[hidden] { display: none; }
.v-result .result-icon { --rc: var(--ok); width: 40px; height: 40px; font-size: 20px; }
.v-result.bad .result-icon { --rc: var(--bad); }
.v-result .result-title { font-size: 18px; }
.v-result .result-sub { font-size: 13.5px; }
.knew { display: inline-block; color: #ffe08a; margin-left: 4px; }
.gold { color: var(--accent); }
.muted { color: var(--muted); }
#next-btn { align-self: flex-end; padding: 10px 18px; }
#next-btn[hidden] { display: none; }

/* map overlay: route, ports, ships */
#map .overlay { transition: opacity .4s; }
body.answering #map .overlay { opacity: .22; }
#map .route-glow { fill: none; stroke: rgba(255, 224, 138, .18); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
#map .route-line { fill: none; stroke: #ffe08a; stroke-width: 1.8; stroke-dasharray: 6 5; stroke-linecap: round; stroke-linejoin: round; opacity: .9; }
#map .port-dot { fill: #fffbe6; stroke: #2b2140; stroke-width: 1.4; }
#map .port.home .port-dot { fill: var(--accent); }
#map .port-label.home-label { text-anchor: end; }
#map .port-label, #map .ship-label {
  font-family: var(--font-display); font-weight: 600; fill: #fff; paint-order: stroke; stroke: rgba(0, 10, 30, .85);
  stroke-linejoin: round; text-anchor: middle;
}
#map .ship-label { font-size: 8px; stroke-width: 2.4px; }
#map .target-ring { fill: none; stroke-width: 3; animation: pulse-cell 1s ease-in-out infinite; }
#map .target-label { fill: #ffe08a; }
#map .ship .ship-inner { transform-box: fill-box; transform-origin: 50% 80%; }
#map .ship.active .ship-inner { animation: bob-ship 1.6s ease-in-out infinite; }
#map .ship.offline { opacity: .4; }
@keyframes bob-ship { 50% { transform: translateY(-2px) rotate(-3deg); } }
#map .country.picked { fill: #ffe08a !important; }

.net-banner {
  position: fixed; z-index: 50; top: 8px; left: 50%; transform: translateX(-50%); padding: 8px 16px; border-radius: 99px;
  background: rgba(239,71,111,.95); color: #fff; font-weight: 700; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.net-banner a { color: #fff; margin-left: 8px; }
.win-actions.column { flex-direction: column; }
.menu-card h2 { margin-top: 0; }

@media (max-width: 640px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .v-round { display: none; }
  .v-levels { grid-template-columns: repeat(3, 1fr); }
  .v-levels em { font-size: 10px; }
  .v-panel { bottom: 6px; padding: 8px 10px 10px; width: calc(100% - 12px); max-height: 62%; overflow-y: auto; }
  .v-levels button { padding: 6px 2px; }
  #next-btn { padding: 8px 16px; }
  .v-panel-head b { font-size: 16px; }
  #panel-sub { font-size: 12.5px; flex-basis: 100%; }
  .v-quiz { top: 6px; width: calc(100% - 12px); padding: 8px 10px; }
  .v-quiz .q-flag { height: 40px; }
  .v-map .map-controls { display: none; }
}

/* while answering, the question card says it all: free the bottom of the map */
body.answering .v-panel { display: none; }

/* compass tokens */
#map .treasure-label { stroke-width: 0; text-anchor: middle; }
.v-levels button { position: relative; }
.lv-gem { position: absolute; top: -8px; right: -4px; font-style: normal; font-size: 15px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.5)); animation: bob-ship 1.6s ease-in-out infinite; }
.hint-btn {
  align-self: flex-start; margin-top: 6px; padding: 6px 12px; border-radius: 999px; font: 700 13px var(--font-body); color: var(--text);
  background: rgba(255, 209, 102, .14); border: 1px solid var(--accent); cursor: pointer; transition: background .15s;
}
.hint-btn:hover:not(:disabled) { background: rgba(255, 209, 102, .28); }
.hint-btn:disabled { opacity: .45; cursor: not-allowed; border-color: var(--panel-border); }
.hint-btn small { color: var(--muted); font-weight: 600; }
.hint-btn[hidden] { display: none; }

/* computer captains */
.type-btn {
  flex: none; min-width: 98px; padding: 6px 12px; border-radius: 999px; font: 600 12.5px var(--font-body); color: var(--text); cursor: pointer;
  background: rgba(255,255,255,.08); border: 1px solid var(--panel-border); transition: background .2s, border-color .2s;
}
.type-btn:hover { background: rgba(255,255,255,.14); }
.type-btn.bot { border-color: var(--accent); background: rgba(255,209,102,.12); }
.crew li .type-btn { min-width: 0; margin-left: auto; }
.crew-x { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--panel-border); background: rgba(255,255,255,.06); color: var(--muted); cursor: pointer; }
.crew-x:hover { color: var(--text); background: rgba(239,71,111,.3); }
.add-bot { width: 100%; margin: -4px 0 12px; }
.add-bot[hidden] { display: none; }
@media (max-width: 420px) { .name-row small { display: none; } }
.lv-risk { font-size: 9.5px; opacity: .75; font-weight: 600; }
.v-levels button:hover .lv-risk { opacity: 1; }
