/* Idle Villagers: make an island. The tokens are the game's own (v3/index.html :root), as listed in
   castle/design/DESIGN.md. Cards, pills, inputs and type follow the game's join card. */
:root {
  --paper: #f6f2e9; --paper-2: #fcfaf5; --ink: #3a3128; --ink-2: #7d6e5e; --rule: #ddd2bf; --sel: #3a3128; --accent: #b4643f; --ok: #5f8a4a; --bad: #a8474f;
  --card: rgba(252,250,245,.9); --card-2: rgba(252,250,245,.95); --wash: rgba(58,49,40,.07); --line: rgba(221,210,191,.6); --shade: rgba(70,55,35,.10);
  --bg: linear-gradient(180deg, #d9e5ea 0%, #e9ebe4 46%, #ece4d5 100%);
  --serif: 'Grenze', Georgia, serif; --sans: 'Alegreya Sans', system-ui, sans-serif;
  --halo: 0 0 6px #f6f2e9, 0 0 12px #f6f2e9, 0 0 28px rgba(246,242,233,.85);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body { color: var(--ink); font: 15px/1.4 var(--sans); background: var(--bg); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* the village, turning slowly behind everything */
.stage { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: var(--bg); }
/* pushed down so the page's own sky rises above the village, with the video's top faded into it */
.stage video { position: absolute; left: 0; top: var(--drop, 17vh); width: 100%; height: calc(100% - var(--drop, 17vh) * .35); object-fit: cover; object-position: 50% 0%; display: block;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 24%); mask-image: linear-gradient(180deg, transparent 0%, #000 24%); }
@media (max-aspect-ratio: 4/5) { .stage video { --drop: 13vh; } }
.scrim { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(217,229,234,.55) 0%, rgba(233,235,228,0) 34%, rgba(236,228,213,0) 78%, rgba(236,228,213,.35) 100%); transition: background .5s ease; }
body.open .scrim { background: rgba(246,242,233,.42); }

main { position: relative; z-index: 1; min-height: 100svh; display: grid; place-items: center; padding: 72px 16px 40px; }

/* ---------- splash ---------- */
.splash { align-self: start; margin-top: clamp(24px, 7vh, 96px); display: grid; justify-items: center; gap: 26px; text-align: center; }
.splash h1 { margin: 0; font: 600 clamp(54px, 9.5vw, 116px)/.95 var(--serif); letter-spacing: -.015em; text-shadow: var(--halo); }
.splash .btn { font-size: 15px; padding: 13px 24px; box-shadow: 0 10px 28px rgba(58,49,40,.22); }

/* the name, small, once the card is open */
.mark { position: fixed; z-index: 2; top: 16px; left: 18px; display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); font: 600 19px/1 var(--serif); text-shadow: var(--halo); }
.mark img { width: 26px; height: 26px; border-radius: 7px; box-shadow: 0 2px 6px rgba(58,49,40,.18); }

/* ---------- buttons ---------- */
.btn { all: unset; box-sizing: border-box; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border-radius: 999px; background: var(--sel); color: var(--paper-2); font: 500 15.5px/1.1 var(--sans); white-space: nowrap; transition: transform .12s ease, opacity .12s ease; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: default; transform: none; }
.btn.small { padding: 7px 14px; font-size: 14px; }
.btn.alt { background: var(--card-2); color: var(--ink); border: 1px solid var(--rule); }
.link { all: unset; cursor: pointer; font: 500 15px/1 var(--sans); color: var(--ink-2); padding: 10px 4px; }
.link:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- the card ---------- */
.card { width: min(420px, 100%); background: var(--card); border: 1px solid var(--rule); border-radius: 12px; box-shadow: 0 10px 30px var(--shade), 0 30px 70px -20px rgba(70,55,35,.28); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); padding: 20px 22px 18px; animation: up .35s cubic-bezier(.2,.7,.2,1); }
@keyframes up { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) { .card { animation: none; } .btn { transition: none; } }
.card h2 { margin: 0 0 14px; font: 600 28px/1.1 var(--serif); outline: none; overflow-wrap: anywhere; }
.pips { list-style: none; display: flex; gap: 6px; margin: 0 0 14px; padding: 0; }
.pips li { width: 9px; height: 10px; background: var(--rule); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.pips li.on { background: var(--ink); }
.pips li.done { background: var(--ink-2); }
.acts { display: flex; justify-content: flex-end; align-items: center; gap: 14px; margin-top: 18px; }
.err { margin: 8px 0 0; color: var(--bad); font-size: 14px; }

input[type="text"], .field input { width: 100%; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper-2); padding: 11px 12px; font: 400 16px/1.2 var(--sans); outline: none; }
input[type="text"]:focus, .field input:focus { border-color: var(--ink-2); box-shadow: 0 0 0 3px var(--wash); }

