/* The sailing game. Carried over from the previous site; colors come from the variables in styles.css. */
/* Values: choices add up to wind */
.voyage { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); gap: 16px; align-items: stretch; }
.sea { display: flex; flex-direction: column; overflow: hidden; border-radius: var(--radius); background: linear-gradient(var(--white), var(--pale)); box-shadow: inset 0 0 0 1px var(--line); }
.sea-art { display: block; width: 100%; height: auto; margin-top: auto; overflow: hidden; }
.sea-art .sky { fill: url(#sky); }
.sea-art .sun { fill: #e6eefa; }
.sea-art .gull { fill: none; stroke: #9fb4d6; stroke-width: 1.3; stroke-linecap: round; }
.sea-art .sea-back { fill: url(#sea); }
.sea-art .waves-far path { fill: none; stroke: #c3d3ec; stroke-width: 1; }
.sea-art .waves-near path { fill: none; stroke: #b3c7e6; stroke-width: 1.4; }
.sea-art .sea-front path { fill: url(#sea); opacity: .82; }
.sea-art .wind path { fill: none; stroke: url(#wind-fade); stroke-width: 1.6; stroke-linecap: round; stroke-dasharray: 90 160; }
.sea-art .wind { opacity: 0; transition: opacity 1.2s var(--ease); }
.sea-art .mast { stroke: var(--ink); stroke-width: 3.2; stroke-linecap: round; }
.sea-art .boom { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.sea-art .stay { stroke: #8fa6cc; stroke-width: .9; }
.sea-art .sail { stroke: var(--blue); stroke-width: 1.5; stroke-linejoin: round; }
.sea-art .main { fill: url(#main-fill); }
.sea-art .jib { fill: url(#jib-fill); }
.sea-art .hull { fill: var(--blue); }
.sea-art .cabin { fill: var(--deep); }
.sea-art .boot { fill: none; stroke: rgb(255 255 255 / .7); stroke-width: 2; stroke-linecap: round; }
.sea-art .keel, .sea-art .rudder { fill: var(--deep); }
.sea-art .pennant { fill: var(--blue); }
.sea-art .wake path { stroke: #fff; stroke-width: 2; stroke-linecap: round; opacity: .9; }
.sea-art .spray circle { fill: #fff; }
.sea-art .spray { opacity: 0; }
.sea-art .boat { animation: bob 5s ease-in-out infinite; }
.voyage[data-level="1"] .wind { opacity: .45; }
.voyage[data-level="2"] .wind { opacity: .75; }
.voyage[data-level="3"] .wind { opacity: 1; }
.readout { display: grid; grid-template-columns: auto 1fr; column-gap: 18px; align-items: baseline; padding: 20px 26px 24px; background: var(--white); border-top: 1px solid var(--line); }
.readout-count { grid-row: span 3; font: 600 .7rem/1.4 var(--display); letter-spacing: .13em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.readout-state { color: var(--ink); font: 600 1.35rem/1.2 var(--display); letter-spacing: -.035em; }
.readout-note { font-size: .98rem; line-height: 1.5; }
.log { display: flex; gap: 6px; margin-top: 12px; }
.log i { width: 14px; height: 14px; border: 1.5px solid var(--line); }
.log i.toward { background: var(--blue); border-color: var(--blue); }
.log i.away { border-color: var(--blue); background: repeating-linear-gradient(135deg, transparent 0 3px, var(--blue-soft) 3px 4.5px); }

.choice { padding: 30px; border-radius: var(--radius); background: var(--pale); }
.choice-step { font: 600 .7rem/1.4 var(--display); letter-spacing: .13em; text-transform: uppercase; color: var(--muted); }
.choice-scene { margin-top: 14px; min-height: 2.5em; color: var(--ink); font: 600 clamp(1.3rem, 1.8vw, 1.55rem)/1.25 var(--display); letter-spacing: -.035em; }
.choice-options { display: grid; gap: 10px; margin-top: 24px; }
.option {
  appearance: none; cursor: pointer; text-align: left;
  display: grid; gap: 5px; padding: 17px 20px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--white);
  color: var(--ink); font: inherit;
  transition: border-color .2s, box-shadow .2s, transform .2s var(--ease);
}
.option:hover { border-color: var(--blue); box-shadow: 0 10px 24px -18px rgb(14 32 68 / .5); transform: translateY(-1px); }
.option-way { font: 600 .66rem/1.4 var(--display); letter-spacing: .13em; text-transform: uppercase; color: var(--blue); }
.option[data-way="away"] .option-way { color: var(--muted); }
.option-text { font-size: 1.05rem; line-height: 1.35; }
.choice-after { margin-top: 16px; font-size: .98rem; color: var(--blue); }
.choice-summary { color: var(--ink); font: 600 clamp(1.35rem, 1.9vw, 1.65rem)/1.2 var(--display); letter-spacing: -.035em; }
.choice-end p + p { margin-top: 12px; }
.choice-end-actions { display: flex; flex-wrap: wrap; gap: 4px 24px; margin-top: 14px; }
.choice-after:not([hidden]), .choice-scene.swap, .choice-end:not([hidden]) { animation: arrive .45s var(--ease) both; }

/* The 3D game */
.game-stage {
  position: relative; overflow: hidden; isolation: isolate;
  height: clamp(460px, 56vw, 680px);
  border-radius: var(--radius); background: #e8eff9;
  box-shadow: inset 0 0 0 1px var(--line);
}
.game-stage:focus-visible { outline: 3px solid var(--blue-bright); outline-offset: 4px; }
.game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.game-stage > *:not(.game-canvas) { position: absolute; z-index: 1; }
.hud-top { top: 20px; left: 20px; max-width: min(460px, calc(100% - 300px)); padding: 16px 20px; border-radius: var(--radius-sm); background: rgb(255 255 255 / .86); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); opacity: 0; transform: translateY(-8px); transition: opacity .4s, transform .4s var(--ease); }
.hud-step { font: 600 .68rem/1.4 var(--display); letter-spacing: .13em; text-transform: uppercase; color: var(--muted); }
.hud-scene { margin-top: 6px; color: var(--ink); font: 600 1.2rem/1.25 var(--display); letter-spacing: -.03em; }
.hud-wind { top: 20px; right: 20px; display: grid; gap: 2px; padding: 14px 18px; border-radius: var(--radius-sm); background: rgb(255 255 255 / .86); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.hud-wind-count { font: 600 .68rem/1.4 var(--display); letter-spacing: .13em; text-transform: uppercase; color: var(--muted); }
.hud-wind-state { color: var(--ink); font: 600 1.1rem/1.2 var(--display); letter-spacing: -.03em; }
.hud-wind .log { margin-top: 8px; }
.hud-after { left: 50%; bottom: 128px; transform: translateX(-50%); padding: 10px 18px; border-radius: 999px; background: var(--ink); color: var(--white); font-size: .95rem; white-space: nowrap; opacity: 0; transition: opacity .4s; pointer-events: none; }
.hud-choices { left: 20px; right: 20px; bottom: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; opacity: 0; transform: translateY(8px); transition: opacity .4s, transform .4s var(--ease); pointer-events: none; }
.hud-choice {
  appearance: none; cursor: pointer; text-align: left;
  display: grid; gap: 3px; padding: 14px 18px;
  border: 1px solid rgb(255 255 255 / .6); border-radius: var(--radius-sm);
  background: rgb(255 255 255 / .9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: var(--ink); font: inherit;
  transition: transform .2s var(--ease), border-color .2s;
}
.hud-choice:nth-child(2) { text-align: right; }
.hud-choice:not(:disabled):hover { border-color: var(--blue); transform: translateY(-2px); }
.hud-choice-way { font: 600 .64rem/1.4 var(--display); letter-spacing: .13em; text-transform: uppercase; color: var(--muted); }
.hud-choice-text { font-size: 1rem; line-height: 1.3; }
.game-stage.has-gate .hud-top, .game-stage.has-gate .hud-choices { opacity: 1; transform: none; pointer-events: auto; }
.game-stage.show-after .hud-after { opacity: 1; }
.game-start, .game-end { inset: 0; display: grid; place-items: center; padding: 20px; background: rgb(232 239 249 / .35); }
.game-card { max-width: 440px; padding: 32px; border-radius: var(--radius); background: rgb(255 255 255 / .94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 30px 60px -30px rgb(14 32 68 / .45); }
.game-card h3 { font-size: 2.4rem; }
.game-card h3 + p { margin-top: 12px; }
.game-card .button { margin-top: 22px; }
.game-keys { margin-top: 14px; font-size: .88rem; color: var(--muted); }
.game-summary { color: var(--ink); font: 600 1.5rem/1.2 var(--display); letter-spacing: -.035em; }
.game-end-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin-top: 20px; }
.game-end-actions .button { margin-top: 0; }
.game-end { place-items: center start; padding-left: 40px; background: linear-gradient(90deg, rgb(232 239 249 / .55), transparent 60%); }
.game-stage:not(.is-ready) .game-start .button { opacity: .5; pointer-events: none; }

@media (max-width: 700px) {
  .game-stage { height: 620px; margin-inline: -20px; border-radius: 0; box-shadow: none; }
  .hud-top { top: 12px; left: 12px; right: 12px; max-width: none; padding: 12px 14px; grid-template-columns: 56px 1fr; gap: 12px; }
  .hud-img { width: 56px; height: 56px; }
  .value-chip figcaption { font-size: .5rem; letter-spacing: .04em; }
  .hud-scene { font-size: 1.02rem; }
  .hud-wind { top: auto; right: 12px; bottom: 150px; padding: 10px 12px; }
  .hud-wind .log { display: none; }
  .hud-choices { left: 12px; right: 12px; bottom: 12px; grid-template-columns: 1fr; gap: 8px; }
  .hud-choice:nth-child(2) { text-align: left; }
  .hud-choice { padding: 11px 14px; }
  .hud-after { bottom: auto; top: 118px; white-space: normal; width: max-content; max-width: calc(100% - 24px); text-align: center; }
  .game-card { padding: 24px; }
  .game-end { place-items: end center; padding: 12px; background: none; }
  .game-card h3 { font-size: 2rem; }
}

.end-cta { margin-top: 18px; color: var(--ink); font: 600 1.15rem/1.3 var(--display); letter-spacing: -.03em; }
.choice-end-actions { align-items: center; }

/* Values pictures */
.hud-top { display: grid; grid-template-columns: 76px 1fr; gap: 16px; align-items: center; }
.hud-img, .choice-img { display: block; width: 76px; height: 76px; border-radius: 12px; object-fit: cover; }
.hud-value, .choice-value { color: var(--blue); }
.choice-head { display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: center; }
.choice-img { width: 64px; height: 64px; }
.value-strip { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 18px 0 20px; }
.value-chip { margin: 0; }
.value-chip img { display: block; width: 100%; height: auto; aspect-ratio: 1; border-radius: 10px; object-fit: cover; filter: grayscale(1) opacity(.35); transition: filter .6s var(--ease); }
.value-chip.is-on img { filter: none; }
.value-chip figcaption { margin-top: 6px; font: 600 .6rem/1.2 var(--display); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); text-align: center; }
.value-chip.is-on figcaption { color: var(--blue); }
.game-card:has(.value-strip) { max-width: 480px; }

@media (max-width: 1000px) {
  .voyage { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .readout { grid-template-columns: 1fr; padding: 18px 20px 20px; }
  .readout-count { grid-row: auto; margin-bottom: 4px; }
  .choice { padding: 24px 20px; }
}

/* The 3D scene is always a daylight sea, so its cards keep the light-theme colors in dark mode. */
.game-stage { --ink: #0f2135; --text: #3a4f66; --muted: #64788f; --line: #d6e1ec; --white: #fff; color: var(--text); }
@media (prefers-color-scheme: dark) { .game-stage .tag, .game-stage a:not(.button), .game-stage .text-link { color: var(--blue); } }
