/* Frogger 2 Online - shared styles for the browser pages */
:root {
  --bg: #0d1a12; --panel: #14281c; --panel-2: #1b3626; --line: #2c4f39;
  --text: #e8f3ea; --muted: #9db8a5; --accent: #ffd23f; --accent-ink: #2a1f00;
  --good: #57d68d; --bad: #ff7b6b;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button { font: inherit; cursor: pointer; border: 0; border-radius: 8px; padding: .55em 1.1em; background: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
button:disabled { opacity: .5; cursor: default; }
input, select { font: inherit; padding: .5em .7em; border-radius: 8px; border: 1px solid var(--line); background: #0a140e; color: var(--text); }
.small { font-size: .85rem; color: var(--muted); }

/* play page: the game canvas fills the window, keeping the shape of the game's resolution (--ar, set by play.js) */
body.play { background: #000; overflow: hidden; }
/* The picture fits inside what is actually visible: on phones 100vh is the height with the
   browser's toolbars hidden, so a landscape picture sized by it was cut off at the bottom.
   The stage is the visible window minus notches / rounded corners (safe areas); the canvas
   is sized from the stage itself (container units), with dvh / vh for older browsers. */
#stage { position: fixed; inset: 0; display: grid; place-items: center; box-sizing: border-box;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
#canvas { width: min(100vw, calc(100vh * var(--ar, 1.3333))); height: min(100vh, calc(100vw / var(--ar, 1.3333))); display: block; outline: none; image-rendering: auto; background: #000; }
@supports (height: 100dvh) {
  #canvas { width: min(100dvw, calc(100dvh * var(--ar, 1.3333))); height: min(100dvh, calc(100dvw / var(--ar, 1.3333))); }
}
@supports (width: 1cqw) {
  #stage { container-type: size; }
  #canvas { width: min(100cqw, calc(100cqh * var(--ar, 1.3333))); height: min(100cqh, calc(100cqw / var(--ar, 1.3333))); }
}
.overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: safe center; gap: 1rem; overflow-y: auto; touch-action: pan-y; background: radial-gradient(ellipse at center, #1d3a26 0%, #050a07 70%); text-align: center; padding: 1rem; }
.overlay[hidden] { display: none; }
.overlay h1 { margin: 0; font-size: clamp(2rem, 6vw, 3.4rem); color: var(--accent); letter-spacing: .02em; }
.overlay h1 span { color: var(--good); }
.overlay progress { width: min(420px, 80vw); height: 14px; accent-color: var(--good); }
.overlay #start { font-size: 1.3rem; padding: .7em 2.4em; }

/* hub page */
body.hub { background: linear-gradient(180deg, #10251a 0%, var(--bg) 320px); }
.top { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.5rem; border-bottom: 1px solid var(--line); }
.top h1 { margin: 0; font-size: 1.5rem; color: var(--accent); }
.top h1 span { color: var(--good); }
#me { display: flex; align-items: center; gap: .6rem; }
main.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; padding: 1rem 1.5rem 2rem; max-width: 1300px; margin: 0 auto; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.2rem; }
.card h2 { margin: 0 0 .6rem; font-size: 1.15rem; }
.card h3 { margin: 1rem 0 .4rem; font-size: 1rem; color: var(--muted); }
.card.narrow { max-width: 420px; margin: 3rem auto; }
form label { display: flex; flex-direction: column; gap: .3rem; margin: .5rem 0; font-size: .9rem; color: var(--muted); }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; margin: .5rem 0; }
.row label { flex: 1; min-width: 140px; display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--muted); }
.row input { flex: 1; }
a.button { display: inline-block; text-decoration: none; border-radius: 8px; padding: .55em 1.1em; background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.tabs { display: flex; gap: .3rem; margin-bottom: .6rem; }
.tabs button { background: transparent; color: var(--muted); border: 1px solid transparent; padding: .4em .8em; }
.tabs button[aria-selected="true"] { color: var(--text); border-color: var(--line); background: var(--panel-2); }
.error { color: var(--bad); min-height: 1.2em; margin: .4rem 0 0; font-size: .9rem; }
.notice { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: .7rem .9rem; margin: .6rem 0; }
.notice code { display: block; font-size: 1.15rem; letter-spacing: .06em; margin: .4rem 0 .6rem; color: var(--accent); user-select: all; }
.list { list-style: none; margin: .4rem 0; padding: 0; }
.list li { display: flex; align-items: center; gap: .6rem; padding: .45rem .2rem; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .name { font-weight: 600; }
.list .actions { margin-left: auto; display: flex; gap: .3rem; }
.list .actions button { padding: .3em .7em; font-size: .85rem; }
.dot { width: .65rem; height: .65rem; border-radius: 50%; display: inline-block; flex: none; background: #5a6b60; }
.dot.online { background: var(--good); }
.dot.in_lobby, .dot.ready { background: var(--accent); }
.dot.in_game { background: #59b7ff; }
.dot.offline { background: #5a6b60; }
table.board { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.board th, table.board td { text-align: left; padding: .35rem .3rem; border-bottom: 1px solid var(--line); }
table.board th { color: var(--muted); font-weight: 500; }
table.board caption { text-align: left; color: var(--muted); padding: .4rem 0; }
.banner { position: absolute; top: 1rem; left: 50%; transform: translateX(-50%); background: rgba(10, 20, 14, .85); border: 1px solid var(--line); color: var(--text); padding: .5rem 1rem; border-radius: 10px; font-size: .95rem; }
.banner[hidden] { display: none; }
.overlay table.results { width: min(420px, 90vw); background: rgba(10, 20, 14, .7); border-radius: 10px; }
.list .frog { color: var(--muted, #9fb7a6); font-size: .9rem; display: inline-flex; align-items: center; gap: .35rem; }
.frog-dot { width: .8rem; height: .8rem; border-radius: 50%; display: inline-block; flex: none; border: 1px solid rgba(255,255,255,.35); }
.frog-list { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; }
.frog-list .frog-choice { display: flex; align-items: center; gap: .5rem; text-align: left; padding: .45rem .6rem; }
.frog-list .frog-choice:first-child { grid-column: 1 / -1; }
.frog-list .frog-choice.active { background: var(--accent); color: var(--accent-ink); }
.frog-list .frog-choice.active .small { color: var(--accent-ink); }
/* lobby page: settings button and panel */
.menu-open { padding: .35em .7em; font-size: 1.1rem; line-height: 1; }
.after-match { display: flex; flex-direction: column; align-items: center; gap: .4rem; width: min(520px, 92vw); }
.after-match .after-row { justify-content: center; width: 100%; }
.after-match select { flex: 1; min-width: 0; }
.chat { margin-top: .8rem; border-top: 1px solid var(--line); padding-top: .6rem; }
.chat-lines { list-style: none; margin: 0 0 .5rem; padding: 0; max-height: 11rem; overflow-y: auto; font-size: .92rem; }
.chat-lines li { padding: .15rem 0; overflow-wrap: anywhere; }
.chat-lines .who { font-weight: 600; margin-right: .45rem; color: var(--accent); }
.chat-lines li.me .who { color: var(--good); }
#form-chat input { flex: 1; }
/* in-game chat (play page) */
.gamechat { position: absolute; left: 10px; bottom: 10px; width: min(420px, 60%); pointer-events: none; font-size: 15px; }
.gamechat ul { list-style: none; margin: 0; padding: 0; }
.gamechat li { background: rgba(0,0,0,.55); color: #fff; padding: 3px 8px; margin-top: 3px; border-radius: 6px; width: fit-content; max-width: 100%; overflow-wrap: anywhere; transition: opacity .6s; }
.gamechat li.old { opacity: 0; }
.gamechat.open li.old { opacity: 1; }
.gamechat .who { font-weight: 700; color: #ffd23f; margin-right: 6px; }
.gamechat input { pointer-events: auto; width: 100%; margin-top: 6px; font-size: 15px; padding: 6px 8px; border-radius: 6px; border: 1px solid #ffd23f; background: rgba(0,0,0,.75); color: #fff; }
.chat-hint { position: absolute; right: 10px; bottom: 8px; font-size: 12px; color: rgba(255,255,255,.55); pointer-events: none; }
/* touch controls (play page) */
body.play { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
.touch-controls { display: none; }
body.touch .touch-controls { display: block; }
/* (not over the start screen or a match's results page: nothing there to steer) */
body.touch:has(#overlay:not([hidden])) .touch-controls { display: none; }
.touch-only { display: none; }
body.touch .touch-only { display: block; }
body.touch .chat-hint { display: none; }
.touch-controls { --jump: min(26vmin, 120px); --shift: min(14vmin, 64px); }
.touch-controls .dpad, .touch-controls .jump, .touch-controls .shift { position: fixed; z-index: 5; touch-action: none; -webkit-tap-highlight-color: transparent; }
.touch-controls .dpad {
  left: calc(14px + env(safe-area-inset-left)); bottom: calc(14px + env(safe-area-inset-bottom));
  width: min(42vmin, 190px); height: min(42vmin, 190px); border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.10) 0 22%, rgba(255,255,255,.06) 23% 100%);
  border: 2px solid rgba(255,255,255,.22);
}
.touch-controls .dpad span {
  position: absolute; width: 34%; height: 34%; display: grid; place-items: center;
  font-size: min(7vmin, 32px); color: rgba(255,255,255,.75); border-radius: 22%; background: rgba(0,0,0,.25); pointer-events: none;
}
.touch-controls .dpad .up { left: 33%; top: 2%; } .touch-controls .dpad .down { left: 33%; bottom: 2%; }
.touch-controls .dpad .left { left: 2%; top: 33%; } .touch-controls .dpad .right { right: 2%; top: 33%; }
.touch-controls .dpad span.on { background: rgba(255,210,63,.55); color: #000; }
.touch-controls .jump {
  right: calc(18px + env(safe-area-inset-right)); bottom: calc(28px + env(safe-area-inset-bottom));
  width: var(--jump); height: var(--jump); border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: min(5vmin, 22px); letter-spacing: .04em;
  color: #1b1300; background: rgba(255,210,63,.72); border: 3px solid rgba(255,255,255,.45); box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
.touch-controls .jump.on { background: rgba(255,232,140,.95); transform: scale(.95); }
/* Shift (the tongue): small, just left of JUMP, level with its lower half */
.touch-controls .shift {
  right: calc(18px + 12px + var(--jump) + env(safe-area-inset-right)); bottom: calc(28px + env(safe-area-inset-bottom));
  width: var(--shift); height: var(--shift); border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: min(2.8vmin, 13px); letter-spacing: .03em;
  color: #fff; background: rgba(90,170,255,.55); border: 2px solid rgba(255,255,255,.45); box-shadow: 0 3px 10px rgba(0,0,0,.4);
}
.touch-controls .shift.on { background: rgba(150,205,255,.9); color: #001b33; transform: scale(.95); }
.chat-button { position: fixed; z-index: 5; right: calc(10px + env(safe-area-inset-right)); top: calc(70px + env(safe-area-inset-top));
  padding: 6px 12px; font-size: 14px; border-radius: 16px; background: rgba(0,0,0,.55); color: #fff; border: 1px solid rgba(255,255,255,.35); }
body.touch .gamechat { bottom: calc(min(42vmin, 190px) + 30px); }
.board td.team div { white-space: nowrap; }
/* page menu and controls (play page) */
.menu-button { position: fixed; z-index: 6; left: calc(8px + env(safe-area-inset-left)); top: calc(8px + env(safe-area-inset-top));
  width: 40px; height: 40px; padding: 0; font-size: 22px; line-height: 1; border-radius: 10px;
  background: rgba(0,0,0,.5); color: #fff; border: 1px solid rgba(255,255,255,.3); opacity: .75; }
.menu-button:hover, .menu-button:focus-visible { opacity: 1; }
.menu-button.in-picture { top: auto; bottom: calc(8px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: 36px; height: 36px; font-size: 19px; opacity: .6; }
.page-menu { position: fixed; z-index: 7; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(440px, 92vw);
  max-height: 90vh; max-height: 90dvh; overflow-y: auto; padding: 1rem 1.2rem; border-radius: 14px; background: rgba(12, 26, 18, .96);
  border: 1px solid var(--line); box-shadow: 0 10px 40px rgba(0,0,0,.6); display: flex; flex-direction: column; gap: .6rem; touch-action: pan-y; }
.page-menu[hidden] { display: none; }
.page-menu h2 { margin: 0 0 .2rem; }
.page-menu > button { width: 100%; }
.page-menu .tabs { display: flex; gap: .3rem; flex-wrap: wrap; }
.page-menu .tabs button { flex: 1; padding: .3rem .4rem; font-size: .9rem; }
.page-menu table.controls td { padding: .25rem .3rem; }
.page-menu button.key { min-width: 8.5rem; padding: .25rem .5rem; font-size: .95rem; }
.page-menu button.key.waiting { background: var(--accent); color: #000; }
.page-menu button.key.clash { outline: 2px solid #ff8a3d; }
.page-menu .small-btn { padding: .2rem .5rem; }
.page-menu .row { display: flex; gap: .5rem; }
.page-menu .row button { flex: 1; }
button.danger { background: #a33; color: #fff; }
.page-menu .tabs button.active { background: var(--accent); color: #000; }
.page-menu select { min-width: 0; max-width: 100%; }

/* Phones: the menus fit on the screen without scrolling. Smaller type and spacing on any
   small screen; on short (landscape) screens the panel is wider and the key list is in
   two columns. */
@media (max-width: 640px), (max-height: 520px) {
  .page-menu { padding: .6rem .8rem; gap: .35rem; font-size: .9rem; border-radius: 12px; }
  .page-menu h2 { font-size: 1.1rem; margin: 0; }
  .page-menu p { margin: 0; }
  .page-menu .small { font-size: .78rem; }
  .page-menu button { padding: .4em .8em; }
  .page-menu .tabs button { padding: .25rem .3rem; font-size: .82rem; }
  .page-menu table.controls { font-size: .85rem; }
  .page-menu table.controls td { padding: .12rem .25rem; }
  .page-menu button.key { min-width: 6.2rem; padding: .2rem .4rem; font-size: .85rem; }
  .page-menu .small-btn { padding: .15rem .45rem; }
  .page-menu .display-row { margin: .2rem 0; gap: .4rem; }
  .page-menu select { padding: .3em .5em; }
}
@media (max-height: 520px) {
  .page-menu { width: min(760px, calc(100vw - 16px)); max-height: calc(100vh - 12px); max-height: calc(100dvh - 12px); }
  .page-menu table.controls { display: grid; grid-template-columns: 1fr 1fr; column-gap: 1rem; }
  .page-menu table.controls tbody { display: contents; }
  .page-menu table.controls tr { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; border-bottom: 1px solid var(--line); }
  .page-menu table.controls td { display: block; border: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .page-menu .display-row { display: grid; grid-template-columns: 9rem minmax(0, 1fr); }
}

/* movies (start-up logos, story cut-scenes, Treasure Chest chapters) */
.movie { position: fixed; inset: 0; z-index: 60; background: #000; display: grid; place-items: center; cursor: pointer; }
.movie video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.movie-hint { position: absolute; bottom: .8rem; left: 50%; transform: translateX(-50%); color: rgba(255,255,255,.55); font-size: .85rem; pointer-events: none; white-space: pre; }
.movie-play { position: absolute; font-size: 1.3rem; padding: .7em 1.4em; }
.movie-play[hidden] { display: none; }

/* Display settings */
.display-row { display: flex; align-items: center; gap: .6rem; margin: .6rem 0; }
.display-row select { flex: 1; }

#offline-note { text-align: center; margin: 2rem 1rem; }
.sound-row input[type=range] { flex: 1; min-width: 0; accent-color: var(--accent); }
.sound-row output { min-width: 3.2em; text-align: right; font-variant-numeric: tabular-nums; }
@media (max-height: 520px) { .page-menu .display-row.sound-row { grid-template-columns: 9rem minmax(0, 1fr) 3.2em; } }
/* the start screen and a match's results on short (phone landscape) screens: all of it fits */
@media (max-height: 520px) {
  .overlay { gap: .45rem; padding: .5rem 1rem; }
  .overlay h1 { font-size: 1.5rem; }
  .overlay p { margin: 0; }
  .overlay table.results { font-size: .85rem; }
  .overlay table.results th, .overlay table.results td { padding: .15rem .4rem; }
  .after-match { gap: .3rem; }
  .after-match p { margin: 0; }
  .after-match button, .after-match select, .overlay #back-link { padding: .35em 1em; font-size: .9rem; }
}
