@charset "UTF-8";
@layer base, layout, components, responsive;

@layer components {
  [data-theme] { --bottle-color: #a3e3d2; --bottle-dark: #184538; --bottle-glow: #4bba9829; }
  [data-theme="romantic"] { --bottle-color: #ffb9c8; --bottle-dark: #6b3049; --bottle-glow: #e27b9b29; }
  [data-theme="friendly"] { --bottle-color: #ffdb83; --bottle-dark: #655026; --bottle-glow: #ffdb8326; }
  [data-theme="jealous"] { --bottle-color: #bce886; --bottle-dark: #3b582d; --bottle-glow: #9cdc5029; }
  [data-theme="boastful"] { --bottle-color: #d8beff; --bottle-dark: #523d79; --bottle-glow: #ac8af129; }
  [data-theme="challenging"] { --bottle-color: #9cddff; --bottle-dark: #235479; --bottle-glow: #5cbdf129; }
  [data-theme="gloating"] { --bottle-color: #ffbb91; --bottle-dark: #733d30; --bottle-glow: #ed975629; }
  .winner-composer { padding: 18px 22px; margin: 0 0 20px; max-width: 860px; }
  .winner-composer summary { cursor: pointer; display: flex; align-items: center; gap: 14px; min-height: 44px; list-style: none; }
  .winner-composer summary::after { content: "+"; margin-left: auto; color: var(--gold); font-size: 1.5rem; }
  .winner-composer[open] summary::after { content: "−"; }
  .winner-composer summary::-webkit-details-marker { display: none; }
  .winner-composer summary small { display: block; color: var(--muted); font-size: .74rem; margin-top: 4px; }
  .winner-compose-mark { display: grid; place-items: center; width: 42px; height: 48px; color: var(--gold); border: 1px solid #bba06a66; border-radius: 45% 45% 8px 8px; background: #dfbc7110; font-size: 1.2rem; transform: rotate(-7deg); }
  .winner-compose-intro { margin: 20px 0; font-size: .9rem; }
  .winner-theme-row { display: grid; grid-template-columns: minmax(120px, 1fr) 1fr; align-items: center; gap: 20px; margin-bottom: 20px; }
  .winner-theme-preview { display: flex; align-items: center; gap: 14px; color: var(--bottle-color); font-size: .83rem; }
  .winner-theme-preview .bottle-emblem { width: 66px; flex-shrink: 0; }
  #winner-message-text { min-height: 118px; }
  .winner-compose-meta, .winner-compose-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
  .winner-compose-actions { justify-content: flex-start; margin: 18px 0 12px; }
  .winner-suggestions { display: grid; gap: 8px; margin: 4px 0 16px; }
  .bottle-suggestion { text-align: left; justify-content: flex-start; font-weight: 400; }
  .winner-unlock { margin-top: 18px; border: 1px solid #f4e6b6; box-shadow: 0 3px 20px #bddc8b1a; }
  .modal.bottle-modal, .modal.bottle-inbox-modal { width: min(650px, calc(100% - 24px)); max-height: calc(100dvh - 24px); overflow: auto; padding: 28px; }
  .modal.bottle-modal { position: relative; text-align: center; background: radial-gradient(ellipse at 50% 25%, var(--bottle-glow), transparent 58%), #14251f; border-color: var(--bottle-color); }
  .bottle-modal-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; text-align: left; }
  .bottle-modal-heading .eyebrow { color: var(--bottle-color, var(--gold)); }
  .bottle-modal-heading button { flex-shrink: 0; }
  .bottle-modal h2 { font-size: clamp(1.5rem, 4vw, 2.2rem); }
  #bottle-from { font-size: .8rem; overflow-wrap: anywhere; margin-top: 12px; }
  .bottle-scene { position: relative; height: 248px; transition: height .45s ease; isolation: isolate; }
  .bottle-art { position: relative; width: 260px; height: 250px; margin: auto; }
  .bottle-vessel { position: relative; width: 100%; height: 100%; z-index: 1; overflow: visible; }
  .bottle-shadow { fill: var(--bottle-color); opacity: .1; }
  .bottle-glass { fill: #b4ffe614; stroke: #a5dfd8; stroke-width: 2; }
  .bottle-water { fill: var(--bottle-color); opacity: .23; }
  .bottle-shine { fill: none; stroke: #effffc; stroke-linecap: round; stroke-width: 5; opacity: .5; }
  .bottle-scroll { fill: #f5ebcd; stroke: #c9b98d; stroke-width: 2; }
  .bottle-ink { fill: none; stroke: #827458; stroke-width: 2; }
  .bottle-cork { fill: #cda079; stroke: #754b33; stroke-width: 2; transform-box: fill-box; transform-origin: center; }
  .bottle-rim { fill: #34675a; stroke: #b5e2cc; stroke-width: 2; }
  .bottle-seal { position: absolute; left: 112px; top: 175px; width: 39px; height: 39px; z-index: 2; background: var(--bottle-dark); border: 1px solid var(--bottle-color); border-radius: 50%; transform: rotate(12deg); padding: 6px; color: var(--bottle-color); }
  .bottle-emblem { display: block; width: 100%; height: auto; fill: none; stroke: currentColor; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
  .bottle-emblem .theme-solid { fill: currentColor; fill-opacity: .16; }
  .bottle-emblem .theme-detail { stroke-width: 3; }
  .bottle-halo { position: absolute; left: 13px; top: 16px; width: 234px; height: 200px; color: var(--bottle-color); opacity: .07; transform: rotate(-12deg); }
  .is-opening .bottle-cork { animation: bottle-uncork .65s cubic-bezier(.2,.7,.2,1) forwards; }
  .is-opening .bottle-water { animation: bottle-wave .75s ease-in-out 2; transform-origin: center; }
  .is-opening .bottle-seal { animation: bottle-seal-away .55s ease-in forwards; }
  .is-revealed .bottle-scene { height: 115px; }
  .is-revealed .bottle-art { transform: scale(.46); transform-origin: top center; transition: transform .45s ease; }
  .bottle-letter { text-align: left; margin: 12px 0 20px; padding: clamp(22px, 4vw, 36px); color: #26382f; background: linear-gradient(135deg, #fff8e8, #ede2c7); border-radius: 4px 20px 4px 20px; box-shadow: 0 12px 36px #0004; border-top: 5px solid var(--bottle-color); }
  .is-revealed .bottle-letter { animation: bottle-letter-in .5s ease both; }
  .bottle-letter-stamp { display: block; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--bottle-dark); border-bottom: 1px solid #7466483b; padding-bottom: 16px; margin-bottom: 22px; }
  #bottle-letter-text { color: #26382f; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.1rem, 3.6vw, 1.4rem); line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
  .bottle-letter-signoff { display: block; color: #605e50; font-size: .7rem; margin-top: 26px; font-style: italic; }
  .bottle-particles { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
  .bottle-particle { position: absolute; left: calc(5% + var(--i) * 9%); top: 30%; width: 24px; color: var(--bottle-color); animation: bottle-confetti 1.8s ease-out both; animation-delay: calc(var(--i) * 25ms); }
  [data-theme="romantic"] .bottle-particle { animation-name: bottle-hearts; }
  [data-theme="friendly"] .bottle-particle { animation-name: bottle-sunrise; }
  [data-theme="jealous"] .bottle-particle { animation-name: bottle-raindrops; }
  [data-theme="boastful"] .bottle-particle { animation-name: bottle-crowns; }
  [data-theme="challenging"] .bottle-particle { animation-name: bottle-sparks; }
  .bottle-inbox-list { padding: 0; margin: 22px 0; list-style: none; display: grid; gap: 10px; }
  .bottle-inbox-item { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(115deg, var(--bottle-glow), transparent); }
  .bottle-inbox-icon { color: var(--bottle-color); }
  .bottle-inbox-copy { overflow-wrap: anywhere; }
  .bottle-inbox-copy p { margin-top: 5px; font-size: .75rem; }
  .bottle-inbox-copy .field-hint { margin-top: 4px; font-size: .65rem; }
  .bottle-inbox-empty { margin: 36px 0; text-align: center; }
  .bottle-inbox-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
  .bottle-inbox-footer p { flex: 1 1 200px; }
  #bottle-inbox-help { font-size: .84rem; line-height: 1.65; }
  @keyframes bottle-uncork { 20% { transform: rotate(-12deg) translateY(-4px); } 100% { transform: translate(32px, -80px) rotate(35deg); opacity: 0; } }
  @keyframes bottle-wave { 50% { transform: skewY(5deg) translateY(-3px); } }
  @keyframes bottle-seal-away { to { transform: translateY(20px) rotate(80deg); opacity: 0; } }
  @keyframes bottle-letter-in { from { transform: translateY(20px); opacity: 0; } }
  @keyframes bottle-confetti { from { transform: translateY(40px) rotate(-25deg); opacity: 0; } 25% { opacity: 1; } to { transform: translateY(-95px) rotate(130deg); opacity: 0; } }
  @keyframes bottle-hearts { from { transform: translateY(40px) scale(.5); opacity: 0; } 25% { opacity: 1; } to { transform: translateY(-110px) scale(1.3) rotate(-16deg); opacity: 0; } }
  @keyframes bottle-sunrise { from { transform: translateY(40px) rotate(-80deg); opacity: 0; } 30% { opacity: 1; } to { transform: translateY(-75px) rotate(80deg); opacity: 0; } }
  @keyframes bottle-raindrops { from { transform: translateY(-60px) scale(.7); opacity: 0; } 30% { opacity: 1; } to { transform: translateY(95px) scale(1.1); opacity: 0; } }
  @keyframes bottle-crowns { from { transform: translateY(50px) rotate(-20deg); opacity: 0; } 30% { opacity: 1; } to { transform: translateY(-80px) rotate(20deg) scale(1.3); opacity: 0; } }
  @keyframes bottle-sparks { from { transform: translate(-30px, 40px) scale(.3); opacity: 0; } 20% { opacity: 1; } to { transform: translate(20px, -85px) scale(1.3); opacity: 0; } }
}
@layer responsive {
  @media (max-width: 600px) {
    .winner-composer { padding: 14px; }
    .winner-theme-row { gap: 12px; }
    .winner-theme-preview { gap: 8px; font-size: .7rem; }
    .winner-theme-preview .bottle-emblem { width: 44px; }
    .modal.bottle-modal, .modal.bottle-inbox-modal { padding: 20px 16px; }
    .bottle-modal-heading { gap: 8px; }
    .bottle-modal-heading .eyebrow { font-size: .55rem; }
    .bottle-inbox-item { grid-template-columns: 34px minmax(0, 1fr); gap: 12px; }
    .bottle-inbox-item button { grid-column: 2; justify-self: start; }
    .bottle-inbox-modal h2 { font-size: 1.4rem; }
    #bottle-inbox-button { min-height: 44px; }
  }
  @media (prefers-reduced-motion: reduce) {
    .bottle-modal *, .bottle-modal *::before, .bottle-modal *::after { animation: none !important; transition: none !important; }
    .bottle-particles { display: none !important; }
    .is-opening .bottle-cork, .is-opening .bottle-seal { opacity: 0; }
  }
}

@layer base {
  :root {
    color-scheme: dark;
    --page: #0d1915;
    --panel: #17271f;
    --panel-raised: #1d3026;
    --table: #164b38;
    --text: #f2f2e9;
    --muted: #b3c4b7;
    --line: #354c3e;
    --accent: #d6ee98;
    --accent-ink: #183221;
    --gold: #e5c98e;
    --danger: #ffb6ad;
    --radius: 20px;
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    font-synthesis: none;
    line-height: 1.5;
    background: var(--page);
    color: var(--text);
  }
  * { box-sizing: border-box; }
  body { margin: 0; min-width: 280px; background: radial-gradient(ellipse at 12% 0%, #203b2c66, transparent 45%); }
  [hidden] { display: none !important; }
  [data-play-layout="hidden"] { display: none !important; }
  [data-play-layout="visible"][hidden] { display: var(--play-display) !important; visibility: hidden; }
  button, input, textarea, select { font: inherit; }
  button, a, input, textarea, select, [tabindex] { -webkit-tap-highlight-color: transparent; }
  button { cursor: pointer; }
  button:disabled { cursor: not-allowed; }
  a { color: inherit; }
  h1, h2, h3, p { margin: 0; }
  h1, h2, h3 { line-height: 1.16; text-wrap: balance; }
  h1 { font-size: clamp(2rem, 4.5vw, 3.35rem); letter-spacing: -.045em; font-weight: 700; }
  h2 { font-size: 1.25rem; letter-spacing: -.025em; font-weight: 650; }
  h3 { font-size: 1rem; }
  p { color: var(--muted); }
  :focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }
  input, textarea, select { width: 100%; border: 1px solid #66806c; background: #101e17; border-radius: 10px; padding: 12px 14px; color: var(--text); }
  input::placeholder, textarea::placeholder { color: #94aa9a; opacity: 1; }
  input:focus, textarea:focus, select:focus { border-color: var(--gold); }
  input:disabled, textarea:disabled, select:disabled { opacity: .65; }
  label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: 8px; }
  textarea { resize: vertical; min-height: 76px; max-height: 220px; }
  ::selection { color: var(--accent-ink); background: var(--accent); }
  .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
  .skip-link { position: fixed; top: 12px; left: 12px; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; background: var(--accent); color: var(--accent-ink); border-radius: 8px; z-index: 20; }
  .skip-link:focus-visible { width: auto; height: auto; padding: 12px 20px; margin: 0; overflow: visible; clip-path: none; }
}

@layer layout {
  .site-header { max-width: 1504px; padding: 26px 40px; margin: auto; display: flex; justify-content: space-between; align-items: center; gap: 20px; border-bottom: 1px solid var(--line); }
  .header-right { display: flex; align-items: center; justify-content: flex-end; gap: 22px; flex-wrap: wrap; }
  main { max-width: 1424px; margin: auto; padding: 32px 40px 0; }
  .welcome { min-height: min(720px, 75vh); display: grid; grid-template-columns: 1.2fr 1fr; align-items: center; gap: 8%; padding: 28px 0 60px; }
  .welcome-copy h1 { font-size: clamp(3rem, 5.8vw, 5rem); margin: 22px 0; }
  .welcome-copy .lead { max-width: 440px; font-size: 1.1rem; line-height: 1.75; }
  .guest-panel { max-width: 450px; padding: 36px; justify-self: end; }
  .guest-panel h2 { font-size: 1.85rem; margin: 12px 0; }
  .guest-panel form { margin-top: 26px; }
  .guest-panel .privacy-note { margin-top: 22px; font-size: .78rem; line-height: 1.6; }
  .session-loading { max-width: 640px; min-height: 60vh; display: flex; flex-direction: column; justify-content: center; gap: 18px; margin: auto; text-align: center; align-items: center; }
  .section-heading { display: flex; gap: 24px; align-items: center; justify-content: space-between; }
  .discovery-heading { padding: 26px 0 40px; }
  .discovery-heading h1 { margin: 12px 0 16px; }
  .discovery-heading p { max-width: 670px; }
  .section-stamp { flex-shrink: 0; font-size: .8rem; font-weight: 800; letter-spacing: .13em; line-height: 1.6; color: var(--gold); border-left: 2px solid var(--gold); padding-left: 20px; }
  .discovery-layout { display: grid; grid-template-columns: minmax(250px, .85fr) minmax(0, 1.7fr); gap: 32px; min-height: 440px; }
  .create-panel { padding: 30px; align-self: start; }
  .create-panel h2 { margin: 10px 0 14px; font-size: 1.65rem; }
  .create-panel form { margin-top: 26px; }
  .tables-heading { margin: 6px 0 20px; }
  .tables-heading p { margin-top: 8px; font-size: .9rem; }
  .room-list { display: grid; gap: 12px; }
  .room-heading { display: flex; align-items: center; justify-content: space-between; gap: 22px; margin: 8px 0 28px; }
  .room-heading h1 { font-size: clamp(1.8rem, 3.5vw, 2.65rem); margin: 6px 0 8px; overflow-wrap: anywhere; }
  .room-heading p { font-size: .9rem; }
  .room-heading-actions { display: flex; gap: 12px; flex-shrink: 0; }
  .room-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
  .play-column, .social-column { display: grid; gap: 20px; min-width: 0; }
  .site-footer { display: flex; gap: 16px; justify-content: space-between; border-top: 1px solid var(--line); padding: 24px 0 28px; margin-top: 48px; color: #a2b7a8; font-size: .75rem; }
  .diagnostics-control { flex: 0 1 540px; min-width: 0; line-height: 1.6; }
  .diagnostics-control p { margin: 4px 0; overflow-wrap: anywhere; }
  .diagnostics-toggle { display: flex; align-items: center; gap: 10px; min-height: 44px; width: fit-content; cursor: pointer; color: var(--text); font-weight: 700; }
  .diagnostics-toggle input { width: 18px; height: 18px; margin: 0; padding: 0; accent-color: var(--accent); flex: none; }
  #diagnostics-status { color: var(--text); }
}

@layer components {
  .brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 850; font-size: 1.9rem; letter-spacing: -.055em; line-height: 1; }
  .brand-symbol { border: 1px solid var(--accent); color: var(--accent); border-radius: 7px; display: grid; place-items: center; width: 33px; height: 43px; font-size: 1.25rem; transform: rotate(-10deg); }
  .brand-dot { color: var(--gold); }
  .eyebrow { font-size: .68rem; text-transform: uppercase; letter-spacing: .19em; font-weight: 700; color: var(--gold); }
  .tiny-star { margin-right: 8px; }
  .button { display: inline-flex; justify-content: center; align-items: center; gap: 12px; border: 1px solid transparent; border-radius: 10px; min-height: 44px; padding: 11px 18px; font-size: .88rem; font-weight: 650; text-decoration: none; line-height: 1.3; transition: background .15s, border-color .15s, transform .15s; }
  .button:hover:not(:disabled) { transform: translateY(-1px); }
  .button:active:not(:disabled) { transform: translateY(0); }
  .button-primary { background: var(--accent); color: var(--accent-ink); }
  .button-primary:hover:not(:disabled) { background: #e6ffad; }
  .button-secondary { border-color: #607465; background: #1b2d22; color: var(--text); }
  .button-secondary:hover:not(:disabled) { background: #304836; border-color: #96b09a; }
  .button-quiet { color: var(--muted); background: transparent; padding-inline: 8px; }
  .button-quiet:hover:not(:disabled) { color: var(--text); background: #ffffff09; }
  .button-danger { color: #36140e; background: var(--danger); }
  .button-small { font-size: .78rem; padding: 9px 13px; min-height: 40px; }
  .button-full { width: 100%; margin-top: 22px; }
  .button:disabled { opacity: .46; }
  .guidance-off [data-guidance] { display: none !important; }
  #guidance-toggle[aria-pressed="false"] { color: var(--muted); background: transparent; }
  #guidance-toggle > span { font-size: 1.15rem; }
  #guidance-storage-note { font-size: .8rem; color: var(--text); }
  .panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
  .connection-badge { font-size: .73rem; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
  .status-dot { width: 7px; height: 7px; border-radius: 100%; background: var(--gold); flex-shrink: 0; }
  .connection-badge[data-state="ready"] .status-dot { background: var(--accent); box-shadow: 0 0 0 4px #d6ee9810; }
  .connection-badge[data-state="expired"] .status-dot, .connection-badge[data-state="replaced"] .status-dot { background: var(--danger); }
  .identity { display: flex; align-items: center; gap: 8px; border-left: 1px solid var(--line); padding-left: 14px; font-size: .85rem; }
  .identity-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .notice, .connection-notice { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; border-radius: 10px; background: #293b26; border: 1px solid #7c9961; margin-bottom: 20px; }
  .notice p, .connection-notice p { font-size: .88rem; color: var(--text); overflow-wrap: anywhere; }
  .notice[data-tone="error"] { background: #392923; border-color: #d79a86; }
  .connection-notice { background: #332f20; border-color: #9f9060; }
  .notice button, .connection-notice button { flex-shrink: 0; }
  .field-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; font-size: .68rem; color: var(--muted); }
  .field-meta span:last-child { white-space: nowrap; }
  .field-hint { font-size: .72rem; color: var(--muted); display: block; margin-top: 8px; line-height: 1.5; }
  .field-error, .is-over-limit { color: var(--danger); }
  .field-error { font-size: .83rem; margin-top: 12px; }
  .welcome-points { display: flex; flex-wrap: wrap; gap: 9px 20px; padding: 0; list-style: none; font-size: .77rem; color: var(--muted); margin: 20px 0 0; }
  .welcome-points li::before { content: "✓"; margin-right: 6px; color: var(--accent); }
  .welcome-cards { display: flex; gap: 12px; padding: 26px 10px 6px; }
  .welcome-cards .playing-card { width: 80px; height: 113px; box-shadow: 0 8px 20px #0003; }
  .welcome-cards .playing-card:nth-child(1) { transform: rotate(-12deg); }
  .welcome-cards .playing-card:nth-child(2) { transform: translateY(-5px); }
  .welcome-cards .playing-card:nth-child(3) { transform: rotate(12deg); }
  .mini-rule { border-top: 1px solid var(--line); margin-top: 28px; padding-top: 24px; display: flex; gap: 14px; }
  .mini-rule-icon { font-size: 2rem; color: var(--gold); }
  .mini-rule p { font-size: .8rem; }
  .mini-rule strong { display: block; margin-bottom: 4px; color: var(--text); }
  .count-pill { display: inline-block; border-radius: 6px; font-size: .72rem; padding: 3px 7px; margin-left: 5px; background: #ffffff0a; border: 1px solid #ffffff13; color: var(--muted); vertical-align: middle; font-variant-numeric: tabular-nums; }
  .room-item { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: flex; gap: 18px; align-items: center; }
  .room-item:hover { border-color: #6b8168; }
  .room-mark { display: grid; place-items: center; width: 45px; height: 52px; border: 1px solid #67855c; border-radius: 8px; color: var(--accent); font-size: 1.5rem; background: #2c4125; flex-shrink: 0; }
  .room-description { flex: 1; min-width: 0; }
  .room-description h3 { overflow-wrap: anywhere; margin-bottom: 7px; font-size: 1.04rem; }
  .room-description p { font-size: .77rem; }
  .room-description .phase-tag { color: var(--accent); font-weight: 600; }
  .room-item .button { flex-shrink: 0; }
  .empty-state { min-height: 265px; display: grid; place-content: center; text-align: center; padding: 24px; border: 1px dashed #56705d; border-radius: 16px; }
  .empty-symbol { font-size: 2.8rem; color: var(--gold); }
  .empty-state h3 { margin: 10px 0; }
  .empty-state p { font-size: .85rem; }
  .table-panel { background: radial-gradient(ellipse at 50% 45%, #215c43, #143f30 70%); border: 1px solid #4b7256; border-radius: 24px; padding: 23px 26px; min-height: 388px; position: relative; overflow: hidden; box-shadow: inset 0 0 0 7px #0b25183b, 0 8px 20px #00000012; }
  .table-topline { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
  .table-topline h2 { text-transform: uppercase; letter-spacing: .13em; font-size: .7rem; font-weight: 600; color: #c2d7c8; }
  .spectator-badge, .chat-label { text-transform: uppercase; letter-spacing: .1em; font-size: .6rem; font-weight: 650; color: var(--gold); }
  .spectator-badge { padding: 5px 8px; background: #0c2c2080; border: 1px solid #91ad70; border-radius: 5px; margin-left: auto; }
  .turn-clock { font-size: .86rem; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 6px; background: #0d2b20; padding: 4px 10px; border: 1px solid #6a9071; border-radius: 7px; }
  .turn-clock.is-urgent { border-color: #ffb6ad; color: #ffd3ce; background: #512921; }
  .clock-icon { font-size: 1.1rem; }
  .lobby-message { text-align: center; max-width: 470px; margin: 22px auto 24px; }
  .table-monogram { color: #bbd598; display: block; font-size: 4.8rem; font-weight: 850; letter-spacing: -.1em; line-height: 1.3; opacity: .65; }
  .lobby-message h2 { font-size: 1.55rem; margin: 12px 0; }
  .lobby-message p { font-size: .87rem; color: #cfdfd2; }
  .table-cards { display: flex; justify-content: center; align-items: center; gap: 25px; margin: 24px 0 12px; }
  .card-pile { display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 110px; }
  .pile-label { font-size: .65rem; text-transform: uppercase; letter-spacing: .16em; color: #c5d9cd; }
  .market-count { font-variant-numeric: tabular-nums; letter-spacing: 0; padding: 2px 5px; margin-left: 3px; border: 1px solid #769377; border-radius: 4px; color: var(--accent); }
  .pile-caption { font-size: .72rem; color: #d5e4d9; text-align: center; max-width: 140px; }
  .table-divider { color: #8baa85; letter-spacing: .16em; }
  .playing-card, .presentation-card-face { width: 100px; height: 142px; border-radius: 10px; background: #f7f3e6; color: #1b4c37; border: 2px solid #e5dfca; position: relative; flex-shrink: 0; display: flex; align-items: center; justify-content: center; padding: 0; box-shadow: 0 3px 0 #0b231f66, 0 7px 15px #0b231f30; }
  .card-corner { position: absolute; top: 5px; left: 7px; display: flex; flex-direction: column; align-items: center; gap: 1px; }
  .card-number { font-weight: 800; font-size: 1.1rem; line-height: 1.05; }
  .card-corner .shape-svg { width: 10px; height: 10px; }
  .card-corner-bottom { inset: auto 7px 5px auto; transform: rotate(180deg); }
  .shape-svg { display: block; width: 44px; height: 44px; fill: currentColor; }
  .card-center { display: grid; justify-items: center; gap: 5px; }
  .card-center-number { font-size: .8rem; font-weight: 800; }
  .card-wild { background: #d6e5ba; color: #204c32; border-color: #e5eed5; }
  .wild-word { font-size: 1.17rem; font-weight: 900; letter-spacing: -.065em; border-block: 1px solid currentColor; padding: 5px 0; transform: rotate(-12deg); }
  .card-back { background: #244631; color: var(--gold); border-color: #c8bd8f; box-shadow: 3px 3px 0 #d8d0b4, 5px 5px 0 #7c8c65, 0 9px 15px #09281d99; }
  .back-frame { border: 1px solid #a6b57b; border-radius: 4px; margin: 6px; height: calc(100% - 12px); width: calc(100% - 12px); display: flex; flex-direction: column; align-items: center; justify-content: center; background: repeating-linear-gradient(45deg, #d5e3a605 0 2px, transparent 2px 7px); }
  .back-frame > span:first-child { font-weight: 900; font-size: 1.15rem; letter-spacing: -.06em; }
  .back-diamond { font-size: 2.4rem; line-height: 1.2; }
  .back-caption { font-size: .36rem; letter-spacing: .15em; }
  #draw-card:hover:not(:disabled) { border-color: var(--accent); background: #335f3f; transform: translateY(-3px); }
  #draw-card:disabled { cursor: default; filter: saturate(.6); }
  .shape-request { display: grid; justify-items: center; gap: 8px; color: #f0ffd0; margin: 18px auto 12px; padding: 15px; max-width: 460px; border: 2px solid var(--accent); border-radius: 14px; background: #0b2b20; box-shadow: 0 0 25px #d6ee9829; text-align: center; }
  .request-kicker { color: var(--gold); font-size: .72rem; text-transform: uppercase; font-weight: 800; letter-spacing: .16em; }
  #requested-shape-display { display: flex; align-items: center; gap: 12px; font-size: clamp(1.25rem, 3vw, 1.9rem); line-height: 1.2; }
  .shape-request .shape-svg { width: 43px; height: 43px; flex-shrink: 0; }
  .shape-request > span:last-child { font-size: .75rem; color: #d9eacb; }
  .debt-display { font-weight: 800; color: #ffe5ad !important; border: 1px solid var(--gold); padding: 7px; border-radius: 7px; background: #302d17; }
  .discard-dropzone { padding: 10px 8px; border: 2px dashed #b8d59680; border-radius: 14px; transition: background .15s, outline-color .15s; }
  .discard-dropzone .pile-label { letter-spacing: .06em; font-size: .6rem; }
  .discard-dropzone[data-drop-state="available"] { border-color: var(--gold); background: #d6ee9810; }
  .discard-dropzone[data-drop-state="valid"] { border-color: var(--accent); outline: 4px solid var(--accent); background: #d6ee9830; }
  .discard-dropzone[data-drop-state="invalid"] { border-color: var(--danger); outline: 4px dashed var(--danger); background: #783b3490; }
  .drop-feedback { font-size: .8rem; color: var(--text); text-align: center; padding: 9px; background: #0d2b20; border: 1px solid var(--gold); border-radius: 8px; margin: 12px 0; }
  #top-card { position: relative; }
  #top-card.is-awaiting-landing > :first-child { visibility: hidden; }
  #top-card > .discard-before { position: absolute; inset: 0; pointer-events: none; }
  .whot-announcement { position: absolute; top: 64px; inset-inline: 6%; z-index: 5; display: grid; place-content: center; justify-items: center; gap: 18px; min-height: 225px; padding: 28px 18px; border: 3px solid #fff4c4; border-radius: 24px; background: #e0efb9f5; color: #123b27; box-shadow: 0 0 0 10px #e5c98e45, 0 0 75px #d6ee98b0, 0 18px 35px #05150bcc; pointer-events: none; text-align: center; overflow-wrap: anywhere; animation: whot-impact-in 650ms cubic-bezier(.2,.8,.2,1) both; }
  .whot-announcement::before { content: ""; position: absolute; inset: -15px; border: 5px solid #f7ffd3; border-radius: 30px; opacity: 0; animation: whot-aura 950ms ease-out; pointer-events: none; }
  .whot-impact { position: absolute; inset: 0; display: grid; place-items: center; font-size: 170px; line-height: 1; font-weight: 950; opacity: .14; letter-spacing: -.12em; transform: rotate(-12deg); }
  .whot-title { z-index: 1; font-size: clamp(1.15rem, 3vw, 1.65rem); }
  .whot-callout { z-index: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; font-size: clamp(1.4rem, 3.5vw, 2.5rem); font-weight: 900; line-height: 1.15; }
  .whot-callout .shape-svg { width: 64px; height: 64px; flex-shrink: 0; }
  @keyframes whot-impact-in { from { transform: scale(.72) rotate(-5deg); opacity: 0; } 65% { transform: scale(1.035) rotate(1deg); opacity: 1; } to { transform: scale(1) rotate(0); opacity: 1; } }
  @keyframes whot-aura { from { transform: scale(.9); opacity: .85; } to { transform: scale(1.22); opacity: 0; } }
  .turn-summary { text-align: center; margin: 17px auto 0; max-width: 490px; }
  .turn-summary strong { font-size: 1rem; color: var(--text); }
  .turn-summary p { color: #d5e4d9; font-size: .79rem; margin-top: 5px; }
  .market-help { color: #e1dda9; font-size: .73rem; text-align: center; max-width: 490px; margin: 12px auto 0; }
  .last-event { text-align: center; font-size: .72rem; color: #b9cfc1; margin-top: 12px; overflow-wrap: anywhere; }
  .game-result { text-align: center; margin-top: 22px; padding: 25px 20px; border: 1px solid var(--gold); border-radius: 16px; background: linear-gradient(135deg, #263d25, #172f24); box-shadow: inset 0 1px #fff2; }
  .game-result h2 { margin: 10px 0 6px; font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 850; color: #ffe2a4; overflow-wrap: anywhere; }
  #result-tagline { display: block; color: #f8eacb; font-size: .88rem; letter-spacing: .08em; }
  .game-result p { margin-top: 12px; font-size: .86rem; color: #d5e4d9; }
  .game-result[data-outcome="winner"] { border-width: 2px; background: radial-gradient(ellipse at top, #546233, #1b3524 75%); }
  .game-result[data-outcome="loser"] #result-tagline { color: #ffd2c3; }
  .game-result[data-outcome="neutral"] { border-color: #b3c4b7; }
  .game-result[data-outcome="neutral"] h2 { color: var(--text); }
  .game-result + .lobby-message { margin-top: 0; }
  .score-table { width: 100%; table-layout: fixed; border-collapse: collapse; margin-top: 20px; font-size: .85rem; text-align: start; }
  .score-table caption { color: #f8eacb; font-weight: 750; padding-bottom: 10px; text-align: start; }
  .score-table th, .score-table td { padding: 10px 6px; border-bottom: 1px solid #b3c4b755; overflow-wrap: anywhere; }
  .score-table th:first-child { width: 58%; }
  .score-table td, .score-table thead th:not(:first-child) { text-align: end; font-variant-numeric: tabular-nums; }
  .score-table tr[data-winner="true"] { background: #d6ee9818; color: #ffe2a4; }
  .score-winner { display: block; font-size: .68rem; font-weight: 750; }
  .victory-announcement { position: absolute; z-index: 6; top: 65px; inset-inline: 5%; display: grid; justify-items: center; align-content: center; gap: 10px; min-height: 290px; padding: 26px 22px; border: 3px solid #ffe8ab; border-radius: 25px; background: radial-gradient(ellipse at top, #fff0b8, #eed48b 66%, #d4b56d); color: #203b28; box-shadow: 0 0 0 9px #e5c98e35, 0 16px 50px #05180be6, inset 0 0 0 6px #fff4d180; text-align: center; pointer-events: none; overflow-wrap: anywhere; }
  .victory-emblem { display: grid; place-items: center; width: 70px; height: 62px; font-size: 2.65rem; line-height: 1; font-weight: 950; letter-spacing: -.12em; padding-right: 8px; background: #244b34; color: #ffdf91; clip-path: polygon(0 10%, 22% 25%, 50% 0, 78% 25%, 100% 10%, 89% 83%, 50% 100%, 11% 83%); }
  .victory-title { max-width: 100%; font-size: clamp(2.15rem, 5vw, 4.2rem); letter-spacing: -.055em; font-weight: 950; line-height: 1.03; text-wrap: balance; }
  .victory-tagline { font-size: clamp(.9rem, 2.3vw, 1.45rem); font-weight: 900; letter-spacing: .08em; border-block: 1px solid #49613166; padding: 7px 14px; }
  .victory-detail { max-width: 390px; font-size: .82rem; font-weight: 550; line-height: 1.55; }
  .victory-announcement[data-outcome="loser"] .victory-tagline { color: #74382a; }
  .victory-announcement[data-outcome="neutral"] { background: #e3e8d9; border-color: #bdcfba; }
  .celebration-overlay { position: fixed; inset: 0; z-index: 90; overflow: hidden; pointer-events: none; contain: strict; }
  .confetti-piece { position: absolute; top: 0; left: 0; width: 10px; height: 17px; background: var(--party-color); border-radius: 2px; box-shadow: inset -3px -2px #0002; will-change: transform; }
  .confetti-piece:nth-child(3n) { width: 11px; height: 11px; border-radius: 50%; }
  .confetti-piece:nth-child(4n) { width: 7px; height: 23px; border-radius: 50% 0; }
  .confetti-piece:nth-child(5n) { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); width: 17px; height: 17px; }
  .celebration-balloon { position: absolute; top: 0; left: 0; width: clamp(42px, 5vw, 72px); height: clamp(56px, 6.6vw, 94px); border-radius: 50% 50% 46% 46%; background: radial-gradient(ellipse at 28% 24%, #fff9 0, #fff3 12%, transparent 34%), radial-gradient(ellipse at 35% 32%, transparent 35%, #0003 100%), var(--party-color); box-shadow: inset -5px -7px 13px #0002, 0 4px 12px #0002; transform-origin: 50% 110%; will-change: transform; }
  .celebration-balloon::before { content: ""; position: absolute; top: calc(100% - 1px); left: calc(50% - 5px); width: 10px; height: 8px; background: var(--party-color); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
  .celebration-balloon::after { content: ""; position: absolute; top: calc(100% + 6px); left: 50%; width: 15px; height: 90px; border-left: 1px solid #fff9; border-bottom: 1px solid #fff6; border-radius: 0 0 0 80%; transform: rotate(-8deg); }
  .near-win-announcement { margin: 16px auto 0; padding: 12px 15px; border: 1px solid #f4d383; border-left-width: 5px; border-radius: 10px; background: linear-gradient(110deg, #f5dfa4, #dbeab5); color: #253b23; box-shadow: 0 5px 18px #082a1b40; animation: table-call-in 300ms ease-out both; }
  .near-win-kicker { display: block; font-size: .59rem; font-weight: 900; letter-spacing: .17em; margin-bottom: 3px; color: #486039; }
  .near-win-announcement p { font-size: .86rem; line-height: 1.6; color: #253b23; overflow-wrap: anywhere; }
  .near-win-announcement bdi { font-weight: 800; }
  .near-win-announcement strong { white-space: nowrap; font-size: .87rem; }
  .near-win-announcement p[data-card-count="1"] strong { color: #733a1b; }
  @keyframes table-call-in { from { transform: translateY(-8px); opacity: .25; } to { transform: translateY(0); opacity: 1; } }
  .hand-panel { padding: 22px; }
  .hand-heading { display: flex; gap: 12px; align-items: start; justify-content: space-between; margin-bottom: 20px; }
  .hand-heading h2 { font-size: 1rem; }
  .hand-heading p { font-size: .76rem; margin-top: 7px; }
  .pending-label { font-size: .73rem; color: var(--gold); max-width: 145px; text-align: right; }
  .hand { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; padding: 8px 0 5px; }
  .hand .playing-card, .hand .presentation-card-face { width: 82px; height: 117px; transition: transform .15s, box-shadow .15s, border-color .15s; }
  .hand .shape-svg { width: 34px; height: 34px; }
  .hand .card-corner .shape-svg { width: 8px; height: 8px; }
  .hand .card-number { font-size: .95rem; }
  .hand .card-center-number { font-size: .7rem; }
  .hand .wild-word { font-size: 1rem; }
  .hand .playing-card:disabled { filter: saturate(.4); background: #d1d4c7; color: #496150; border-color: #a7b5a4; box-shadow: 0 3px 0 #07190e55; }
  .hand .playing-card.is-playable { border-color: var(--accent); box-shadow: 0 0 0 2px #c9e79c55, 0 5px 8px #0003; }
  .hand .playing-card:hover:not(:disabled), .hand .playing-card:focus-visible:not(:disabled) { transform: translateY(-8px); box-shadow: 0 0 0 2px var(--accent), 0 12px 18px #0004; }
  .hand-empty { text-align: center; padding: 12px 0 20px; font-size: .84rem; }
  .hand-order-help { font-size: .72rem; line-height: 1.65; margin: -4px 0 14px; color: var(--muted); }
  .stack-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 12px; border: 1px solid #789462; border-radius: 11px; background: #213822; margin-bottom: 18px; }
  #stack-preview { flex: 1 1 220px; color: #e1eccd; font-size: .8rem; }
  .stack-actions { display: flex; flex-wrap: wrap; gap: 8px; }
  .hand-stack-toggle { min-height: 38px; padding: 5px 2px; font-size: .65rem; border: 1px solid #89a976; border-radius: 7px; background: #132e21; color: #def3b9; }
  .hand-stack-toggle:hover:not(:disabled), .hand-stack-toggle[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
  .hand-card.is-stack-selected { outline: 3px solid var(--gold); outline-offset: 4px; background: #e5c98e25; }
  .hand-card.is-stack-eligible .hand-stack-toggle { outline: 2px dashed var(--accent); outline-offset: 2px; }
  .hand-card { display: flex; flex-direction: column; align-items: stretch; gap: 9px; border-radius: 9px; touch-action: pan-y; }
  .hand-card.is-dragging { opacity: .38; outline: 2px dashed var(--gold); outline-offset: 4px; }
  .hand-card > .playing-card { user-select: none; touch-action: pan-y; }
  .hand-card > .playing-card:disabled { pointer-events: none; }
  .hand-card.is-arriving-card { visibility: hidden; pointer-events: none; }
  .is-departing-card { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; pointer-events: none; user-select: none; }
  .is-departing-card::after { content: "Queued"; margin-top: 12px; font-size: .65rem; color: var(--gold); }
  .is-departing-card[data-lifted="true"] { visibility: hidden; }
  [data-play-layout="visible"] { height: var(--play-height) !important; min-height: var(--play-height) !important; max-height: var(--play-height) !important; overflow: hidden; }
  .hand-reorder-handle { padding: 4px 2px; min-height: 38px; border: 1px solid #66806c; border-radius: 7px; color: var(--text); background: #243c2c; font-size: .65rem; cursor: grab; touch-action: none; user-select: none; }
  .hand-reorder-handle:hover, .hand-reorder-handle[aria-pressed="true"] { background: #405535; border-color: var(--gold); }
  .hand-reorder-handle:active { cursor: grabbing; }
  .hand-drag-ghost.playing-card { position: fixed; top: 0; left: 0; width: 100px; height: 142px; z-index: 110; pointer-events: none; transform-origin: top left; box-shadow: 0 15px 24px #0008; }
  .table-motion-overlay { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 80; }
  .card-flight.playing-card { position: absolute; top: 0; left: 0; width: 76px; height: 108px; pointer-events: none; transform-origin: center; box-shadow: 0 13px 22px #0008, 0 0 0 2px #e5c98e; will-change: transform; }
  .card-flight .shape-svg { width: 30px; height: 30px; }
  .card-flight .card-corner .shape-svg { width: 8px; height: 8px; }
  .card-flight .card-number { font-size: .85rem; }
  .card-flight .wild-word { font-size: 1rem; }
  .flight-count { position: absolute; right: -10px; top: -13px; background: var(--accent); color: var(--accent-ink); border: 2px solid #183221; border-radius: 30px; padding: 3px 9px; font-size: 1rem; font-weight: 800; }
  .card-flight[data-impact="slam"] { box-shadow: 0 25px 35px #0009, 0 0 0 3px #ffe9a2, 0 0 35px #ffe2a777; }
  .card-impact { position: absolute; width: 135px; height: 135px; border: 5px solid #f3d18d; border-radius: 50%; box-shadow: 0 0 22px #f3d18d88, inset 0 0 15px #f3d18d55; pointer-events: none; }
  .card-impact[data-impact="slam"] { width: 175px; height: 175px; border: 9px double #fff0b6; box-shadow: 0 0 0 12px #f9df8544, 0 0 45px #ffe298bb; }
  .card-impact strong { display: block; position: absolute; top: 72%; left: 50%; transform: translate(-50%, 0) rotate(-8deg); color: #223b25; background: #ffe7a0; border: 2px solid #a57a34; border-radius: 6px; padding: 4px 9px; white-space: nowrap; font-size: 1.05rem; font-weight: 950; letter-spacing: -.035em; }
  .motion-summary { margin: 16px auto 0; padding: 10px 12px; border: 1px solid var(--gold); border-radius: 9px; background: #102b22; color: #f2e6c7; font-size: .83rem; text-align: center; overflow-wrap: anywhere; }
  .motion-highlight { outline: 3px solid var(--gold); outline-offset: 5px; border-radius: 7px; }
  .member.is-current .member-avatar { border: 2px solid var(--accent); color: var(--accent); box-shadow: 0 0 0 3px #d6ee9826; }
  .member.is-current .member-meta { color: var(--accent); font-weight: 650; }
  .member.is-near-win .member-cards { color: var(--gold); font-weight: 800; }
  .member.is-near-win { border-left-color: var(--gold); }
  .near-win-badge { display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; padding: 4px 7px; border: 1px solid #c5dfa0; border-radius: 6px; color: #e1f3c1; background: #324929; font-size: .59rem; line-height: 1.35; letter-spacing: .025em; font-weight: 850; white-space: nowrap; }
  .near-win-badge::before { content: "2"; display: grid; place-items: center; width: 13px; height: 16px; border: 1px solid currentColor; border-radius: 2px; font-size: .61rem; font-weight: 950; transform: rotate(-9deg); }
  .near-win-badge[data-card-count="1"] { color: #3c2918; background: linear-gradient(130deg, #ffe6a9, #f0c477); border-color: #fff0c8; box-shadow: 0 2px 10px #edc57822; }
  .near-win-badge[data-card-count="1"]::before { content: "1"; transform: rotate(8deg); }
  .visibility-options { border: 0; padding: 0; margin: 20px 0 0; display: flex; flex-wrap: wrap; gap: 10px 20px; }
  .visibility-options legend { font-size: .875rem; font-weight: 600; margin-bottom: 10px; }
  .visibility-options label { display: inline-flex; align-items: center; gap: 7px; margin: 0; font-size: .8rem; min-height: 36px; }
  .visibility-options input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
  .turn-timeout-fields { margin-top: 20px; }
  .custom-turn-fields { margin-top: 14px; }
  .room-settings { padding: 18px 22px; margin-bottom: 24px; }
  .room-settings summary { cursor: pointer; min-height: 32px; line-height: 1.8; }
  .room-settings summary::marker { color: var(--accent); }
  .room-settings summary h2 { display: inline; font-size: 1.1rem; }
  #room-settings-summary { margin-left: 12px; color: var(--muted); font-size: .8rem; }
  #room-settings-current { color: var(--text); font-size: .85rem; margin-top: 12px; }
  .room-settings .turn-timeout-fields { max-width: 380px; }
  .room-settings-actions { margin-top: 16px; }
  .private-join-panel { padding: 24px; margin-top: 24px; }
  .private-join-panel > p, .host-invite-panel p { font-size: .8rem; margin-top: 10px; }
  .private-join-panel form { margin-top: 20px; }
  .private-join-panel input + label { margin-top: 16px; }
  .invite-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; margin-bottom: 24px; border: 1px solid var(--gold); border-radius: 12px; background: #303623; }
  .invite-banner p { color: var(--text); font-size: .86rem; overflow-wrap: anywhere; }
  .invite-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
  .invite-banner .invite-actions { margin: 0; flex-shrink: 0; }
  .host-invite-panel { padding: 22px; margin-bottom: 24px; }
  .host-invite-panel h2 { font-size: 1.1rem; }
  .host-invite-panel summary { cursor: pointer; min-height: 32px; line-height: 1.8; }
  .host-invite-panel summary h2 { display: inline; }
  .host-invite-panel summary::marker { color: var(--accent); }
  .host-invite-panel summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; border-radius: 4px; }
  .host-invite-panel details[open] summary { margin-bottom: 10px; }
  .invite-fields { display: grid; grid-template-columns: minmax(180px, .55fr) minmax(0, 1fr); gap: 16px; margin-top: 18px; }
  .invite-fields input { font-size: .8rem; }
  #invite-code, #private-passcode { letter-spacing: .09em; }
  .panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .panel-heading h2 { font-size: 1rem; }
  .people-panel { padding: 20px; }
  .members { margin: 18px 0 8px; padding: 0; list-style: none; display: grid; gap: 13px; max-height: 340px; overflow-y: auto; scrollbar-color: #688367 transparent; }
  .member { display: flex; align-items: center; gap: 10px; border-left: 3px solid transparent; padding: 3px 0 3px 7px; }
  .member.is-current { border-left-color: var(--accent); background: linear-gradient(90deg, #d6ee980c, transparent); }
  .member-avatar { background: #354b35; border: 1px solid #728164; border-radius: 50%; width: 32px; height: 32px; display: grid; place-items: center; font-size: .72rem; font-weight: 750; color: #e6e9d5; flex-shrink: 0; }
  .member.is-disconnected .member-avatar { background: #383c34; color: #b9bfb4; border-style: dashed; }
  .member-info { min-width: 0; flex: 1; }
  .member-name { font-size: .83rem; font-weight: 600; overflow-wrap: anywhere; color: var(--text); }
  .member-meta { font-size: .66rem; color: #b8c9bc; margin-top: 1px; }
  .member-cards { display: inline-flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; font-size: .76rem; color: #cad4c0; white-space: nowrap; }
  .member-cards::before { content: ""; width: 10px; height: 14px; border: 1px solid #a4b993; border-radius: 2px; box-shadow: 2px 2px #17271f, 3px 3px #a4b993; margin-right: 3px; }
  .member-cards.is-spectator::before { display: none; }
  .member-cards.is-spectator { font-size: .64rem; color: var(--gold); }
  .chat-panel { padding: 20px 0 0; overflow: hidden; }
  .chat-panel .panel-heading, .chat-intro { padding-inline: 20px; }
  .chat-intro { font-size: .68rem; margin: 9px 0 0; }
  .chat-log { height: 275px; overflow-y: auto; padding: 18px 20px; overscroll-behavior: contain; scrollbar-color: #688367 transparent; overflow-wrap: anywhere; }
  .chat-empty { text-align: center; padding: 65px 0; font-size: .79rem; }
  .chat-message + .chat-message { margin-top: 16px; }
  .message-heading { display: flex; gap: 8px; align-items: baseline; font-size: .7rem; }
  .message-author { color: var(--gold); font-weight: 650; overflow-wrap: anywhere; }
  .message-time { color: #a0b7a8; font-size: .6rem; flex-shrink: 0; }
  .message-text { font-size: .8rem; color: #e1e9de; white-space: pre-wrap; margin-top: 4px; line-height: 1.6; overflow-wrap: anywhere; }
  .chat-message.is-self .message-author { color: var(--accent); }
  .chat-form { padding: 16px 20px 20px; border-top: 1px solid var(--line); }
  .chat-form label { font-size: .7rem; }
  .chat-form textarea { font-size: .8rem; min-height: 70px; padding: 10px; }
  .chat-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
  #chat-count { font-size: .63rem; font-variant-numeric: tabular-nums; color: var(--muted); }
  #chat-count.is-over-limit { color: var(--danger); }
  .chat-form .field-hint { font-size: .63rem; margin-top: 10px; }
  .unread-button { margin: 12px 20px 0; }
  .modal { color: var(--text); background: var(--panel); border: 1px solid #79906f; border-radius: 20px; padding: 30px; max-width: min(540px, calc(100vw - 32px)); width: 100%; max-height: calc(100dvh - 40px); overflow-y: auto; box-shadow: 0 30px 90px #0008; }
  .modal::backdrop { background: #06150ed9; backdrop-filter: blur(5px); }
  .modal h2 { font-size: 1.7rem; margin: 10px 0 14px; }
  .modal p { font-size: .88rem; line-height: 1.65; }
  .modal-small { max-width: min(440px, calc(100vw - 32px)); }
  .modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 26px; }
  .shape-options { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; border: 0; padding: 0; margin: 24px 0 0; }
  .shape-option { border: 1px solid #718566; border-radius: 10px; text-align: center; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 10px 4px; font-size: .68rem; color: var(--text); margin: 0; }
  .shape-option:has(input:checked) { border-color: var(--accent); background: #d6ee9820; box-shadow: 0 0 0 1px var(--accent); }
  .shape-option:has(input:focus-visible) { outline: 3px solid var(--gold); outline-offset: 3px; }
  .shape-option input { width: 16px; height: 16px; padding: 0; margin: 0; accent-color: var(--accent); }
  .shape-choice .shape-svg { width: 31px; height: 31px; color: var(--accent); }
  .rules-modal { max-width: min(720px, calc(100vw - 32px)); }
  .rules-header { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
  .rules-header .button { flex-shrink: 0; }
  .rules-content h3 { color: var(--gold); font-size: 1rem; margin: 28px 0 10px; }
  .rules-content p + p { margin-top: 12px; }
  .rules-content .rules-lead { font-size: 1rem; color: var(--text); }
  .action-rules { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 24px 0 0; }
  .action-rules > div { background: #223b29; padding: 14px; border: 1px solid #465f43; border-radius: 10px; }
  .action-rules dt { color: var(--accent); font-size: 1.25rem; font-weight: 800; display: flex; align-items: center; gap: 10px; }
  .action-rules dt span { font-size: .8rem; color: var(--text); font-weight: 650; }
  .action-rules dd { margin: 8px 0 0; font-size: .79rem; color: var(--muted); line-height: 1.6; }
  .noscript { position: fixed; bottom: 12px; inset-inline: 12px; background: var(--danger); color: #36140e; border-radius: 10px; padding: 18px; text-align: center; z-index: 30; }
}

@layer responsive {
  @media (min-width: 1500px) { .table-panel { min-height: 445px; } .table-cards { margin-top: 40px; margin-bottom: 24px; } }
  @media (max-width: 1100px) {
    .site-header { padding-inline: 28px; } main { padding-inline: 28px; }
    .room-layout { grid-template-columns: minmax(0, 1fr) 285px; gap: 18px; }
    .table-panel { padding: 22px; }
    .guest-panel { padding: 28px; }
    .welcome { gap: 5%; }
    .header-right { gap: 14px; }
    .hand { gap: 10px; }
    .hand .playing-card, .hand .presentation-card-face { width: 74px; height: 108px; }
  }
  @media (max-width: 850px) {
    .site-header { padding: 20px 22px; } main { padding: 24px 22px 0; }
    .header-right { gap: 8px 12px; }
    .identity { padding-left: 10px; gap: 5px; }
    .identity-name { max-width: 100px; }
    .welcome { grid-template-columns: 1fr 1fr; gap: 25px; min-height: unset; }
    .welcome-copy h1 { font-size: 3rem; }
    .welcome-copy .lead { font-size: .98rem; }
    .guest-panel { padding: 24px; }
    .guest-panel h2 { font-size: 1.5rem; }
    .field-meta { flex-direction: column; gap: 3px; }
    .discovery-layout { grid-template-columns: minmax(230px, .9fr) minmax(0, 1.3fr); gap: 22px; }
    .create-panel { padding: 22px; }
    .room-item { flex-wrap: wrap; padding: 16px; gap: 12px; }
    .room-mark { width: 36px; height: 43px; }
    .room-item .button { margin-left: auto; }
    .room-layout { grid-template-columns: minmax(0, 1fr); }
    .social-column { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: start; }
    .table-panel { min-height: 370px; }
    .hand .playing-card, .hand .presentation-card-face { width: 82px; height: 117px; }
    .chat-log { height: 245px; }
    .section-stamp { display: none; }
  }
  @media (max-width: 620px) {
    .invite-banner { flex-direction: column; align-items: stretch; padding: 16px; }
    .invite-fields { grid-template-columns: minmax(0, 1fr); }
    .hand-reorder-handle { min-height: 44px; font-size: .6rem; }
    .hand-stack-toggle { min-height: 44px; font-size: .6rem; }
    #guidance-toggle { font-size: .68rem; gap: 5px; padding-inline: 8px; }
    .stack-controls { padding: 10px; }
    .stack-actions { width: 100%; }
    .stack-actions .button { flex: 1; }
    .whot-announcement { inset-inline: 5%; padding-inline: 12px; min-height: 210px; }
    .victory-announcement { inset-inline: 4%; padding: 24px 14px; min-height: 280px; }
    .victory-title { font-size: clamp(1.75rem, 8vw, 3rem); }
    .victory-detail { font-size: .75rem; }
    .victory-tagline { padding-inline: 6px; letter-spacing: .035em; }
    .near-win-announcement { padding: 10px; }
    .near-win-announcement p, .near-win-announcement strong { font-size: .79rem; }
    .hand-order-help { font-size: .68rem; }
    .private-join-panel { padding: 20px; }
    .site-header { padding: 17px 16px; gap: 12px; flex-wrap: wrap; }
    .brand { font-size: 1.6rem; gap: 9px; }
    .brand-symbol { width: 28px; height: 36px; font-size: 1.05rem; }
    .header-right { flex: 1; gap: 4px 10px; }
    .connection-badge { font-size: .66rem; }
    #rules-open { font-size: .72rem; min-height: 40px; padding: 8px 4px; }
    .identity { justify-content: flex-end; width: 100%; border: 0; padding: 0; font-size: .72rem; }
    .identity-name { max-width: 155px; }
    .identity .button { min-height: 32px; padding: 5px 4px; font-size: .67rem; }
    main { padding: 22px 16px 0; }
    .welcome { grid-template-columns: 1fr; gap: 26px; padding-top: 6px; padding-bottom: 10px; }
    .welcome-copy h1 { font-size: clamp(2.7rem, 12vw, 4rem); margin: 15px 0; }
    .welcome-copy .lead { max-width: 420px; }
    .welcome-cards { display: none; }
    .welcome-points { font-size: .7rem; gap: 8px 13px; margin-top: 16px; }
    .guest-panel { justify-self: stretch; max-width: none; padding: 26px 22px; }
    .field-meta { flex-direction: row; gap: 10px; }
    .eyebrow { font-size: .6rem; letter-spacing: .15em; }
    .discovery-heading { padding: 3px 0 26px; }
    .discovery-heading h1 { font-size: 2rem; }
    .discovery-heading p { font-size: .9rem; }
    .discovery-layout { grid-template-columns: 1fr; gap: 30px; }
    .create-panel { padding: 24px; }
    .create-panel h2 { font-size: 1.4rem; }
    .create-panel p { font-size: .87rem; }
    .create-panel form { margin-top: 20px; }
    .mini-rule { margin-top: 20px; padding-top: 18px; }
    .room-item { flex-wrap: nowrap; }
    .room-description h3 { font-size: .95rem; }
    .room-description p { font-size: .7rem; }
    .room-heading { flex-wrap: wrap; gap: 16px; margin-bottom: 20px; }
    .room-heading-actions { width: 100%; justify-content: flex-end; gap: 10px; }
    .room-heading-actions .button { font-size: .8rem; padding: 11px 15px; }
    .room-heading h1 { font-size: 1.9rem; }
    .room-heading p { font-size: .8rem; }
    .table-panel { min-height: 353px; padding: 20px 17px; border-radius: 18px; }
    .table-cards { gap: 18px; margin-top: 23px; }
    .playing-card, .presentation-card-face { width: 94px; height: 134px; }
    .card-pile { min-width: 99px; }
    .table-divider { font-size: .8rem; letter-spacing: 0; }
    .lobby-message h2 { font-size: 1.35rem; }
    .lobby-message p { font-size: .8rem; }
    .hand-panel { padding: 20px 14px; }
    .hand-heading { gap: 8px; margin-bottom: 16px; }
    .hand-heading p { font-size: .7rem; }
    .hand { gap: 10px; }
    .hand .playing-card, .hand .presentation-card-face { width: 68px; height: 98px; border-radius: 7px; }
    .hand .shape-svg { width: 29px; height: 29px; }
    .hand .card-number { font-size: .8rem; }
    .hand .card-corner { top: 4px; left: 5px; }
    .hand .card-corner-bottom { inset: auto 5px 4px auto; }
    .hand .card-corner .shape-svg { width: 7px; height: 7px; }
    .hand .wild-word { font-size: .87rem; }
    .hand .card-center-number { font-size: .6rem; }
    .pending-label { font-size: .65rem; max-width: 90px; }
    .social-column { grid-template-columns: 1fr; }
    .members { grid-template-columns: 1fr; gap: 14px 10px; }
    .member { gap: 9px; padding-left: 5px; flex-wrap: nowrap; }
    .member-avatar { width: 28px; height: 28px; font-size: .65rem; }
    .member-name { font-size: .74rem; }
    .member-meta { font-size: .6rem; }
    .member-cards { margin-left: 0; font-size: .67rem; }
    .chat-log { height: 280px; }
    .chat-form textarea { font-size: 1rem; }
    input { font-size: 1rem; }
    .site-footer { flex-direction: column; gap: 8px; margin-top: 34px; font-size: .68rem; }
    .diagnostics-control { flex-basis: auto; font-size: .75rem; }
    .notice, .connection-notice { align-items: start; padding: 12px; gap: 10px; flex-wrap: wrap; }
    .notice p, .connection-notice p { font-size: .8rem; }
    .modal { padding: 24px 20px; }
    .modal h2 { font-size: 1.45rem; }
    .shape-options { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
    .shape-option { padding: 13px 6px; font-size: .75rem; }
    .rules-header { flex-wrap: wrap; }
    .rules-header .button { margin-left: auto; }
    .action-rules { grid-template-columns: 1fr; }
  }
  @media (max-width: 350px) {
    main { padding-inline: 12px; }
    .site-header { padding-inline: 12px; }
    .room-item { flex-wrap: wrap; }
    .room-item .button { width: 100%; }
    .hand { gap: 8px; }
    .hand .playing-card, .hand .presentation-card-face { width: 64px; height: 94px; }
    .table-cards { gap: 10px; }
    .table-cards .playing-card { width: 82px; height: 117px; }
    .table-cards .card-pile { min-width: 88px; }
    .discard-dropzone { padding-inline: 4px; }
    .field-meta { flex-direction: column; }
    .members { grid-template-columns: 1fr; }
    .member-cards { margin-left: 0; }
    .modal-actions { flex-direction: column-reverse; }
  }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
    .button:hover:not(:disabled), .hand .playing-card:hover:not(:disabled), .hand .playing-card:focus-visible:not(:disabled), #draw-card:hover:not(:disabled) { transform: none; }
    .celebration-overlay, .table-motion-overlay { display: none; }
  }
  @media (prefers-contrast: more) {
    :root { --muted: #dae5d9; --line: #9aaa93; }
    .panel, .room-item, .playing-card, .presentation-card-face { border-width: 2px; }
    .button:disabled { opacity: .65; }
  }
  @media (forced-colors: active) {
    .playing-card, .presentation-card-face, .shape-option, .button, .panel, .table-panel { border: 2px solid ButtonText; }
    .hand .playing-card.is-playable, .member.is-current, .shape-option:has(input:checked), .hand-card.is-stack-selected, .discard-dropzone[data-drop-state="valid"] { outline: 2px solid Highlight; }
    .discard-dropzone[data-drop-state="invalid"] { outline: 3px dashed Mark; }
    .playing-card:disabled { color: GrayText; }
    .shape-svg { fill: currentColor; }
    .status-dot { background: CanvasText; }
    .near-win-badge, .near-win-announcement, .game-result, .victory-announcement { border: 2px solid CanvasText; }
    .celebration-overlay { display: none; }
  }
}
