:root {
  --bg: #f3f1eb;
  --panel: rgba(255, 255, 255, .82);
  --text: #20231f;
  --muted: #72776f;
  --line: rgba(32, 35, 31, .11);
  --accent: #356c55;
  --accent-strong: #245642;
  --accent-soft: #dce9e1;
  --danger: #b7443e;
  --danger-soft: #fae8e5;
  --shadow: 0 18px 50px rgba(41, 47, 40, .08);
  --g1: #5fbd92; --g2: #2e7a5a; --g3: #1f5b42;
  --g1b: #92cba8; --g2b: #4f9d78; --g3b: #367659;
  --glow: rgba(36, 86, 66, .5);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--text); background: radial-gradient(circle at 15% 0%, #e4eee6, transparent 30rem), var(--bg); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.shell { width: min(920px, calc(100% - 32px)); margin: 0 auto; padding: 26px 0 80px; }
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.brand h1 { margin: 0; font-size: 22px; letter-spacing: -.04em; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.brand .badge { margin-left: auto; }
.mark { display: grid; place-items: center; width: 42px; height: 42px; color: white; background: var(--accent); border-radius: 14px; font-weight: 800; box-shadow: 0 8px 22px rgba(53,108,85,.2); }
.panel { background: var(--panel); border: 1px solid rgba(255,255,255,.7); border-radius: 24px; box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.top-status { display: flex; align-items: baseline; gap: 8px; min-height: 20px; margin: 0 3px 8px; color: var(--muted); font-size: 11px; }
.top-status strong { color: var(--accent-strong); font-size: 12px; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin-bottom: 12px; border-radius: 18px; }
.topbar .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 0; }
.topbar .mark { width: 36px; height: 36px; border-radius: 12px; font-size: 15px; box-shadow: 0 6px 16px rgba(53,108,85,.2); }
.topbar .brand h1 { margin: 0; font-size: 20px; letter-spacing: -.03em; }
.topbar .brand p { margin: 1px 0 0; color: var(--muted); font-size: 12px; }
.topbar > .badge { margin-left: auto; }
.access { margin-left: auto; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.access-group { display: flex; align-items: center; gap: 8px; }
.seg-title { color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .04em; white-space: nowrap; }
.access-group input, .access-group select { height: 40px; border-radius: 11px; font-size: 14px; }
.access-group .code-input { width: 112px; font-size: 22px; letter-spacing: .22em; }
.access-group .code-input::placeholder { letter-spacing: -0.06em; text-indent: -0.06em; }
.access-group .guests-select { width: 88px; padding: 0 10px; }
.access-group .secret-input { width: 148px; }
.access-group button { min-height: 40px; padding-inline: 15px; border-radius: 11px; font-size: 14px; }
.access-divider { width: 1px; height: 26px; background: var(--line); }
.landing { max-width: 610px; margin: 8vh auto 0; padding: 42px; }
.hero-copy { text-align: center; margin-bottom: 30px; }
.hero-copy h2 { margin: 8px 0 10px; font-size: clamp(34px, 6vw, 52px); letter-spacing: -.055em; line-height: 1; }
.hero-copy p, .danger p { color: var(--muted); }
.eyebrow { color: var(--accent); font-size: 12px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.danger-action { display: flex; gap: 10px; }
input, textarea, select { width: 100%; color: var(--text); background: rgba(255,255,255,.7); border: 1px solid var(--line); border-radius: 13px; outline: none; transition: border-color .18s, box-shadow .18s; }
input, select { height: 48px; padding: 0 14px; }
textarea { padding: 15px; resize: vertical; line-height: 1.6; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(53,108,85,.1); }
.code-input { text-transform: uppercase; text-align: center; font-size: 24px; font-weight: 800; letter-spacing: .25em; }
button { border: 0; border-radius: 13px; padding: 0 18px; min-height: 46px; }
button:disabled { cursor: not-allowed; opacity: .48; transform: none !important; filter: none !important; }
.primary, .secondary { position: relative; overflow: hidden; color: white; font-weight: 750; transition: transform .18s ease, box-shadow .18s ease, filter .18s ease; }
.primary { background-image: linear-gradient(135deg, var(--g1) 0%, var(--g2) 52%, var(--g3) 100%); box-shadow: 0 10px 24px -10px var(--glow), inset 0 1px 0 rgba(255,255,255,.22); }
.primary:not(:disabled):hover { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 14px 28px -10px var(--glow), inset 0 1px 0 rgba(255,255,255,.26); }
.secondary { background-image: linear-gradient(135deg, var(--g1b) 0%, var(--g2b) 52%, var(--g3b) 100%); box-shadow: 0 10px 24px -10px var(--glow), inset 0 1px 0 rgba(255,255,255,.2); }
.secondary:not(:disabled):hover { transform: translateY(-1px); filter: brightness(1.05); box-shadow: 0 14px 28px -10px var(--glow), inset 0 1px 0 rgba(255,255,255,.24); }
.primary::after, .secondary::after { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 38%, rgba(255,255,255,.35) 50%, transparent 62%); transform: translateX(-130%); transition: transform .65s ease; pointer-events: none; }
.primary:not(:disabled):hover::after, .secondary:not(:disabled):hover::after { transform: translateX(130%); }
.ghost { color: var(--muted); background: transparent; border: 1px solid var(--line); }
.wide { width: 100%; }
.divider { display: flex; align-items: center; gap: 14px; color: var(--muted); margin: 24px 0; font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.create-form { display: grid; gap: 10px; margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line); }
.create-form label, .composer label { font-size: 13px; font-weight: 700; }
.field-row { display: grid; grid-template-columns: 1fr 140px; align-items: center; gap: 16px; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.5; }
.topbar-connected { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.topbar-connected .code-group { display: flex; align-items: baseline; gap: 7px; }
.topbar-connected .code-group .eyebrow { font-size: 11px; }
.code-display { display: block; min-height: auto; padding: 0; background: transparent; color: var(--text); font-size: 22px; font-weight: 850; letter-spacing: .15em; border: 0; }
.danger-button.compact { min-height: 36px; padding: 0 14px; border-radius: 11px; font-size: 12px; }
.badge { display: inline-flex; align-items: center; padding: 7px 11px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: 12px; font-weight: 750; }
.composer { padding: 26px; }
.composer textarea { margin-top: 10px; }
.composer-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.upload-zone { display: grid; place-items: center; gap: 7px; margin-top: 16px; padding: 26px; border-style: dashed; color: var(--muted); box-shadow: none; cursor: pointer; transition: border-color .18s, background .18s, color .18s; }
.upload-zone.dragover, .upload-zone:hover { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }
.upload-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); font-size: 24px; }
.upload-zone #uploadStatus { font-size: 12px; }
.upload-list { display: grid; gap: 8px; margin-top: 10px; }
.upload-chip { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.chip-info { display: grid; gap: 2px; min-width: 0; }
.chip-name { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.chip-meta { color: var(--muted); font-size: 11px; }
.upload-chip .progress { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: var(--accent-soft); overflow: hidden; }
.upload-chip .progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--g1), var(--g2)); transition: width .15s ease; }
.file-entry .file-head { display: flex; align-items: center; gap: 12px; }
.file-icon { display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 13px; }
.file-name { font-weight: 700; font-size: 14px; word-break: break-all; }
.file-size { margin-top: 2px; color: var(--muted); font-size: 11px; }
.history { margin-top: 38px; }
.section-title { display: flex; justify-content: space-between; align-items: end; margin-bottom: 14px; }
.history-actions { display: flex; align-items: center; gap: 10px; }
.uploading-notice { color: var(--accent); font-size: 12px; font-weight: 650; }
.uploading-notice::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--accent); animation: upload-pulse 1.2s ease-in-out infinite; }
@keyframes upload-pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.section-title h2, .danger h2 { margin: 4px 0 0; font-size: 24px; letter-spacing: -.035em; }
.entry-list { display: grid; gap: 10px; }
.entry { display: grid; grid-template-columns: 1fr auto; gap: 18px; padding: 20px 22px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; }
.entry pre { margin: 0; white-space: pre-wrap; word-break: break-word; font: inherit; line-height: 1.55; }
.entry-meta { margin-top: 10px; color: var(--muted); font-size: 11px; }
.entry-actions { display: flex; gap: 7px; align-items: start; }
.entry-actions button { min-height: 36px; padding: 0 11px; font-size: 12px; }
.empty { padding: 40px 10px; text-align: center; color: var(--muted); }
.members-panel { margin-top: 26px; padding: 24px 26px; }
.member-list { display: grid; margin-top: 14px; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.member-row:last-child { border-bottom: 0; }
.member-dot { flex: 0 0 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); opacity: .45; }
.member-dot.online { background: #3fae6c; opacity: 1; box-shadow: 0 0 0 3px rgba(63, 174, 108, .16); }
.member-label { flex: 1; min-width: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; font-weight: 650; }
.member-meta { color: var(--muted); font-size: 11px; font-weight: 500; }
.member-row button { min-height: 32px; padding: 0 11px; font-size: 12px; }
.owner-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.owner-controls button { min-height: 36px; padding: 0 13px; font-size: 12px; }
.danger-sheet { display: grid; gap: 12px; margin-bottom: 14px; padding: 18px 22px; border-color: rgba(183,68,62,.16); }
.danger-label { color: var(--danger); }
.danger-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.danger-head strong { font-size: 15px; }
.danger-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.guest-destroy-controls { display: flex; gap: 10px; }
.guest-destroy-controls input { flex: 1; }
.owner-secret { display: flex; align-items: center; gap: 9px; margin-top: 15px; color: var(--muted); font-size: 12px; }
.owner-secret code { padding: 7px 10px; color: var(--text); background: var(--danger-soft); border-radius: 9px; font: 700 13px ui-monospace, SFMono-Regular, Menlo, monospace; }
.owner-secret button { min-height: 34px; padding: 0 10px; }
.reset-secret-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-top: 12px; }
.reset-secret-form input { height: 40px; }
.reset-secret-form button { min-height: 40px; white-space: nowrap; }
.danger-button { color: white; background: var(--danger); font-weight: 750; white-space: nowrap; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 10; padding: 12px 18px; background: #20231f; color: white; border-radius: 12px; box-shadow: var(--shadow); font-size: 13px; }
.back-link, .back-button { min-height: 38px; padding: 0 14px; border-radius: 11px; font-size: 12px; text-decoration: none; }
.login-card { display: grid; gap: 14px; max-width: 420px; margin: 0 auto; padding: 26px 28px; }
.login-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.login-field { display: grid; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
.login-card .primary { justify-self: start; padding-inline: 28px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.stat-card { display: grid; gap: 4px; padding: 16px 18px; }
.stat-value { font-size: 24px; font-weight: 850; letter-spacing: -.03em; }
.stat-label { color: var(--muted); font-size: 11px; }
.switches { display: grid; gap: 10px; padding: 18px 22px; margin-bottom: 14px; }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.switch-row strong { font-size: 14px; }
.switch-row .hint { margin-top: 2px; }
.admin-list { margin-top: 26px; }
.admin-clip-head { display: flex; align-items: center; gap: 10px; }
.admin-code { font: 800 17px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; }
.danger-text { color: var(--danger); }
.event-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.event-label { font-size: 12px; font-weight: 700; }
.foot { margin-top: 40px; text-align: center; }
.foot a { color: var(--muted); font-size: 12px; text-decoration: none; }
.foot a:hover { color: var(--accent); }
.brand-copy { cursor: pointer; }
.puzzle-overlay { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(15, 18, 15, .45); backdrop-filter: blur(4px); }
.puzzle-card { width: min(430px, calc(100% - 32px)); padding: 24px 26px; }
.puzzle-head { display: flex; justify-content: space-between; align-items: center; }
.puzzle-head button { min-height: 36px; padding: 0 12px; font-size: 12px; }
.puzzle-cells { display: flex; gap: 12px; margin: 20px 0 6px; }
.puzzle-cell { flex: 1; min-height: 86px; border-radius: 18px; font-size: 28px; font-weight: 850; color: var(--accent-strong); background: var(--accent-soft); transition: transform .15s, box-shadow .15s, background .15s, color .15s; }
.puzzle-cell:hover { background-image: linear-gradient(135deg, var(--g1), var(--g2)); color: white; transform: translateY(-2px); box-shadow: 0 12px 22px -8px var(--glow); }
#puzzleStatus { color: var(--danger); }
.hidden { display: none !important; }
.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; }

@media (max-width: 680px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .event-row { align-items: flex-start; flex-direction: column; }
  .switch-row { align-items: flex-start; flex-direction: column; }
  .shell { width: min(100% - 22px, 920px); padding-top: 22px; }
  .landing { margin-top: 2vh; padding: 28px 20px; }
  .brand { margin-bottom: 12px; }
  .top-status { align-items: flex-start; flex-direction: column; gap: 1px; margin-bottom: 7px; }
  .topbar { flex-wrap: wrap; gap: 8px; padding: 9px 12px; }
  .brand p { display: none; }
  .access { flex-basis: 100%; justify-content: flex-start; gap: 8px; }
  .access-group { flex-wrap: wrap; }
  .access-group .code-input { width: 100px; }
  .access-group .secret-input { flex: 1 1 130px; }
  .access-divider { display: none; }
  .guest-destroy-controls { flex-direction: column; }
  .owner-secret { align-items: flex-start; flex-wrap: wrap; }
  .reset-secret-form { grid-template-columns: 1fr; }
  .entry { grid-template-columns: 1fr; }
}

@media (prefers-color-scheme: dark) {
  :root { --bg: #171a17; --panel: rgba(35,39,35,.9); --text: #eef1ec; --muted: #a2aaa0; --line: rgba(255,255,255,.12); --accent: #70ad8c; --accent-strong: #91c6a7; --accent-soft: #243d30; --danger-soft: #4c2928; --shadow: 0 18px 50px rgba(0,0,0,.22);
    --g1: #6cc99b; --g2: #35805e; --g3: #256348;
    --g1b: #a3d4b8; --g2b: #5fae87; --g3b: #428364;
    --glow: rgba(0, 0, 0, .5); }
  body { background: radial-gradient(circle at 15% 0%, #203a2a, transparent 30rem), var(--bg); }
  input, textarea, select { background: rgba(10,12,10,.36); }
  .notice { color: #f5dea0; background: #433a20; border-color: #625329; }
}
