/* Simos Parking Battle - styles. Mobile-first, one column, no hover states. */

:root {
  --blue: #0F3D5E;
  --blue-dark: #0A2C45;
  --teal: #1AB3C2;
  --teal-soft: #DDF4F6;
  --sun: #F6B12E;
  --sand: #F4E1B5;
  --sand-soft: #FBF3E1;
  --ink: #12283A;
  --muted: #5B7387;
  --line: #D8E3E9;
  --red: #E0453A;
  --red-soft: #FBE6E3;
  --red-ink: #A9302A;
  --green: #2E9E62;
  --green-soft: #E4F5EB;
  --radius: 14px;
  --shadow: 0 4px 14px rgba(15, 61, 94, 0.14);
  --tap: 48px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  background: var(--sand-soft);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; }

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: #fff;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 30px rgba(15, 61, 94, 0.08);
}

/* ---------- Header ---------- */
.topbar {
  background: var(--blue);
  color: #fff;
  padding: 12px 14px 10px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px 12px;
  flex-wrap: wrap;
}
.brand-title { font-size: 17px; font-weight: 800; letter-spacing: 0.2px; line-height: 1.2; }
.brand-sub { font-size: 11.5px; color: var(--teal-soft); opacity: 0.9; margin-top: 2px; }
.lang-switch { display: flex; gap: 4px; margin-left: auto; }
.lang-pill {
  min-width: 32px;
  height: 30px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid rgba(26, 179, 194, 0.7);
  background: transparent;
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
}
.lang-pill.active { background: var(--teal); color: var(--blue-dark); border-color: var(--teal); }

/* ---------- Sub navigation ---------- */
.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  background: var(--teal-soft);
}
.subnav button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 12px;
  border: none;
  border-radius: 999px;
  background: #fff;
  color: var(--blue);
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(15, 61, 94, 0.12);
}
.subnav button.active { background: var(--blue); color: #fff; }

/* ---------- Layout ---------- */
main { flex: 1; padding: 16px 14px 28px; }
.screen { display: none; }
.screen.active { display: block; }
h2 { font-size: 20px; margin: 0 0 6px; color: var(--blue); }
h3 { font-size: 15px; margin: 0 0 4px; color: var(--blue); }
.lede { color: var(--muted); font-size: 13.5px; line-height: 1.5; margin: 0 0 16px; }
.lede.outro { margin-top: 14px; font-weight: 700; color: var(--blue); }
.center { text-align: center; padding: 18px 6px; }
.status-line { text-align: center; font-size: 13.5px; color: var(--muted); margin: 6px 0 10px; font-weight: 600; }
.status-line.good { color: var(--green); }
.footer { text-align: center; padding: 10px 14px 22px; border-top: 1px solid #EEF2F5; }
.footer .credit { font-size: 11px; color: #9AB0C0; margin-top: 8px; }
.partners { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 12px; }
.partners img { width: auto; max-width: 44vw; object-fit: contain; }
.partners .ycycle { height: 36px; }
.partners .erasmus { height: 30px; }
.partners .eu { height: 28px; }
.partners .inedivim { height: 40px; border-radius: 4px; }
body.on-auth .partners .ycycle { display: none; }
.auth-logo { display: block; width: min(250px, 72%); height: auto; margin: 2px auto 14px; }

/* ---------- Forms ---------- */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--blue); margin-bottom: 5px; }
.hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
input, select {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  font: inherit;
  font-size: 16px; /* 16px stops iOS from zooming in on focus */
  background: #fff;
  color: var(--ink);
  appearance: none;
  -webkit-appearance: none;
}
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 36px;
}
input:focus, select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(26, 179, 194, 0.2); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: var(--tap);
  padding: 10px 16px;
  border: none;
  border-radius: 12px;
  font-size: 15.5px;
  font-weight: 800;
  line-height: 1.2;
  margin-top: 4px;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:active { background: var(--blue-dark); }