/* step 2: the island at this size, the slider and the quote */
.isle { display: block; width: 100%; height: auto; border-radius: 10px; background: radial-gradient(circle at 50% 46%, #8fbfc4 0%, #b7d3cf 52%, #dfe6df 100%); }
.isle .t { transition: opacity .18s ease, transform .18s ease; transform-box: fill-box; transform-origin: center; }
.isle .t.off { opacity: 0; transform: scale(.6); }
@media (prefers-reduced-motion: reduce) { .isle .t { transition: none; } }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; margin: 14px 0 6px; background: transparent; cursor: pointer; --p: 50%; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--ink) var(--p), var(--rule) var(--p)); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--rule); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--ink); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%; background: var(--paper-2); border: 1.5px solid var(--ink); box-shadow: 0 2px 6px rgba(58,49,40,.2); }
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--paper-2); border: 1.5px solid var(--ink); }

.quote { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 14px; align-items: baseline; }
.quote b { grid-row: span 2; font: 600 34px/1 var(--serif); font-variant-numeric: tabular-nums; }
.quote span { font-size: 15.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.quote span#qPrice { color: var(--ink); font-weight: 500; }
.quote.pending span { opacity: .4; }

/* step 3: starting, then the links */
.state { display: flex; align-items: center; gap: 10px; margin: 2px 0 4px; font: italic 400 19px/1.3 var(--serif); color: var(--ink); }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--rule); border-top-color: var(--ink); animation: spin .9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2.4s; } }
.row { margin-top: 12px; }
.row label { display: block; font-size: 14px; color: var(--ink-2); margin-bottom: 5px; }
.field { display: flex; gap: 8px; align-items: center; }
.field input { font-size: 15px; padding: 8px 10px; color: var(--ink); text-overflow: ellipsis; }
.note { margin: 6px 0 0; font-size: 14px; color: var(--ink-2); }
.ends { margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14.5px; color: var(--ink); }

/* a local stand-in for the island server: only on localhost, and it says so */
.mockTag { position: fixed; z-index: 3; right: 12px; bottom: 12px; font: 500 11px/1 var(--sans); padding: 6px 9px; border-radius: 999px; background: var(--card-2); border: 1px dashed var(--ink-2); color: var(--ink-2); }

@media (max-width: 520px) {
  main { padding: 64px 12px 24px; }
  .card { padding: 18px 16px 16px; }
  #flow { align-self: start; margin-top: 6vh; }   /* above where a phone's keyboard comes up */
  .card h2 { font-size: 25px; }
}

