:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172624;
  background: #f3f4ef;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --green: #145b50;
  --green-dark: #0e4039;
  --muted: #5f6e69;
  --line: #dce3dc;
  --paper: #ffffff;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input, select { font: inherit; }
[hidden] { display: none !important; }
.page-shell { width: min(100%, 760px); margin: 0 auto; padding: 28px 16px 48px; }
.page-header { margin: 0 0 22px; }
.eyebrow { margin: 0 0 8px; color: var(--green); font-size: 0.74rem; font-weight: 750; letter-spacing: 0.12em; }
h1 { margin: 0; font-size: clamp(1.8rem, 7vw, 2.45rem); line-height: 1.1; }
.intro { max-width: 55ch; margin: 12px 0 0; color: var(--muted); line-height: 1.6; }
.search-panel, .preview-panel { margin-top: 18px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: 0 8px 28px rgb(23 38 36 / 5%); }
h2 { margin: 0 0 18px; font-size: 1.1rem; }
.field-label { display: block; margin: 16px 0 7px; font-size: 0.9rem; font-weight: 700; }
.control { display: block; width: 100%; min-height: 48px; padding: 11px 13px; border: 1px solid #b9c8c0; border-radius: 11px; background: #fff; color: #172624; }
.control:focus { border-color: var(--green); outline: 3px solid rgb(20 91 80 / 15%); }
.password-control-wrap { position: relative; }
.password-control-wrap .control { padding-right: 82px; }
.password-toggle { position: absolute; top: 50%; right: 8px; min-width: 62px; min-height: 36px; padding: 0 8px; transform: translateY(-50%); border: 0; border-radius: 8px; background: #e8f1ed; color: var(--green-dark); font-weight: 700; cursor: pointer; }
.password-toggle:focus-visible { outline: 3px solid rgb(20 91 80 / 30%); }
.status-message { min-height: 1.5em; margin: 12px 0 0; color: var(--muted); font-size: 0.9rem; }
.card-results { display: grid; gap: 8px; max-height: 430px; overflow: auto; margin: 10px 0 0; padding: 0; list-style: none; }
.result-button { display: flex; width: 100%; min-height: 72px; align-items: center; gap: 12px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: inherit; text-align: left; cursor: pointer; }
.result-button:hover, .result-button:focus-visible { border-color: var(--green); background: #f7faf7; outline: 2px solid rgb(20 91 80 / 20%); }
.result-image { width: 42px; height: 58px; flex: 0 0 auto; border-radius: 5px; background: #e7ebe7; object-fit: cover; }
.result-copy { min-width: 0; display: grid; gap: 4px; }
.result-name { overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.result-subtitle { color: var(--muted); font-size: 0.84rem; }
.card-badge { justify-self: start; padding: 2px 7px; border-radius: 999px; background: #e8f1ed; color: var(--green-dark); font-size: 0.73rem; font-weight: 700; }
.preview-panel { display: grid; justify-items: center; gap: 12px; text-align: center; }
.preview-copy { width: 100%; }
.preview-copy h2 { margin: 0 0 5px; font-size: 1.25rem; }
.preview-english, .preview-number { margin: 4px 0; color: var(--muted); }
.preview-image { display: block; width: min(100%, 360px); max-height: 65vh; border-radius: 13px; background: #e7ebe7; object-fit: contain; box-shadow: 0 8px 24px rgb(23 38 36 / 12%); }
@media (min-width: 620px) {
  .page-shell { padding: 46px 24px 64px; }
  .search-panel, .preview-panel { padding: 24px; }
  .preview-panel { grid-template-columns: minmax(220px, 1fr) minmax(200px, 320px); justify-items: start; text-align: left; }
  .preview-copy { align-self: center; }
  .pick-toolbar { grid-template-columns: minmax(160px, 240px) 1fr; align-items: center; }
  .pick-toolbar .field-label { grid-column: 1 / -1; }
  .pick-seat-player { margin: 0; }
  .source-card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.form-help { margin: 8px 0 16px; color: var(--muted); font-size: 0.84rem; line-height: 1.55; }
.primary-button, .secondary-button { display: inline-flex; min-height: 48px; align-items: center; justify-content: center; padding: 11px 18px; border: 0; border-radius: 11px; font-weight: 750; cursor: pointer; }
.primary-button { width: 100%; margin-top: 6px; background: var(--green); color: #fff; }
.primary-button:hover:not(:disabled) { background: var(--green-dark); }
.primary-button:disabled { opacity: 0.65; cursor: wait; }
.secondary-button { width: 100%; margin-top: 10px; border: 1px solid var(--line); background: #fff; color: var(--green-dark); }
.room-created-panel { display: block; text-align: left; }
.room-created-panel h2 { margin-bottom: 8px; }
.room-created-panel p { color: var(--muted); line-height: 1.55; }
.lobby-panel { margin-top: 18px; }
.lobby-seats { display: grid; gap: 8px; margin: 12px 0; padding-left: 28px; }
.lobby-seats li { padding: 10px 12px; border-radius: 10px; background: #f3f6f2; }
.lobby-seats li.is-empty { color: var(--muted); }
.lobby-seat-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.seat-reset-button { flex: 0 0 auto; min-height: 36px; padding: 6px 10px; border: 1px solid #d7b4ad; border-radius: 8px; background: #fff8f6; color: #8c3427; font-size: 0.78rem; font-weight: 700; cursor: pointer; }
.seat-reset-button:focus-visible { outline: 3px solid rgb(140 52 39 / 20%); }
.lobby-dialog { width: min(calc(100% - 28px), 460px); max-height: min(88vh, 760px); overflow: auto; padding: 22px; border: 1px solid var(--line); border-radius: 18px; color: inherit; background: var(--paper); box-shadow: 0 18px 60px rgb(14 40 34 / 22%); }
.lobby-dialog::backdrop { background: rgb(13 25 23 / 52%); }
.lobby-dialog h2 { margin-bottom: 8px; }
.lobby-dialog p { color: var(--muted); line-height: 1.55; }
.lobby-dialog form > p { margin-bottom: 14px; }
.lobby-dialog .field-label { margin-top: 14px; }
.lobby-dialog .secondary-button { margin-top: 10px; }
.pick-toolbar { display: grid; grid-template-columns: 1fr; gap: 6px; }
.pick-toolbar .field-label { margin: 0; }
.pick-seat-player { margin: 0 0 8px; color: var(--green-dark); font-weight: 700; }
.pick-warning { margin: 10px 0; padding: 11px 13px; border: 1px solid #e2b985; border-radius: 10px; background: #fff6e8; color: #70430b; font-size: 0.88rem; line-height: 1.45; }
.pick-complete-banner { display: grid; justify-items: center; gap: 4px; margin: 14px 0 18px; padding: 16px; border: 1px solid #c5dfc7; border-radius: 14px; background: linear-gradient(135deg, #eff9ee, #fffbe7); color: #285e3d; text-align: center; animation: pick-complete-in 300ms ease-out both; }
.pick-complete-banner span:last-child { font-size: 0.83rem; color: #53765a; }
.pick-complete-sparkle { color: #bd8c29; font-size: 1.35rem; }
@keyframes pick-complete-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.admin-progress-panel { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.admin-progress-panel h2 { margin: 0; }
.seat-progress-list { display: grid; gap: 8px; }
.seat-progress-item { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfa; }
.seat-progress-heading { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; font-weight: 700; }
.seat-progress-detail { color: var(--muted); font-size: 0.78rem; }
.seat-progress-alert { color: #9b362b; font-size: 0.78rem; font-weight: 750; }
.pack-block { margin: 18px 0; padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
.pack-block h2 { margin: 0 0 12px; }
.pick-rows { display: grid; gap: 10px; }
.pick-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 42px; align-items: start; gap: 7px; }
.pick-source-button, .pick-preview-button { width: 40px; min-height: 42px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--green-dark); font-size: 0.78rem; font-weight: 750; cursor: pointer; }
.pick-preview-button { font-size: 1.15rem; }
.pick-input-area { position: relative; min-width: 0; }
.pick-input { width: 100%; min-height: 42px; padding: 9px 10px; border: 1px solid #b9c8c0; border-radius: 9px; background: #fff; color: #172624; }
.pick-input:focus { border-color: var(--green); outline: 3px solid rgb(20 91 80 / 15%); }
.pick-row.is-empty .pick-input { border-style: dashed; background: #fafbf8; }
.pick-row.is-empty .pick-input::placeholder { color: #89948e; }
.pick-row.is-saved .pick-input { border-color: #94c3a0; background: #f1faf2; }
.pick-row.is-saved .pick-save-state { color: #2f7240; font-weight: 700; }
.pick-save-state { display: block; min-height: 1.2em; margin: 3px 2px 0; color: var(--muted); font-size: 0.72rem; }
.pick-preview-button:disabled { border-color: #e1e5df; background: #f1f2ef; color: #a6aea7; cursor: not-allowed; opacity: 0.68; }
.pick-preview-button:not(:disabled) { border-color: var(--green); background: var(--green); color: #fff; box-shadow: 0 2px 6px rgb(20 91 80 / 18%); }
.pick-suggestions { position: absolute; top: calc(100% + 1px); left: 0; z-index: 5; display: grid; width: 100%; max-height: 330px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 12px 30px rgb(23 38 36 / 16%); }
.pick-suggestion { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px; border: 0; border-bottom: 1px solid #edf0ec; background: #fff; color: inherit; text-align: left; cursor: pointer; }
.pick-suggestion:last-child { border-bottom: 0; }
.pick-suggestion:hover, .pick-suggestion:focus-visible { background: #f3f6f2; }
.pick-suggestion img { width: 34px; height: 46px; flex: 0 0 auto; border-radius: 4px; object-fit: cover; background: #e7ebe7; }
.pick-suggestion-copy { display: grid; min-width: 0; gap: 3px; }
.pick-suggestion-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-suggestion-copy small { color: var(--muted); }
.pick-suggestion-empty { margin: 0; padding: 10px; color: var(--muted); font-size: 0.84rem; }
.pack-next-button { width: 100%; margin-top: 12px; }
.pick-admin-actions { display: grid; gap: 8px; margin-top: 18px; }
.pick-back-link { display: block; margin-top: 18px; }
.pick-preview-dialog { text-align: center; }
.pick-preview-dialog h2 { margin-right: 38px; }
.pick-preview-dialog .preview-image { margin: 12px auto 0; }
.preview-pick-navigation { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 42px; }
.preview-pick-navigation strong { flex: 1; }
.preview-arrow, .dialog-close { display: grid; width: 44px; min-height: 42px; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--green-dark); line-height: 1; cursor: pointer; }
.preview-arrow { font-size: 1.25rem; }
.preview-arrow:disabled { color: #a9b0ab; background: #f1f2ef; cursor: not-allowed; }
.preview-loading { min-height: 1.3em; margin: 6px 0 0; color: var(--muted); font-size: 0.83rem; }
.preview-image[hidden] { display: none; }
.dialog-close { position: absolute; top: 10px; right: 10px; font-size: 1.35rem; }
.dialog-close svg { display: block; width: 16px; height: 16px; overflow: visible; }
.dialog-close svg path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.source-picker-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.source-picker-header h2 { margin: 0; }
.source-picker-header .secondary-button { width: auto; margin: 0; }
.source-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.source-card-option { display: grid; justify-items: center; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: inherit; font-size: 0.78rem; text-align: center; cursor: pointer; }
.source-card-option img { width: min(100%, 126px); aspect-ratio: 5 / 7; border-radius: 5px; object-fit: cover; background: #e7ebe7; }
.source-card-option span { overflow-wrap: anywhere; }
.replay-controls { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, .9fr) minmax(0, 1.8fr); align-items: center; gap: 6px; }
#replay-page > .page-header { margin-bottom: 10px; }
#replay-page > .page-header .eyebrow { display: none; }
#replay-page > .page-header h1 { font-size: 1.5rem; }
#replay-page > .page-header .intro { margin-top: 5px; font-size: .82rem; line-height: 1.35; }
#replay-page .replay-panel { margin-top: 8px; padding: 14px; }
#replay-page .replay-panel > h2 { margin-bottom: 10px; font-size: 1rem; }
.replay-controls > .control, .replay-pick-control .control { min-width: 0; width: 100%; padding: 7px 5px; font-size: .82rem; text-overflow: ellipsis; }
.replay-pick-control { display: grid; min-width: 0; grid-template-columns: 27px minmax(0, 1fr) 27px; gap: 3px; }
.replay-nav-button { display: grid; min-width: 27px; min-height: 40px; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--green-dark); font-size: 1.3rem; line-height: 1; cursor: pointer; }
.replay-nav-button:disabled { color: #a9b0ab; background: #f1f2ef; cursor: not-allowed; }
.replay-status:empty { display: none; }
.replay-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.replay-card { position: relative; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.replay-card.is-chosen { border: 4px solid #08743d; background: #ddf5e5; box-shadow: 0 0 0 3px #f0ce58, 0 5px 16px rgb(8 116 61 / 22%); }
.replay-selected-indicator { position: absolute; z-index: 2; top: 8px; left: 8px; display: grid; width: 38px; height: 38px; place-items: center; border: 3px solid #fff; border-radius: 50%; background: #08743d; box-shadow: 0 1px 7px rgb(0 0 0 / 42%); color: #fff; font-size: 1.45rem; font-weight: 900; line-height: 1; }
.replay-card-image-button { display: block; width: 100%; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.replay-card-image-button:focus-visible { outline: 3px solid #e1a900; outline-offset: -4px; }
.replay-card-image { display: block; width: 100%; aspect-ratio: 5 / 7; object-fit: contain; background: #eef0ec; }
.replay-card-copy { display: grid; gap: 5px; padding: 9px; }
.replay-card-copy strong { overflow-wrap: anywhere; font-size: 0.88rem; }
.replay-card-copy small { color: var(--muted); font-size: 0.72rem; overflow-wrap: anywhere; }
.replay-chosen-badge { justify-self: start; padding: 3px 7px; border-radius: 999px; background: var(--green); color: #fff; font-size: 0.68rem; font-weight: 750; }
.replay-taken-section { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); }
.replay-taken-section[hidden], #replay-taken-content[hidden] { display: none; }
.replay-taken-toggle { width: 100%; margin: 0; padding: 10px; }
.replay-taken-toggle:disabled { opacity: .55; cursor: not-allowed; }
.replay-taken-section h3 { margin: 14px 0 0; font-size: .95rem; }
.replay-card.is-taken { border-color: #cbd0cc; background: #f3f4f2; opacity: .8; }
.replay-card.is-taken .replay-card-image { filter: grayscale(.65); }
.replay-card.is-taken .replay-chosen-badge { background: #68716b; }
.replay-pick-location { background: var(--green-dark); }
.replay-image-dialog { position: relative; width: min(92vw, 540px); max-width: none; max-height: 92dvh; padding: 54px 16px 16px; overflow: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); color: #172624; }
.replay-image-dialog::backdrop { background: rgb(8 18 16 / 76%); }
.replay-image-dialog h2 { margin: 0 36px 10px 0; font-size: .96rem; overflow-wrap: anywhere; }
.replay-large-card-image { display: block; width: auto; max-width: 100%; max-height: calc(92dvh - 100px); margin: 0 auto; aspect-ratio: 5 / 7; object-fit: contain; border-radius: 8px; background: #e9ece8; }
.secondary-link { margin: 20px 0 0; text-align: center; }
.secondary-link a { color: var(--green-dark); font-weight: 700; }
@media (max-width: 619px) {
  .replay-card-copy { padding: 0; }
  .replay-card-copy strong, .replay-card-copy small, .replay-selected-badge { display: none; }
  .replay-pick-location { display: inline-block; margin: 0 8px 8px; }
  .replay-card-meta { margin: 8px; }
  .replay-selected-indicator { top: 6px; left: 6px; width: 36px; height: 36px; }
}
@media (min-width: 620px) {
  .replay-controls { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .replay-controls > .control, .replay-pick-control .control { padding: 8px 10px; font-size: .9rem; }
  .replay-pick-control { grid-template-columns: 36px minmax(0, 1fr) 36px; gap: 6px; }
  .replay-nav-button { min-width: 36px; }
  .replay-card-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