.btn-cta { background: var(--sun); color: var(--blue-dark); }
.btn-cta:active { filter: brightness(0.94); }
.btn-outline { background: #fff; color: var(--blue); border: 1.5px solid var(--blue); }
.btn-outline:active { background: var(--teal-soft); }
.btn-ghost { background: transparent; color: var(--muted); font-weight: 700; }
.btn:disabled { opacity: 0.45; cursor: default; filter: none; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { margin-top: 0; }

.error {
  display: none;
  background: var(--red-soft);
  color: var(--red-ink);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  margin-bottom: 12px;
}
.error.show { display: block; }

/* ---------- Cards (lobby) ---------- */
.card { background: var(--teal-soft); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.card p { margin: 0 0 10px; font-size: 13px; color: var(--muted); line-height: 1.45; }
.card.sand { background: var(--sand-soft); border: 1.5px dashed var(--sun); }
.join-row { display: flex; gap: 8px; }
.join-row input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: 5px; text-align: center; font-weight: 800; font-size: 20px; }
.join-row .btn { width: auto; padding: 0 20px; margin-top: 0; }

.code-display {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: 8px;
  text-indent: 8px;
  text-align: center;
  color: var(--blue);
  background: #fff;
  border: 2px dashed var(--teal);
  border-radius: 12px;
  padding: 14px 10px;
  margin: 12px 0;
}
.spinner {
  width: 36px; height: 36px;
  margin: 0 auto 14px;
  border: 4px solid var(--teal-soft);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- The board ---------- */
.board {
  display: grid;
  grid-template-columns: 16px 1fr;
  grid-template-rows: 14px auto;
  margin: 0 0 8px;
  user-select: none;
  -webkit-user-select: none;
}
.board-cols { grid-column: 2; grid-row: 1; display: grid; grid-template-columns: repeat(8, 1fr); }
.board-rows { grid-column: 1; grid-row: 2; display: grid; grid-template-rows: repeat(8, 1fr); }
.board-cols span, .board-rows span {
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; color: var(--muted);
}
.board-map {
  grid-column: 2; grid-row: 2;
  position: relative;
  aspect-ratio: 1400 / 670; /* exactly the proportions of assets/board.jpg */
  border-radius: 8px;
  overflow: hidden;
  background: var(--sand);
  box-shadow: var(--shadow);
}
.board-map img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  pointer-events: none;
}
.grid {
  position: absolute; inset: 0;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
}
.cell {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(15, 61, 94, 0.35);
  line-height: 1;
  overflow: hidden;
}
.cell .b-icon { font-size: 11px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35)); }
.cell .v-icon { font-size: 12px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.45)); }
.cell.ship { background: rgba(15, 61, 94, 0.55); }
.cell.ship.selected { outline: 2px solid var(--sun); outline-offset: -2px; }
.cell.ship.sunk { background: rgba(224, 69, 58, 0.72); }
.cell.miss::after {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--blue);
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.4);
}
.cell.hit::before, .cell.hit::after {
  content: "";
  position: absolute;
  left: 20%; top: 50%;
  width: 60%; height: 2.5px;
  margin-top: -1.25px;
  background: var(--red);
  border-radius: 2px;
  box-shadow: 0 0 2px rgba(255, 255, 255, 0.9);
}
.cell.hit::before { transform: rotate(45deg); }
.cell.hit::after { transform: rotate(-45deg); }
.cell.hit .v-icon { opacity: 0.6; }
.cell.sunk::before, .cell.sunk::after { display: none; }
.cell.tappable:active { background: rgba(26, 179, 194, 0.45); }
.cell.target { outline: 3px solid var(--sun); outline-offset: -3px; background: rgba(246, 177, 46, 0.4); z-index: 1; }
@media (min-width: 420px) {
  .cell .b-icon { font-size: 13px; }
  .cell .v-icon { font-size: 14px; }
}

.board-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 14px 0 6px; }
.board-title b { font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--blue); }
.board-title span { font-size: 11.5px; color: var(--muted); text-align: right; }

/* ---------- Placement ---------- */
.toolbar { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin: 8px 0; }
.toolbar .btn { min-height: 44px; padding: 6px 4px; font-size: 12.5px; margin-top: 0; }
.palette { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 8px 0 10px; }
.chip {
  display: flex; align-items: center; gap: 8px;
  min-height: 46px;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--teal-soft);
  border: 2px solid transparent;
  color: var(--ink);
  text-align: left;
}
.chip .ic { font-size: 20px; }
.chip .nm { flex: 1; font-size: 12.5px; font-weight: 700; line-height: 1.15; }
.chip .dots { display: flex; gap: 2px; }
.chip .dots i { display: block; width: 6px; height: 6px; border-radius: 2px; background: var(--blue); }
.chip.selected { border-color: var(--sun); background: #FFF3DA; }
.chip.placed { background: var(--green-soft); }
.chip.placed .dots i { background: var(--green); }

/* ---------- Battle ---------- */
.turn-banner {
  text-align: center;
  font-weight: 800;
  font-size: 15px;
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 4px;
}
.turn-banner.mine { background: var(--sun); color: var(--blue-dark); }
.turn-banner.theirs { background: #EEF2F5; color: var(--muted); }
.vs { text-align: center; font-size: 12.5px; color: var(--muted); margin-bottom: 10px; min-height: 16px; }
.fire-bar { display: flex; align-items: center; gap: 8px; margin: 6px 0 4px; }
.fire-bar .label { flex: 1; font-weight: 800; font-size: 14.5px; color: var(--blue); }
.fire-bar .btn { width: auto; min-width: 128px; margin-top: 0; }
.fleet { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.fleet span {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--teal-soft);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px; font-weight: 700;
}
.fleet span.sunk { background: var(--red-soft); color: var(--red-ink); text-decoration: line-through; opacity: 0.85; }

/* ---------- Game over ---------- */
.result {
  text-align: center;
  font-size: 26px; font-weight: 900;
  padding: 20px;
  border-radius: var(--radius);
  margin-bottom: 6px;
}
.result.win { background: var(--green-soft); color: var(--green); }
.result.lose { background: var(--red-soft); color: var(--red-ink); }
.result-sub { text-align: center; color: var(--muted); font-size: 13px; margin: 0 0 12px; }

/* ---------- Leaderboard ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tabs button {
  flex: 1; min-height: 40px;
  border: none; border-radius: 10px;
  background: #EEF2F5; color: var(--blue);
  font-size: 13px; font-weight: 700;
}
.tabs button.active { background: var(--blue); color: #fff; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--muted); padding: 6px 4px; border-bottom: 2px solid var(--teal-soft); white-space: nowrap;
}
td { padding: 9px 4px; border-bottom: 1px solid #EEF2F5; vertical-align: middle; }
td.num, th.num { text-align: right; }
td.name { word-break: break-word; }
tbody tr:first-child td { font-weight: 800; }
.rank { color: var(--muted); font-weight: 700; width: 22px; }

/* ---------- How it was built ---------- */
.prompts { list-style: none; padding: 0; margin: 0; }
.prompt {
  background: var(--blue-dark);
  color: var(--teal-soft);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 8px;
}
.prompt .n { color: var(--sun); font-weight: 900; margin-right: 8px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%; bottom: 22px;
  transform: translate(-50%, 10px);
  background: var(--blue);
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 700; font-size: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 50;
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.good { background: var(--green); }
.toast.bad { background: var(--red); }
