/* Hop & Hollow: Chinese Checkers on a moonlit pond. */
:root {
  --deep: #0F3336;
  --water: #164447;
  --water-2: #1D5A5C;
  --pad: #6FA65A;
  --pad-dark: #3F7440;
  --mist: #E3EFE4;
  --mist-2: #CFE2D2;
  --ink: #12302F;
  --ink-soft: #3E5F5C;
  --firefly: #F6E27F;
  --lotus: #F28CA6;
  --lotus-dark: #C55A78;
  --display: 'Grandstander', 'Trebuchet MS', system-ui, sans-serif;
  --body: 'Atkinson Hyperlegible', system-ui, -apple-system, sans-serif;
  --frog: 6.3%; /* frog width as a share of the pond box */
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.hop {
  margin: 0; min-height: 100dvh; color: var(--mist); font-family: var(--body); font-size: 16px;
  background: radial-gradient(120% 80% at 50% -10%, #23686A 0%, var(--water) 45%, var(--deep) 100%) fixed, var(--deep);
}
button, input { font: inherit; }
a { color: var(--firefly); }
:focus-visible { outline: 3px solid var(--firefly); outline-offset: 2px; }
.moon { position: fixed; top: -90px; right: -60px; width: 260px; height: 260px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(246, 236, 190, .5) 0%, rgba(246, 236, 190, .12) 45%, transparent 70%); }

/* type */
.hh-logo { font-family: var(--display); font-weight: 900; letter-spacing: -.01em; line-height: .9; display: inline-flex; align-items: baseline; gap: .12em; color: var(--mist); text-decoration: none; font-size: 1.5rem; }
.hh-logo .w1 { color: var(--firefly); display: inline-block; transform: translateY(-.12em) rotate(-6deg); }
.hh-logo .amp { font-weight: 600; font-size: .7em; color: var(--lotus); }
.hh-logo .w2 { color: var(--mist); }
.hh-logo.big { font-size: clamp(3.2rem, 11vw, 6.2rem); }
a:has(> .hh-logo) { text-decoration: none; }

/* buttons */
.btn { appearance: none; border: 2px solid var(--ink); background: var(--mist); color: var(--ink); border-radius: 999px; padding: 10px 20px; font-weight: 700; cursor: pointer;
  box-shadow: 0 3px 0 var(--ink); transition: transform .08s, box-shadow .08s; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 0 var(--ink); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.btn.primary { background: var(--lotus); }
.btn.big { padding: 14px 28px; font-size: 1.1rem; }
.btn.small { padding: 6px 14px; font-size: .9rem; box-shadow: 0 2px 0 var(--ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.icon { appearance: none; background: rgba(227, 239, 228, .1); color: var(--mist); border: 1px solid rgba(227, 239, 228, .3); border-radius: 999px; padding: 5px 12px; cursor: pointer; font-size: .85rem; }
.icon:hover { background: rgba(227, 239, 228, .2); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { appearance: none; border: 2px solid var(--ink); background: transparent; color: var(--ink); border-radius: 999px; padding: 6px 16px; cursor: pointer; font-weight: 700; }
.chip.on { background: var(--ink); color: var(--mist); }
.mini { appearance: none; border: 1px solid currentColor; background: transparent; color: inherit; border-radius: 999px; padding: 2px 10px; font-size: .8rem; cursor: pointer; }
.x { appearance: none; border: none; background: none; color: var(--ink-soft); font-size: 1.1rem; cursor: pointer; padding: 6px; margin-left: auto; }

/* panels: pale mist on the dark water */
.mist { background: var(--mist); color: var(--ink); border-radius: 26px; box-shadow: 0 18px 40px rgba(4, 20, 22, .45), inset 0 0 0 2px rgba(255, 255, 255, .6); }
.mist h2 { font-family: var(--display); font-weight: 800; margin: 0 0 6px; font-size: 1.35rem; }
.mist a { color: var(--lotus-dark); }

/* home */
.hh-home { width: min(940px, calc(100% - 32px)); margin: 0 auto; padding: 18px 0 40px; position: relative; z-index: 1; }
.back { color: var(--mist); opacity: .8; text-decoration: none; font-size: .95rem; }
.back:hover { opacity: 1; text-decoration: underline; }
.home-hero { text-align: center; padding: 18px 0 26px; }
.home-hero h1 { margin: 6px 0 12px; }
.hero-frogs { display: flex; justify-content: center; gap: 4px; height: 76px; }
.hf { width: 64px; display: block; animation: bob 2.8s ease-in-out infinite; }
.hf.f1 { animation-delay: -.7s; } .hf.f2 { animation-delay: -1.4s; } .hf.f3 { animation-delay: -2.1s; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-12px) scale(1.04); } 55% { transform: translateY(0) scale(1.06, .94); } }
.lede { font-size: 1.15rem; line-height: 1.5; max-width: 52ch; margin: 0 auto; color: var(--mist); }
.home-card { padding: clamp(18px, 4vw, 30px); }
.field { display: grid; gap: 4px; max-width: 320px; margin-bottom: 18px; font-weight: 700; }
.field input, .join input, .invite input { border: 2px solid var(--ink); border-radius: 12px; padding: 10px 12px; background: #fff; color: var(--ink); min-width: 0; }
.choices { display: grid; grid-template-columns: 1.25fr 1fr; gap: 18px; }
.choice { background: var(--mist-2); border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.choice p { margin: 0; line-height: 1.45; }
.sub { font-weight: 700; color: var(--ink-soft); font-size: .92rem; }
.blurb { color: var(--ink-soft); min-height: 2.9em; }
.join { display: flex; gap: 8px; margin-top: auto; width: 100%; }
.join input { width: 7.5em; text-transform: uppercase; letter-spacing: .12em; }
.records { margin: 16px 0 0; color: var(--ink-soft); }
.form-error { background: #FFE1E6; border: 2px solid var(--lotus-dark); color: #6E1E33; border-radius: 12px; padding: 8px 12px; }
.sizes { display: flex; gap: 8px; flex-wrap: wrap; }
.size { appearance: none; border: 2px solid var(--ink); background: transparent; color: var(--ink); border-radius: 16px; padding: 6px 10px 6px 6px; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; font-family: var(--display); font-weight: 800; font-size: 1.2rem; }
.size .mini-star { width: 34px; height: 34px; color: var(--ink); }
.size.on { background: var(--ink); color: var(--mist); }
.size.on .mini-star { color: var(--mist); }

/* lobby */
.hh-lobby { width: min(620px, calc(100% - 32px)); margin: 0 auto; padding: 18px 0 40px; position: relative; z-index: 1; }
.lobby-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.lobby-card { padding: clamp(18px, 4vw, 28px); display: grid; gap: 12px; }
.lobby-card h1 { font-family: var(--display); font-weight: 900; margin: 0; font-size: 2rem; }
.lobby-card p { margin: 0; }
.code { font-family: var(--display); letter-spacing: .08em; }
.invite { display: flex; gap: 8px; } .invite input { flex: 1; }
.seats { list-style: none; padding: 0; margin: 4px 0; display: grid; gap: 8px; }
.seat { display: flex; align-items: center; gap: 12px; background: var(--mist-2); border-radius: 16px; padding: 8px 12px; }
.seat.empty { background: transparent; border: 2px dashed rgba(18, 48, 47, .35); }
.seat-frog { width: 44px; flex: none; }
.seat .who { color: var(--ink-soft); font-size: .92rem; }
.seat .btn { margin-left: auto; }
.lobby-row { display: flex; gap: 8px; flex-wrap: wrap; }
.note { color: var(--ink-soft); font-size: .95rem; }
.loading { min-height: 100dvh; display: grid; place-items: center; font-family: var(--display); font-size: 1.5rem; color: var(--firefly); }

/* game */
.hh-game { min-height: 100dvh; display: flex; flex-direction: column; position: relative; z-index: 1; }
.hh-top { display: flex; align-items: center; gap: 14px; padding: 10px 16px; }
.top-logo .hh-logo { font-size: 1.35rem; }
.status { flex: 1; text-align: center; font-size: 1.05rem; min-height: 1.6em; }
.status b { font-family: var(--display); font-weight: 800; font-size: 1.15em; }
.status span { color: rgba(227, 239, 228, .8); }
.my-turn .status b { color: var(--firefly); }
.meta { display: flex; gap: 6px; align-items: center; }
.meta .code { font-size: .9rem; opacity: .7; margin-right: 4px; }
.hh-main { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 16px; padding: 0 16px 16px; align-items: start; align-content: start; }
.pond-wrap { position: relative; display: grid; place-items: center; }
.pond { position: relative; width: min(100%, calc(100dvh - 90px)); aspect-ratio: 1; touch-action: manipulation; }
.pond-svg, .layer { position: absolute; inset: 0; width: 100%; height: 100%; }
.layer { pointer-events: none; }
.layer > * { pointer-events: auto; }
.layer.trail, .layer.fx, .layer.fx > * { pointer-events: none; }
.shallows-glow { fill: #4FA493; opacity: .35; transform: scale(1.03); }
.shallows { stroke: rgba(227, 239, 228, .14); stroke-width: .06; }
.bank { opacity: .2; }
.pad .leaf { fill: var(--pad); stroke: var(--pad-dark); stroke-width: .045; }
.pad .vein { stroke: var(--pad-dark); stroke-width: .03; opacity: .7; }
.pad.banked .leaf { stroke: var(--rim); stroke-width: .07; }

.frog { position: absolute; width: var(--frog); aspect-ratio: 1; translate: 0 0; transform: translate(-50%, -50%); padding: 0; border: none; background: none; cursor: default; z-index: 10; -webkit-tap-highlight-color: transparent; }
.frog-body { display: block; width: 100%; height: 100%; transition: filter .2s, transform .2s; }
.frog-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.frog-shadow { fill: rgba(5, 25, 24, .35); }
.frog.leaping { z-index: 40; }
.frog.movable { cursor: pointer; }
.frog.movable .frog-body { filter: drop-shadow(0 0 3px rgba(246, 226, 127, .95)); }
.frog.movable:hover .frog-body { transform: translateY(-6%) scale(1.06); }
.frog.selected { z-index: 30; }
.frog.selected .frog-body { transform: translateY(-10%) scale(1.14); filter: drop-shadow(0 0 6px rgba(246, 226, 127, 1)); animation: perk .9s ease-in-out infinite; }
@keyframes perk { 50% { transform: translateY(-16%) scale(1.14); } }
.target { position: absolute; width: calc(var(--frog) * .8); aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; border: 2px solid var(--firefly);
  background: radial-gradient(circle, rgba(246, 226, 127, .45), rgba(246, 226, 127, .08) 65%); cursor: pointer; padding: 0; z-index: 20; animation: glow 1.4s ease-in-out infinite; }
.target.chain { border-width: 3px; }
.target.far { border-color: #fff; }
.target em { font-style: normal; font-family: var(--display); font-weight: 900; color: var(--ink); font-size: clamp(.6rem, 1.3vw, .95rem); display: grid; place-items: center; width: 100%; height: 100%;
  background: var(--firefly); border-radius: 50%; transform: scale(.62); }
.target:hover { background: rgba(246, 226, 127, .7); }
@keyframes glow { 50% { box-shadow: 0 0 12px 2px rgba(246, 226, 127, .6); } }
.trail path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.trail .last { stroke: var(--c); stroke-width: .09; stroke-dasharray: .12 .2; opacity: .75; }
.trail .preview { stroke: var(--firefly); stroke-width: .12; stroke-dasharray: .2 .16; animation: march 1s linear infinite; }
@keyframes march { to { stroke-dashoffset: -.72; } }
.ripple { position: absolute; width: calc(var(--frog) * 1.2); aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; border: 2px solid rgba(227, 239, 228, .8); animation: ripple 1s ease-out forwards; }
.ripple.big { border-color: var(--firefly); border-width: 3px; }
.ripple.home { border-color: #fff; border-width: 3px; animation-duration: 1.2s; }
@keyframes ripple { from { opacity: .9; scale: .5; } to { opacity: 0; scale: 2.4; } }
.badge { position: absolute; transform: translate(-50%, -160%); font-family: var(--display); font-weight: 900; color: var(--ink); background: var(--firefly); border-radius: 999px; padding: 2px 10px; white-space: nowrap; font-size: clamp(.8rem, 1.6vw, 1.1rem); z-index: 50; animation: pop 1.4s ease-out forwards; box-shadow: 0 4px 10px rgba(0, 0, 0, .3); }
.badge.hot { background: var(--lotus); font-size: clamp(.95rem, 2vw, 1.35rem); }
@keyframes pop { 0% { opacity: 0; scale: .4; } 15% { opacity: 1; scale: 1.15; } 30% { scale: 1; } 75% { opacity: 1; } 100% { opacity: 0; translate: 0 -40%; } }
.fireflies { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.fireflies i { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--firefly); box-shadow: 0 0 10px 3px rgba(246, 226, 127, .6);
  left: calc(8% + var(--i) * 10.5%); top: calc(12% + (var(--i) * 37 % 76) * 1%); opacity: 0; animation: firefly calc(7s + var(--i) * .9s) ease-in-out infinite; animation-delay: calc(var(--i) * -1.7s); }
@keyframes firefly { 0%, 100% { opacity: 0; transform: translate(0, 0); } 30% { opacity: .9; } 50% { transform: translate(18px, -26px); opacity: .3; } 70% { opacity: .85; } 85% { transform: translate(-12px, -8px); } }

/* roster */
.roster ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.who-row { display: grid; grid-template-columns: 42px 1fr; grid-template-areas: 'frog text' 'frog home' 'act act'; column-gap: 10px; row-gap: 4px; align-items: center;
  background: rgba(227, 239, 228, .08); border: 2px solid transparent; border-radius: 16px; padding: 8px 10px; }
.who-row.turn { background: var(--mist); color: var(--ink); border-color: var(--d); }
.who-row.turn .who-sub { color: var(--ink-soft); }
.who-frog { grid-area: frog; width: 42px; }
.who-text { grid-area: text; display: flex; flex-direction: column; min-width: 0; }
.who-text b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-sub { font-size: .82rem; color: rgba(227, 239, 228, .7); }
.who-home { grid-area: home; display: flex; gap: 3px; }
.who-home i { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--d); background: transparent; }
.who-home i.on { background: var(--c); }
.who-row .mini { grid-area: act; justify-self: start; }

/* end */
.end-backdrop { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: rgba(6, 26, 28, .55); padding: 16px; }
.end-backdrop.late { animation: fadein .5s .3s both; }
@keyframes fadein { from { opacity: 0; } }
.end-card { width: min(460px, 100%); padding: 24px; text-align: center; max-height: calc(100dvh - 32px); overflow: auto; }
.end-frog { display: block; width: 84px; margin: 0 auto 4px; animation: bob 2.4s ease-in-out infinite; }
.end-card h2 { font-size: 2.1rem; font-weight: 900; margin: 0; }
.end-card > p { margin: 6px 0 12px; }
.standings { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 4px; text-align: left; }
.standings li { display: grid; grid-template-columns: 22px 30px 1fr auto; gap: 8px; align-items: center; padding: 4px 10px; border-radius: 12px; }
.standings li.me { background: var(--mist-2); }
.standings .place { font-family: var(--display); font-weight: 900; }
.standings span:last-child { color: var(--ink-soft); font-size: .9rem; }
.chain-note { color: var(--ink-soft); }
.end-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* toasts */
.toasts { position: fixed; z-index: 80; top: 64px; left: 50%; translate: -50% 0; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(520px, calc(100vw - 32px)); }
.toast { background: var(--mist); color: var(--ink); border-radius: 999px; padding: 8px 18px; box-shadow: 0 8px 20px rgba(0, 0, 0, .35); text-align: center; transition: opacity .4s, transform .4s; font-weight: 700; }
.toast.error { background: #FFE1E6; color: #6E1E33; }
.toast.good { background: var(--firefly); }
.toast.out { opacity: 0; transform: translateY(-10px); }
.conn { position: fixed; z-index: 90; bottom: 24px; left: 50%; translate: -50% 0; background: var(--lotus-dark); color: #fff; padding: 6px 16px; border-radius: 999px; }

/* about (static text) */
.about { position: relative; z-index: 1; width: min(800px, calc(100% - 32px)); margin: 10px auto 100px; padding: 26px clamp(18px, 4vw, 42px); line-height: 1.65;
  background: rgba(10, 38, 40, .55); border-radius: 26px; border: 1px solid rgba(227, 239, 228, .15); }
.about h2 { font-family: var(--display); font-weight: 800; font-size: 1.45rem; margin: 1.2em 0 .4em; color: var(--firefly); } .about h2:first-child { margin-top: 0; }
.about p, .about li, .about dd { max-width: 68ch; }
.about strong, .about dt { color: #fff; }
.about dt { font-weight: 700; margin-top: .8em; } .about dd { margin: .2em 0 0; }
.about[hidden] { display: none; }

@media (max-width: 900px) {
  .hh-main { grid-template-columns: 1fr; padding: 0 8px 16px; gap: 10px; }
  .pond { width: min(100%, calc(100dvh - 210px)); min-width: min(100%, 340px); }
  .roster ol { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
  .who-row { grid-template-columns: 30px 1fr; padding: 6px 8px; }
  .who-frog { width: 30px; }
  .who-home i { width: 7px; height: 7px; }
  .hh-top { flex-wrap: wrap; padding: 8px 12px; gap: 6px 10px; }
  .status { order: 3; flex-basis: 100%; }
  .meta { margin-left: auto; }
  .meta .code { display: none; }
}
@media (max-width: 700px) {
  .choices { grid-template-columns: 1fr; }
  .hf { width: 52px; }
  .hero-frogs { height: 62px; }
}
@media (pointer: coarse) {
  .target { width: var(--frog); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .fireflies { display: none; }
}