/* music, as the game's music button: off until pressed, then the village's calm tracks in turn */
.tune { all: unset; position: fixed; z-index: 3; top: 14px; right: 16px; width: 38px; height: 38px; border-radius: 999px; display: grid; place-items: center; cursor: pointer; background: var(--card-2); border: 1px solid var(--rule); box-shadow: 0 6px 18px var(--shade); }
.tune svg { width: 18px; height: 18px; stroke: var(--ink); fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.tune:hover { background: var(--paper-2); }
.tune:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tune[aria-pressed="true"] { background: var(--sel); border-color: var(--sel); }
.tune[aria-pressed="true"] svg { stroke: var(--paper-2); }
.tune[aria-pressed="true"] .x { display: none; }
.tune .x { stroke: var(--ink-2); }

/* step 1's email, and paying inside the card */
.lab { display: block; margin: 16px 0 6px; font-size: 14px; color: var(--ink-2); }
.card.paying { width: min(500px, 100%); }
#checkout { min-height: 360px; margin: 4px -6px 0; }

/* ---------- 17 Nov: the game's cut letters, carved tablets, two ways in, and the size in stones ---------- */
[data-cut] svg, .splash h1 svg { display: block; overflow: visible; }
.splash h1 { font-size: 0; filter: drop-shadow(0 0 10px rgba(246,242,233,.95)) drop-shadow(0 0 22px rgba(246,242,233,.7)); }
.splash h1 svg { width: min(92vw, 640px); height: auto; margin: 0 auto; }
.mark { font-size: 0; }
.mark svg { height: 26px; width: auto; filter: drop-shadow(0 0 6px #f6f2e9); }

/* two ways in: a carved tablet over a cut word, on a card of the game's paper */
.choose { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.pick { all: unset; box-sizing: border-box; cursor: pointer; width: 196px; display: grid; justify-items: center; gap: 10px; padding: 18px 16px 16px;
  background: var(--card); border: 1px solid var(--rule); border-radius: 14px; box-shadow: 0 10px 30px var(--shade), 0 22px 50px -24px rgba(70,55,35,.35);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: var(--ink); transition: transform .14s ease, box-shadow .14s ease; }
.pick:hover { transform: translateY(-2px); box-shadow: 0 14px 34px var(--shade), 0 26px 56px -22px rgba(70,55,35,.4); }
.pick:active { transform: translateY(0); }
.pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.pick > svg.relief { width: 76px; height: 76px; }
.pick .lbl { font-size: 0; }
.pick .lbl svg { height: 30px; width: auto; }
@media (max-width: 520px) { .choose { gap: 10px; } .pick { width: calc(50vw - 22px); padding: 14px 10px 12px; } .pick > svg.relief { width: 60px; height: 60px; } .pick .lbl svg { height: 24px; } }
@media (prefers-reduced-motion: reduce) { .pick { transition: none; } }

/* the card's head: its tablet beside its cut title */
.card .head { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; }
.card .head .tab { flex: none; width: 46px; height: 46px; }
.card .head .tab svg { width: 46px; height: 46px; display: block; }
.card .head h2 { margin: 0; font-size: 28px; }
.card .head h2 svg { height: 31px; width: auto; max-width: 100%; }
.card { width: min(440px, 100%); }

/* fields at full size, the email as big as the name */
input.big { width: 100%; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper-2); padding: 12px 13px; font: 400 17px/1.2 var(--sans); outline: none; color: var(--ink); }
input.big:focus { border-color: var(--ink-2); box-shadow: 0 0 0 3px var(--wash); }
.field input.big { font-size: 15px; padding: 10px 11px; }
.lab { font-size: 15px; }

/* the size, as a course of stones rising left to right: green ones are free, a gap where the price steps */
.blocks { display: flex; align-items: flex-end; gap: 3px; height: 62px; margin: 14px 0 8px; padding: 0 1px; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; outline: none; border-radius: 6px; }
.blocks:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.blocks i { flex: 1; height: var(--h); border-radius: 3px 3px 2px 2px; background: var(--paper-2); border: 1px solid var(--rule); transition: background .1s ease, border-color .1s ease; }
.blocks i.step { margin-left: 5px; }
.blocks i.on { background: #d7c19b; border-color: #a8916c; box-shadow: inset 0 2px 0 rgba(255,250,240,.45), inset 0 -2px 0 rgba(58,42,28,.18); }
.blocks i.free { background: #e4ead6; border-color: #b5c39a; }
.blocks i.free.on { background: #a8bf7f; border-color: #6f8a4f; }
.quote span#qPrice.free { color: var(--ok); }
.marks { position: relative; height: 16px; margin: -2px 0 10px; font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.marks span { position: absolute; top: 0; white-space: nowrap; }
.marks span.free { color: var(--ok); font-weight: 500; }

/* ---------- 17 Nov, second pass: parchment, not white; an even stone track ---------- */
:root { --parch: rgba(241,230,206,.72); --parch-2: rgba(244,235,214,.82); --parch-rule: rgba(168,140,98,.42); }
.card, .pick {
  background:
    radial-gradient(120% 90% at 20% 0%, rgba(255,250,236,.35), transparent 60%),
    radial-gradient(90% 80% at 100% 100%, rgba(176,140,90,.12), transparent 65%),
    var(--parch);
  border-color: var(--parch-rule);
  backdrop-filter: blur(6px) saturate(1.05); -webkit-backdrop-filter: blur(6px) saturate(1.05);
}
.pick:hover { background-color: transparent; }
input.big { background: rgba(252,247,234,.86); border-color: var(--parch-rule); }
.isle { box-shadow: inset 0 0 0 1px var(--parch-rule); }
.btn.alt { background: rgba(252,247,234,.8); border-color: var(--parch-rule); }

/* the size: one even course of stones in a sunk channel, filled to the size picked, with a carved knob */
.blocks { position: relative; height: 30px; gap: 2px; padding: 4px; align-items: stretch; margin: 16px 0 12px;
  background: rgba(120,92,58,.16); border-radius: 8px; box-shadow: inset 0 2px 3px rgba(58,42,28,.28), inset 0 -1px 0 rgba(255,250,236,.5); }
.blocks i { height: auto; border: 0; border-radius: 3px; margin: 0 !important;
  background: rgba(235,224,200,.55); box-shadow: inset 0 -1px 0 rgba(58,42,28,.1); }
.blocks i.on {
  background:
    radial-gradient(3px 2px at 30% 35%, rgba(255,250,236,.55), transparent),
    radial-gradient(4px 3px at 70% 70%, rgba(90,66,40,.18), transparent),
    linear-gradient(180deg, #e2cfa8, #cdb487);
  box-shadow: inset 0 1px 0 rgba(255,250,236,.6), inset 0 -2px 0 rgba(90,66,40,.25); }
.blocks i.free { background: rgba(200,214,170,.6); }
.blocks i.free.on { background: linear-gradient(180deg, #b9cc92, #9bb273); box-shadow: inset 0 1px 0 rgba(255,250,236,.5), inset 0 -2px 0 rgba(60,80,40,.3); }
.blocks i.on + i:not(.on) { position: relative; }
.blocks i.last { position: relative; }
.blocks i.last::after { content: ''; position: absolute; right: -9px; top: 50%; width: 22px; height: 22px; margin-top: -11px; border-radius: 50%; z-index: 2;
  background: radial-gradient(circle at 38% 32%, #f6ecd4, #d2bb8f 60%, #a8916c); box-shadow: 0 2px 5px rgba(58,42,28,.35), inset 0 -2px 2px rgba(58,42,28,.25), inset 0 1px 1px rgba(255,250,236,.8); }
.marks { display: none; }
.pick { width: auto; min-width: 196px; padding: 18px 26px 16px; }
.pick .lbl svg { height: 27px; }
@media (max-width: 520px) { .pick { min-width: 0; width: calc(50vw - 22px); padding: 14px 8px 12px; } .pick .lbl svg { height: auto; width: 100%; max-height: 22px; } }
/* the third way in, quieter than the two tiles: for someone bidden to an island already */
.joinIsle { all: unset; cursor: pointer; margin-top: 4px; padding: 9px 18px; border-radius: 999px; font: 400 15.5px/1.2 var(--sans); color: var(--ink);
  background: rgba(241,230,206,.62); border: 1px solid rgba(168,140,98,.42); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); box-shadow: 0 6px 18px rgba(70,55,35,.10); }
.joinIsle b { font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.joinIsle:hover { background: rgba(244,235,214,.82); }
.joinIsle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
