/* ==========================================================================
   Lies & Ships — styles. Theme tokens and shared components come from
   shared/style.css.

   The board is the game: 7 x 7 squares of water as wide as the phone allows,
   ships drawn over them (mine with a yellow deck), hits, splashes and lies on top.
   ========================================================================== */

.ls {
  --water: #bfe0ec;
  --water-2: #a9d3e3;
  display: grid; gap: .8rem; max-width: 30rem; margin-inline: auto; padding-block: .5rem 2rem;
}
:root[data-theme="dark"] .ls { --water: #13394c; --water-2: #1b4a5f; }

.ls-title { font-size: clamp(1.6rem, 7vw, 2.2rem); text-align: center; }
.ls-title--lost { color: var(--muted); }
.ls-sub { font-size: 1.2rem; text-align: center; }
.ls-note { font-size: 1.05rem; font-weight: 700; text-align: center; }
.ls-center { text-align: center; }
.ls-center-btn { justify-self: center; }
.ls-sent { font-size: 1.15rem; font-weight: 900; text-align: center; color: var(--olive); }
:root[data-theme="dark"] .ls-sent { color: #b7cc6a; }
.ls-top { display: flex; align-items: center; gap: .6rem; }
.ls-top > .clock { margin-inline-start: auto; }
.ls-wins { font-weight: 900; }
.ls-row { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }

/* ---------- Menu ---------- */

.ls-menu { display: grid; gap: .7rem; }
.ls-menu__art { font-size: 1.8rem; text-align: center; }
.ls-tagline { font-size: 1.1rem; font-weight: 700; text-align: center; }
.ls-best { font-weight: 900; text-align: center; }
.howto { max-width: 30rem; margin: 1.5rem auto 0; padding: .25rem 1rem; }
.howto summary { min-height: var(--tap); display: flex; align-items: center; font-weight: 800; cursor: pointer; }
.howto ol { display: grid; gap: .5rem; padding: 0 0 1rem; padding-inline-start: 1.4rem; list-style: decimal; }
.host--small .host__teta { width: 76px; }
.host--small .bubble { padding: .65rem .9rem; font-weight: 700; }

/* ---------- The two sides ---------- */

.ls-sides { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.ls-side { display: flex; align-items: center; gap: .5rem; min-width: 0; padding: .45rem .6rem; background: var(--surface); border: 3px solid var(--line); border-radius: 16px 14px 18px 13px; flex-wrap: wrap; }
.ls-side.is-me { border-color: var(--sea); }
:root[data-theme="dark"] .ls-side.is-me { border-color: #7cc8ea; }
.ls-side.is-turn { box-shadow: 0 0 0 3px var(--sun); }
.ls-side__faces { font-size: 1.4rem; line-height: 1; }
.ls-side__who { display: grid; min-width: 0; flex: 1; }
.ls-side__name { font-weight: 900; line-height: 1.15; overflow-wrap: anywhere; }
.ls-side__ships { font-size: .85rem; letter-spacing: .05em; }
.ls-side__lies { flex-basis: 100%; font-weight: 800; color: var(--muted); }

/* ---------- The board ---------- */

/* One grid: the labels, the squares of water (buttons), then the ships and the marks drawn over them. */
.ls-board { display: grid; grid-template-columns: 1.1rem repeat(7, minmax(0, 1fr)); grid-template-rows: auto repeat(7, auto); gap: 3px; width: 100%; max-width: 26rem; margin-inline: auto; user-select: none; -webkit-user-select: none; }
.ls-board--small { max-width: 19rem; }
.ls-board__label { display: grid; place-items: center; font-size: .75rem; font-weight: 900; color: var(--muted); }
.ls-cell { aspect-ratio: 1; min-width: 0; padding: 0; font: inherit; background: var(--water); border: 2px solid var(--water-2); border-radius: 6px; cursor: default; touch-action: manipulation; }
.ls-board.is-live .ls-cell:not(:disabled) { cursor: pointer; }
.ls-board.is-live .ls-cell:not(:disabled):active { filter: brightness(1.15); }
.ls-cell:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.ls-cell:disabled { opacity: 1; }
.ls-cell.is-radar-yes { border-color: #f08a5d; background-color: color-mix(in srgb, var(--water) 72%, #f08a5d); }
.ls-cell.is-radar-no { background-image: repeating-linear-gradient(45deg, transparent 0 5px, rgb(0 0 0 / .08) 5px 7px); }
.ls-cell.is-scan { border-color: #7cc8ea; background-color: color-mix(in srgb, var(--water) 65%, #7cc8ea); }

/* Ships: drawn over the squares they cover, taps go through to the squares. */
/* The drawing is laid over the ship's squares and never makes them bigger: the grid sizes the squares, the ship just fills them. */
.ls-ship { position: relative; z-index: 1; display: block; min-width: 0; min-height: 0; pointer-events: none; }
.ls-ship.is-grab { pointer-events: auto; cursor: pointer; }
.ls-ship svg { position: absolute; inset: 2px; display: block; width: calc(100% - 4px); height: calc(100% - 4px); overflow: visible; filter: drop-shadow(0 2px 0 rgb(0 0 0 / .25)); }
.ls-art__hull { fill: #7d8b96; stroke: var(--line); stroke-width: .7; }
.ls-art__deck { fill: #b9c4cb; }
.ls-art__bridge { fill: #e9ecef; stroke: var(--line); stroke-width: .5; }
.ls-art__port { fill: #2d4a5c; }
.ls-art__gun { fill: #4e5b64; stroke: var(--line); stroke-width: .35; }
.ls-ship.is-mine .ls-art__bridge, .ls-ship.is-mine .ls-art__deck { fill: var(--sun); }
.ls-ship.is-team .ls-art__hull { fill: #9aa6ae; }
.ls-ship.is-sunk svg { opacity: .75; filter: grayscale(.4) brightness(.65); }
.ls-ship.is-sunk .ls-art__hull { fill: #7a3328; }
.ls-ship.is-picked svg { filter: drop-shadow(0 0 4px var(--sun)) drop-shadow(0 0 2px var(--sun)); }
.ls-ship.is-picked { animation: ls-bob 1.2s ease-in-out infinite; }
@keyframes ls-bob { 50% { transform: translateY(-2px); } }
.ls-ship__owner { position: absolute; top: -6px; inset-inline-start: -4px; font-size: .8rem; line-height: 1; }

/* Marks: hits, splashes, lies, the radar, ideas, what is being aimed at. */
.ls-mark { position: relative; z-index: 2; display: grid; place-items: center; pointer-events: none; }
.ls-mark b { font-size: clamp(.9rem, 4.6vw, 1.35rem); line-height: 1; }
.ls-board--small .ls-mark b { font-size: clamp(.75rem, 3.6vw, 1.05rem); }
.ls-mark--sunk b { font-weight: 900; color: #fff; text-shadow: 0 1px 0 #000; }
.ls-mark--hit.is-fresh b { animation: ls-boom .45s ease-out; }
@keyframes ls-boom { from { transform: scale(2.2); opacity: 0; } }
.ls-mark__badge { position: absolute; top: -5px; inset-inline-end: -4px; font-size: .75rem; line-height: 1; }
.ls-mark__radar { position: absolute; top: -6px; inset-inline-start: -4px; padding: 1px 4px; font-size: .7rem; font-weight: 900; line-height: 1.2; color: #fff; background: #4e5b64; border: 1.5px solid var(--line); border-radius: 8px; }
.ls-mark__radar.is-found { background: #e8590c; }
.ls-mark__idea { position: absolute; bottom: -4px; inset-inline-start: -3px; font-size: .8rem; line-height: 1; }
.ls-mark.is-aim { background: rgb(207 58 39 / .85); border: 2px solid var(--line); border-radius: 6px; }
.ls-mark__aim { color: #fff; font-size: 1.2rem; }
.ls-mark.is-target { outline: 3px solid var(--tomato); outline-offset: -2px; border-radius: 6px; animation: ls-pulse 1s ease-in-out infinite; }
@keyframes ls-pulse { 50% { outline-color: var(--sun); } }

/* A miss: a splash of water, drawn; it pops up when the shot has just landed. */
.ls-splash { display: block; width: 92%; aspect-ratio: 1; }
.ls-splash svg { display: block; width: 100%; height: 100%; overflow: visible; }
.ls-splash__ripple { fill: none; stroke: #9fd3ea; stroke-width: 1.4; opacity: .8; }
.ls-splash__water { fill: #e3f4fb; stroke: #7cc0dc; stroke-width: .8; stroke-linejoin: round; }
.ls-splash__drop { fill: #e3f4fb; }
:root:not([data-theme="dark"]) .ls-splash__ripple { stroke: #2f7ea3; }
:root:not([data-theme="dark"]) .ls-splash__water { fill: #4a9cc2; stroke: #2a6f90; }
:root:not([data-theme="dark"]) .ls-splash__drop { fill: #4a9cc2; }
.ls-mark--miss.is-fresh .ls-splash__water { transform-origin: 12px 18px; animation: ls-splash .5s ease-out; }
.ls-mark--miss.is-fresh .ls-splash__drop { animation: ls-drops .6s ease-out; }
.ls-mark--miss.is-fresh .ls-splash__ripple { transform-origin: 12px 18.5px; animation: ls-ripple .8s ease-out; }
@keyframes ls-splash { from { transform: scaleY(0); } 60% { transform: scaleY(1.25); } }
@keyframes ls-drops { from { transform: translateY(8px); opacity: 0; } }
@keyframes ls-ripple { from { transform: scale(.3); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .ls-mark.is-target, .ls-ship.is-picked, .ls-mark.is-fresh *, .ls-mark--hit.is-fresh b { animation: none; }
}

.ls-boards { display: grid; gap: .8rem; }
.ls-board-title { font-weight: 900; text-align: center; margin-bottom: .3rem; }

/* ---------- What the last volley did ---------- */

.ls-event { display: grid; gap: .2rem; padding: .6rem .9rem; text-align: center; color: #fff; border: 3px solid var(--line); border-radius: var(--radius); animation: ls-in .3s ease-out; }
.ls-event.is-good { background: var(--olive); }
.ls-event.is-bad { background: var(--tomato); }
.ls-event p { font-weight: 800; }
.ls-event__shots { display: flex; flex-wrap: wrap; justify-content: center; gap: .2rem .7rem; }
.ls-event__shot small { font-weight: 800; }
@keyframes ls-in { from { transform: translateY(-6px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ls-event { animation: none; } }

/* ---------- Answering and calling ---------- */

.ls-alert { display: grid; justify-items: center; gap: .15rem; padding: .7rem 1rem; text-align: center; background: var(--surface-2); border: 3px solid var(--line); border-radius: var(--radius); }
.ls-alert b { font-size: 1.2rem; }
.ls-alert span { font-weight: 800; }
.ls-alert.is-hit { background: #f7ddd6; color: var(--ink); }
:root[data-theme="dark"] .ls-alert.is-hit { background: #5a2a22; color: var(--text); }
.ls-radar.is-found { background: #ffe8d6; color: var(--ink); border-color: #e8590c; }
:root[data-theme="dark"] .ls-radar.is-found { background: #5c3317; color: var(--text); }
.ls-volley { display: grid; gap: .5rem; }
.ls-shot { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "sq truth votes" "sq heard votes"; align-items: center; column-gap: .8rem; min-height: 60px; padding: .5rem .9rem; font: inherit; text-align: start; color: var(--text); background: var(--surface); border: 3px solid var(--line); border-radius: 14px 16px 13px 17px; box-shadow: 0 3px 0 var(--line); }
button.ls-shot { cursor: pointer; }
button.ls-shot:disabled { cursor: default; opacity: .75; }
.ls-shot__sq { grid-area: sq; font-size: 1.3rem; }
.ls-shot__truth { grid-area: truth; font-weight: 900; }
.ls-shot__heard { grid-area: heard; font-size: .9rem; font-weight: 800; color: var(--muted); }
.ls-shot .ls-votes, .ls-shot .ls-liar { grid-area: votes; }
.ls-shot.is-lie { background: var(--tomato); color: #fff; }
.ls-shot.is-lie .ls-shot__heard { color: #fff; }
.ls-shot--said { grid-template-areas: "sq truth votes"; }
.ls-shot--said .ls-votes { grid-area: auto; }
.ls-liar { --btn-bg: var(--tomato); --btn-fg: #fff; white-space: nowrap; }
.ls-liar.is-on, .ls-believe.is-on { outline: 4px dashed var(--line); outline-offset: 3px; }
.ls-believe { --btn-bg: var(--olive); --btn-fg: #fff; display: grid; justify-items: center; }
.ls-votes { font-size: 1.05rem; letter-spacing: .1em; }
.ls-lies { font-weight: 900; }

/* ---------- The end ---------- */

.ls-lies-list { display: grid; gap: .4rem; }
.ls-lies-list li { display: grid; gap: .1rem; padding: .5rem .8rem; background: var(--surface); border: 2px solid var(--line); border-radius: 12px; }
.ls-lies-list li small { font-weight: 900; color: var(--muted); }
.ls-lies-list li.is-caught small { color: var(--tomato); }
:root[data-theme="dark"] .ls-lies-list li.is-caught small { color: #ff8a75; }
