:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 100%; color: #202824; background: #f1f3f2;
  --ink: #202824; --muted: #59645d; --paper: #fff;
  --green: #285647; --line: #d5dbd7;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
button, input, select { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid #2563a6; outline-offset: 2px;
}
.shell {
  position: relative;
  width: 100%; max-width: 393px; margin: auto; background: var(--paper);
  height: 100vh; height: min(100svh, 852px); height: min(100dvh, 852px);
  height: min(var(--viewport-height, 100dvh), 852px);
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom); overflow: hidden;
}
.brand {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 56px; flex: none; border-bottom: 1px solid var(--line);
}
.brand a { font-size: 1rem; font-weight: 650; text-decoration: none; }
.view { flex: 1; min-height: 0; overflow: auto; padding: 20px 0 12px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-size: 1.375rem; font-weight: 650; line-height: 1.3; margin-bottom: 12px; }
h3 { font-size: 1rem; }
p { line-height: 1.5; color: var(--muted); }
.label { font-size: .8125rem; color: var(--muted); }
.actions { display: grid; gap: 10px; }
.primary, .secondary, .danger {
  min-height: 48px; width: 100%; border-radius: 5px; padding: 12px 16px; font-weight: 600;
}
.primary { border: 1px solid var(--green); background: var(--green); color: white; }
.secondary { border: 1px solid var(--line); background: white; }
.danger { border: 1px solid #963a31; background: #963a31; color: white; }
.text-button { background: none; border: 0; min-height: 44px; text-decoration: underline; font-size: .8125rem; padding: 8px; }
.back { margin: -8px 0 10px; padding-left: 0; }
.note { font-size: .8125rem; margin: 16px 0 0; }
.field { display: grid; gap: 8px; margin: 18px 0; font-size: .875rem; font-weight: 600; }
input, select {
  width: 100%; min-height: 48px; min-width: 0; padding: 11px 12px;
  border: 1px solid #99a49d; border-radius: 5px; background: white; color: var(--ink); font-size: 1rem;
}
.field small { font-size: .75rem; font-weight: 400; color: var(--muted); }
.error, #notice { color: #862e24; background: #fff1ec; padding: 10px; border-radius: 4px; font-size: .8125rem; }
#notice { margin-top: 8px; }
#notice:empty { display: none; }
.room-title { font-size: 1.125rem; margin: 8px 0; overflow-wrap: anywhere; }
.ticket { border-block: 1px solid var(--line); padding: 16px 0; margin: 15px 0; }
.ticket .label { margin-bottom: 6px; }
.ticket .text-button { padding-left: 0; }
.countdown { font-variant-numeric: tabular-nums; font-size: 1.75rem; margin: 12px 0 4px; }
.people { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 12px 0; }
.chip { font-size: .8125rem; overflow-wrap: anywhere; }
.waiting-note { margin-top: 18px; font-size: .8125rem; }
.game { padding-top: 12px; }
/* Keep the play surface at the iPhone 16 reference size. Smaller available
   viewports scroll inside #view instead of shrinking the board or controls. */
.game-canvas { min-width: 361px; min-height: 740px; }
.player-status { height: 128px; margin: 8px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 4px; display: flex; flex-direction: column; }
.player-status h2 { flex: none; margin: 0 0 7px; font-size: .8125rem; line-height: 1.3; font-weight: 650; }
.player-status-list { min-height: 0; max-height: 78px; overflow: auto; overscroll-behavior: contain; scroll-padding: 4px; }
.player-status-list:focus-visible { outline: 2px solid #2563a6; outline-offset: 2px; }
.player-status-list ul { list-style: none; margin: 0; padding: 0; }
.player-status-list li { display: flex; align-items: baseline; gap: 8px; min-height: 26px; padding: 3px 0; font-size: .8125rem; line-height: 1.4; }
.player-status-name { flex: 0 1 auto; min-width: 0; overflow-wrap: anywhere; }
.player-status-squares { flex: none; white-space: nowrap; }
.game-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.player { font-weight: 650; font-size: 1rem; overflow-wrap: anywhere; }
.room-small { font-size: .6875rem; color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; }
.timer { font-variant-numeric: tabular-nums; padding: 8px 0 8px 10px; font-size: 1.125rem; white-space: nowrap; }
.status-row { display: flex; align-items: center; justify-content: space-between; margin: 10px 0; font-size: .6875rem; color: var(--muted); }
.connection.offline { color: #963a31; font-weight: 600; }
.board { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-auto-rows: minmax(4.25rem, auto); gap: 5px; }
.cell {
  position: relative; min-width: 0; min-height: 4.25rem; display: grid; place-items: center;
  border: 1px solid #bdc8c0; border-radius: 4px; background: white; padding: 6px 3px;
  text-align: center; line-height: 1.15; font-size: .75rem; font-weight: 500;
  overflow-wrap: anywhere; hyphens: auto; touch-action: manipulation;
}
.cell.marked { background: var(--green); color: white; border-color: var(--green); }
.cell.free { background: #e8edea; color: var(--ink); border-color: #a4b2a9; font-size: .6875rem; font-weight: 650; }
.cell.pending { border: 2px dashed #946016; background: #fff7e8; color: var(--ink); }
.cell.winning { box-shadow: inset 0 0 0 3px #c5e3d2; }
.game-hint { font-size: .75rem; text-align: center; margin: 10px 0 2px; }
.game-actions { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.finished { padding: 10px 12px; margin-bottom: 12px; border-left: 3px solid var(--green); background: #edf4ef; font-weight: 650; font-size: .875rem; overflow-wrap: anywhere; }
.finished small { display: block; font-weight: 400; margin-top: 4px; }
dialog { max-width: calc(100vw - 32px); width: 355px; max-height: 85vh; overflow: auto; border: 1px solid var(--line); border-radius: 6px; background: white; padding: 24px; color: var(--ink); }
dialog::backdrop { background: #18251f66; }
dialog p, dialog li { font-size: .875rem; line-height: 1.5; }
dialog ul { padding-left: 20px; }
#dialog-content + #close-dialog { margin-top: 12px; }
dialog { max-height: calc(var(--viewport-height, 100dvh) - 32px); }
.confirm-actions { display: grid; gap: 8px; margin-bottom: 8px; }
@media (max-height: 700px) {
  .brand { min-height: 52px; }
  .view { padding-top: 12px; }
  .view.game { padding-top: 8px; padding-bottom: 4px; }
  .game-hint { margin-top: 7px; }
  .status-row { margin: 8px 0; }
}
@media (min-width: 500px) { body { display: grid; min-height: 100vh; place-items: center; } }

/* Result effects stay inside the dismissible announcement, away from card controls. */
.result-scene { position: relative; height: 190px; overflow: hidden; border-radius: 4px; margin: -8px -8px 20px; isolation: isolate; pointer-events: none; }
.party { background: #161d38; }
.result-reactions { position: relative; margin: 14px 0 20px; }
.reaction-stage { position: absolute; bottom: 48px; left: 0; right: 0; height: 235px; overflow: hidden; pointer-events: none; z-index: 3; }
.reaction-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.reaction-buttons button { min-height: 44px; padding: 4px; font-size: 26px; line-height: 1.2; background: #f1f5f3; color: #172a24; border: 1px solid #d0dcd5; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.reaction-buttons button:active { transform: scale(.9); background: #d8e8df; }
.reaction-float { position: absolute; bottom: 0; font-size: 38px; line-height: 1.3; animation: reaction-rise 1.9s ease-out forwards; }
@keyframes reaction-rise { 0% { opacity: 1; transform: translateY(0) scale(.7); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--drift), -220px) rotate(var(--tilt)) scale(1.25); } }
.disco-lights { position: absolute; inset: -60%; background: conic-gradient(from 0deg, transparent, #b778bc66, transparent 25%, #5798bb66, transparent 50%, #a3b87766, transparent 75%, #b778bc66); animation: disco-light-turn 9s linear infinite, disco-glow 4s ease-in-out infinite; }
.disco-cord { position: absolute; width: 2px; height: 26px; background: #a1b2cd; left: calc(50% - 1px); top: 0; }
.disco-ball { position: absolute; top: 25px; left: calc(50% - 44px); width: 88px; height: 88px; border-radius: 50%; overflow: hidden; background: #8595af; box-shadow: 0 0 24px #b8cce144; }
.disco-tiles { position: absolute; inset: 0 -44px; background-color: #b2c0d4; background-image: repeating-linear-gradient(0deg, transparent 0 9px, #243549 9px 11px), repeating-linear-gradient(90deg, transparent 0 9px, #243549 9px 11px), repeating-conic-gradient(#dcecf3 0% 25%, #798ca8 0% 50%); background-size: auto, auto, 22px 22px; animation: disco-spin 3s linear infinite; }
.disco-ball::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(circle at 32% 26%, #ffffffbb, transparent 30%, #09122f55 70%, #09122fcc); }
.particles { position: absolute; inset: 0; }
.particles i { position: absolute; left: 4%; top: -24px; width: 7px; height: 12px; background: #e8c768; animation: confetti-fall 3.4s linear infinite; }
.particles i:nth-child(6n+2) { left: 21%; animation-delay: -1.8s; }
.particles i:nth-child(6n+3) { left: 39%; animation-delay: -.7s; }
.particles i:nth-child(6n+4) { left: 57%; animation-delay: -2.6s; }
.particles i:nth-child(6n+5) { left: 75%; animation-delay: -1.2s; }
.particles i:nth-child(6n) { left: 93%; animation-delay: -3s; }
.particles i:nth-child(3n) { background: #85c6ca; width: 5px; animation-duration: 4.1s; }
.particles i:nth-child(3n+1) { background: #ed98b5; animation-duration: 2.9s; }
.particles i:nth-child(n+7):nth-child(-n+12) { margin-left: 9px; animation-delay: -1.1s; }
.particles i:nth-child(n+13):nth-child(-n+18) { margin-left: -7px; animation-delay: -2.2s; }
.particles i:nth-child(n+19):nth-child(-n+24) { margin-left: 13px; animation-delay: -.4s; }
.particles i:nth-child(n+25):nth-child(-n+30) { margin-left: -12px; animation-delay: -3.6s; }
.particles i:nth-child(n+31) { margin-left: 5px; animation-delay: -1.5s; }
.rainy { background: linear-gradient(#b9c8d5, #e1e9ee); }
.rain-cloud { position: absolute; top: 40px; left: 26px; width: 150px; height: 45px; border-radius: 40px; background: #778b9d; z-index: 1; animation: cloud-drift 7s ease-in-out infinite alternate; }
.rain-cloud::before, .rain-cloud::after { content: ''; position: absolute; background: inherit; border-radius: 50%; }
.rain-cloud::before { width: 68px; height: 68px; top: -30px; left: 22px; }
.rain-cloud::after { width: 52px; height: 52px; top: -19px; right: 17px; }
.cloud-two { left: auto; right: 18px; top: 66px; transform: scale(.8); background: #8d9dab; animation-delay: -3s; }
.rainy .particles { top: 78px; }
.rainy .particles i { width: 2px; height: 15px; background: #4a789a; opacity: .65; animation-name: rain-fall; animation-duration: 1.1s; }
.rainy .particles i:nth-child(3n) { animation-duration: 1.4s; }
dialog:not([open]) .result-scene * { animation-play-state: paused; }
@keyframes confetti-fall { from { transform: translate(-9px,-10px) rotate(0deg); } to { transform: translate(13px,230px) rotate(540deg); } }
@keyframes rain-fall { from { transform: translate(6px,-20px) rotate(12deg); } to { transform: translate(-15px,150px) rotate(12deg); } }
@keyframes cloud-drift { from { translate: -5px 0; } to { translate: 5px 0; } }
@keyframes disco-spin { to { transform: translateX(22px); } }
@keyframes disco-light-turn { to { transform: rotate(360deg); } }
/* Slow, soft light pulses rather than rapid full-screen flashes. */
@keyframes disco-glow { 0%,100% { opacity: .45; } 50% { opacity: 1; } }
/* Activity stays in the document flow below the board. */
.join-toast { width: fit-content; max-width: 100%; margin-inline: auto; color: var(--ink); text-align: left; font-size: .75rem; line-height: 1.4; overflow-wrap: anywhere; }
.join-toast[hidden] { display: none; }
.game-hint { min-height: 1.4em; }
.game-hint:has(.join-toast:not([hidden])) .hint-default { display: none; }
.room-heading { display: grid; gap: 3px; margin-bottom: 6px; }
.room-heading strong { font-size: 1rem; font-weight: 750; line-height: 1.2; overflow-wrap: anywhere; }
.room-heading > span { font-size: .6875rem; color: var(--muted); overflow-wrap: anywhere; }
.round-label { font-size: .6875rem; font-weight: 400; color: var(--muted); }

.name-fields { display: grid; grid-template-columns: minmax(0, 1fr) 48px; gap: 12px; }
.name-fields .field { min-width: 0; }
.game-name-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.game-name-row strong { overflow-wrap: anywhere; }
#shuffle-name { flex: none; display: grid; place-items: center; width: 44px; padding: 8px; text-decoration: none; }
/* Inset focus rings stay visible inside the scrolling form. */
#entry input:focus-visible, #entry select:focus-visible, #entry button:focus-visible { outline-offset: -3px; }

#emoji-picker { width: 48px; height: 48px; padding: 0; display: grid; place-items: center; border: 1px solid #99a49d; border-radius: 5px; background: white; font-size: 1.5rem; }
.emoji-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 6px; margin: 16px 0; }
.emoji-grid button { min-width: 0; min-height: 48px; padding: 4px; background: white; border: 1px solid var(--line); border-radius: 5px; font-size: 1.5rem; }
.emoji-grid button[aria-pressed="true"] { border: 2px solid var(--green); background: #edf4ef; }
@media (max-height: 650px) {
  .room-heading { margin-bottom: 2px; }
  .game .status-row { margin-block: 6px; }
}

.site-footer { flex: none; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 8px; border-top: 1px solid var(--line); min-height: 32px; font-size: .625rem; color: var(--muted); }
.site-footer nav { display: flex; gap: 12px; }
.site-footer a { display: inline-block; padding-block: 9px; }
.privacy-copy h2 { font-size: 1rem; margin-top: 24px; }
.privacy-copy p { font-size: .875rem; }
@media (max-height: 650px) {
  .game-hint { margin-top: 7px; }
}

.feedback-dialog{width:min(440px,calc(100% - 28px));max-height:calc(100dvh - 40px);overflow:auto;border:2px solid var(--green);border-radius:16px;padding:22px;background:#fff;color:var(--ink);box-shadow:0 15px 60px #123c4740}
.feedback-dialog::backdrop{background:#123c4766}
.feedback-dialog form{display:grid;gap:10px}
.dialog-heading{display:flex;align-items:center;justify-content:space-between;gap:10px}
.dialog-heading h2{font-size:24px;line-height:1.2;margin:0;color:var(--green)}
.dialog-close{border:0;background:transparent;color:#596a75;font-size:28px;min-width:44px;min-height:44px;cursor:pointer}
.feedback-dialog>form>label{display:block;font:600 14px Arial,sans-serif;margin-top:5px}
.feedback-dialog textarea{width:100%;border:1px solid #91a099;border-radius:8px;padding:10px;font:16px/1.4 Arial,sans-serif;resize:vertical;color:var(--ink)}
.feedback-dialog .button{justify-self:start;margin-top:4px}
.star-rating{display:flex;gap:4px;width:max-content}
.star-rating label{position:relative;margin:0;cursor:pointer}
.star-rating input{position:absolute;opacity:0}
.star-rating label>span[aria-hidden]{display:block;font-size:34px;line-height:1;color:#cbd7c7}
.star-rating label:has(input:checked)>span[aria-hidden],.star-rating label:has(~label input:checked)>span[aria-hidden],.star-rating label:hover>span[aria-hidden],.star-rating label:has(~label:hover)>span[aria-hidden]{color:#efc92f}
.star-rating input:focus-visible+span{outline:3px solid var(--green);outline-offset:2px;border-radius:3px}
.feedback-honeypot{position:absolute!important;left:-10000px!important;width:1px!important;height:1px!important;overflow:hidden!important}
.feedback-confirmation{font:17px/1.5 Arial,sans-serif}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}

.site-footer { color: #71808a; font-family: Arial,sans-serif; }
.site-footer a { color: #596a75; text-underline-offset: 3px; }
.feedback-dialog form[hidden] { display:none; }
.feedback-dialog input[type=radio] { width: 1px; min-width: 0; min-height: 0; padding: 0; }
.feedback-dialog textarea:focus-visible { outline: 3px solid var(--green); outline-offset: -3px; }
#feedback-error:empty { display:none; }
#feedback-error { color: #862e24; margin: 0; }

.feedback-dialog { max-height: calc(var(--viewport-height, 100dvh) - 32px); }

.winning-words { font-weight: 400; font-size: .875rem; line-height: 1.4; }
.winning-words ul { padding-left: 20px; margin: 8px 0 16px; }
.winning-words li { margin: 4px 0; overflow-wrap: anywhere; }
.winning-words p { margin: 12px 0 0; font-weight: 600; }
.winning-details { margin-top: 8px; }
.winning-details summary { cursor: pointer; font-weight: 500; }

.brand { position: relative; }
.brand-start { display: flex; align-items: center; gap: 5px; min-width: 0; }
.menu-toggle { display: grid; place-items: center; width: 44px; min-height: 44px; padding: 0; border: 0; background: none; margin-left: -6px; }
.app-menu, .apps-dialog { width: min(620px, calc(100vw - 24px)); max-width: calc(100vw - 24px); max-height: calc(var(--viewport-height, 100dvh) - 32px); padding: 0; border: 1px solid #d5dfd9; border-radius: 10px; background: white; color: var(--ink); overflow: hidden; }
.app-menu[open], .apps-dialog[open] { display: flex; flex-direction: column; }
.app-menu::backdrop, .apps-dialog::backdrop { background: #152b2255; }
.panel-top { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; padding: 16px 20px; border-bottom: 1px solid #d5dfd9; }
.panel-top h2 { margin: 0; font-size: 1.25rem; line-height: 1.3; }
.panel-top > button { flex: none; min-height: 44px; padding: 8px 12px; border: 1px solid #d5dfd9; border-radius: 6px; background: white; color: var(--ink); font-size: .875rem; }
.app-menu nav { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 20px; }
.menu-group { padding: 8px 0; border-bottom: 1px solid #d5dfd9; }
.menu-group:first-child { padding-top: 0; }
.menu-group:last-child { border: 0; }
.menu-group a, .menu-group button { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 44px; padding: 12px 0; border: 0; border-radius: 0; background: transparent; color: var(--ink); text-align: left; text-decoration: none; font-size: 1rem; line-height: 1.5; }
.menu-group a:hover, .menu-group button:hover { background: #f2f6f3; }
.menu-version { flex: none; margin: 0; padding: 0 20px 16px; font-size: .75rem; color: var(--muted); }
.app-cards { display: grid; gap: 16px; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 20px; }
.app-card { display: flex; align-items: center; gap: 15px; min-width: 0; padding: 14px 16px; border: 1px solid #0000001f; border-radius: 12px; background: white; color: var(--ink); text-decoration: none; box-shadow: 0 2px 7px #00000014; }
.app-card > img { display: block; flex: none; width: 58px; height: 58px; object-fit: cover; border-radius: 9px; }
.app-card > span:not(.sr-only) { flex: 1; min-width: 0; }
.app-card strong { display: block; font-size: 1rem; line-height: 1.2; }
.app-card small { display: block; margin-top: 5px; padding-top: 5px; border-top: 1px solid #d9dddf; color: #606970; font-size: .8125rem; line-height: 1.3; }
.app-card:hover { border-color: #8ca99b; background: #fafcfb; }
.apps-dialog .panel-top { align-items: flex-start; }
.apps-dialog .panel-top h2 { align-self: center; }
@media (min-width: 600px) { .app-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.site-footer { background: var(--paper); }
.view { overscroll-behavior: contain; scroll-padding-block: 16px; }
.release-list { padding-left: 20px; }
.release-list li { margin-bottom: 16px; }
.release-list strong { display: block; margin-bottom: 4px; }

.game-hint { min-height: 4.2em; }
.activity-item { line-height: 1.4; animation: activity-fade 6s linear forwards; }
@keyframes activity-fade { 0%,70% { opacity: 1; } 100% { opacity: 0; } }
