:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #edf2f7;
  --text: #16191f;
  --muted: #6f7783;
  --line: #dde3eb;
  --accent: #ff8787;
  --accent-strong: #f46f73;
  --accent-soft: #fff0f0;
  --good: #2f8f64;
  --warning: #a26a18;
  --radius: 22px;
  --shadow: 0 18px 50px rgba(35, 47, 62, 0.08);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% -10%, rgba(255,255,255,.95) 0 18rem, transparent 34rem),
    var(--bg);
}
button, input, textarea { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.center-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}
.auth-card {
  width: min(440px, 100%);
  padding: 42px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255,255,255,.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}
.auth-card h1 { margin: 10px 0 8px; font-size: 32px; letter-spacing: -0.04em; }
.auth-card p { margin: 0 0 26px; line-height: 1.55; color: var(--muted); }
.mark {
  width: 54px; height: 54px; border-radius: 17px; display: grid; place-items: center;
  background: var(--accent); color: white; font-weight: 900; font-size: 24px; margin-bottom: 28px;
}
.mark.small { width: 36px; height: 36px; border-radius: 12px; margin: 0; font-size: 16px; }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .14em; color: var(--muted); }
.app { width: min(1240px, calc(100% - 48px)); margin: 0 auto; padding: 26px 0 80px; }
.topbar { display: flex; justify-content: space-between; gap: 24px; align-items: center; }
.brand-wrap, .user-wrap { display: flex; align-items: center; gap: 12px; }
.brand { font-size: 15px; font-weight: 900; letter-spacing: .08em; }
.subbrand { color: var(--muted); font-size: 12px; margin-top: 2px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--surface-2); }
.user-copy { text-align: right; }
.user-name { font-size: 14px; font-weight: 700; }
.icon-button {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  cursor: pointer;
}
.tabs { display: flex; gap: 6px; margin: 44px 0 34px; border-bottom: 1px solid var(--line); }
.tab { border: 0; background: transparent; padding: 14px 16px; color: var(--muted); font-weight: 700; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.hero { padding: 38px 0 30px; display: grid; grid-template-columns: 1fr auto; gap: 30px; align-items: end; }
.hero h1 { margin: 7px 0 12px; font-size: clamp(40px, 7vw, 84px); line-height: .98; letter-spacing: -.055em; max-width: 850px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 10px 18px; color: var(--muted); font-size: 14px; }
.phase-pill { display: inline-flex; align-items: center; gap: 7px; background: var(--accent-soft); color: #9b4549; padding: 8px 11px; border-radius: 999px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.phase-dot { width: 7px; height: 7px; background: var(--accent); border-radius: 50%; }
.countdown { text-align: right; }
.countdown strong { display: block; font-size: 30px; letter-spacing: -.03em; }
.countdown span { color: var(--muted); font-size: 12px; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: 0 8px 22px rgba(35,47,62,.035); }
.card.soft { background: rgba(255,255,255,.62); }
.card h2, .card h3 { margin: 0; letter-spacing: -.025em; }
.card h2 { font-size: 22px; }
.card h3 { font-size: 17px; }
.section-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin: 34px 0 16px; }
.section-head h2 { margin: 0; font-size: 25px; letter-spacing: -.035em; }
.button { border: 1px solid var(--line); border-radius: 13px; padding: 11px 15px; background: var(--surface); cursor: pointer; font-weight: 750; transition: transform .12s ease, border-color .12s ease, background .12s ease; }
.button:hover { transform: translateY(-1px); border-color: #cbd3de; }
.button.primary { border-color: var(--accent); background: var(--accent); color: white; }
.button.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.button.ghost { background: transparent; }
.button.danger { color: #9b4549; background: var(--accent-soft); border-color: #ffd3d3; }
.button.wide { width: 100%; }
.button:disabled { opacity: .45; cursor: default; transform: none; }
.input, .textarea, .select {
  width: 100%; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 13px; padding: 12px 13px; outline: none;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,135,135,.15); }
.textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
.label { display: block; font-size: 12px; font-weight: 800; color: var(--muted); margin: 0 0 7px; }
.field + .field { margin-top: 14px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.status-line { margin-top: 12px; min-height: 18px; font-size: 12px; color: var(--muted); }
.art-card { overflow: hidden; padding: 0; }
.art-image-wrap { background: #e8edf3; aspect-ratio: 4 / 3; display: grid; place-items: center; overflow: hidden; }
.art-image { width: 100%; height: 100%; object-fit: contain; background: #edf1f5; }
.art-body { padding: 20px; }
.art-author { font-weight: 850; font-size: 14px; }
.art-title { font-size: 20px; font-weight: 850; margin-top: 8px; letter-spacing: -.025em; }
.art-comment { margin-top: 9px; color: var(--muted); line-height: 1.55; white-space: pre-wrap; }
.score-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; margin-top: 18px; }
.score-box { border: 1px solid var(--line); border-radius: 13px; padding: 10px; }
.score-box label { display: block; color: var(--muted); font-size: 11px; margin-bottom: 6px; }
.score-box select { width: 100%; border: 0; background: transparent; font-weight: 800; outline: 0; }
.favorite-line { margin-top: 14px; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.rank { display: inline-grid; place-items: center; min-width: 34px; height: 34px; border-radius: 11px; background: var(--surface-2); font-weight: 900; }
.result-line { display: flex; gap: 12px; align-items: center; }
.result-score { margin-left: auto; text-align: right; }
.result-score strong { display: block; font-size: 24px; }
.kpi { padding: 22px; }
.kpi strong { display: block; font-size: 34px; letter-spacing: -.04em; }
.kpi span { color: var(--muted); font-size: 12px; }
.timeline { display: grid; gap: 8px; }
.theme-row { display: grid; grid-template-columns: 54px minmax(0,1fr) auto; gap: 14px; align-items: center; padding: 15px 16px; border-radius: 15px; border: 1px solid var(--line); background: var(--surface); }
.theme-number { font-size: 12px; color: var(--muted); font-weight: 800; }
.theme-prompt { font-weight: 800; }
.theme-author { color: var(--muted); font-size: 12px; }
.badge { display: inline-flex; align-items: center; padding: 6px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 800; }
.badge.accent { background: var(--accent-soft); color: #9b4549; }
.empty { padding: 70px 24px; text-align: center; color: var(--muted); border: 1px dashed #cfd7e1; border-radius: var(--radius); }
.empty strong { color: var(--text); display: block; margin-bottom: 6px; }
.notice { padding: 14px 16px; background: var(--accent-soft); border: 1px solid #ffd4d4; border-radius: 14px; color: #824147; font-size: 13px; line-height: 1.5; }
hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 11px 15px; border-radius: 999px; background: #171b20; color: white; font-size: 13px; transition: .2s ease; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.admin-grid { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(300px,.75fr); gap: 18px; }
.member-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.member-row:last-child { border-bottom: 0; }
.file-drop { border: 1px dashed #c8d1dc; border-radius: 15px; padding: 20px; background: #fafbfd; }
.file-drop input { width: 100%; }
.progress { height: 7px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.progress > div { height: 100%; background: var(--accent); border-radius: inherit; transition: width .25s ease; }
code { background: var(--surface-2); padding: 2px 5px; border-radius: 6px; }

@media (max-width: 840px) {
  .app { width: min(100% - 28px, 1240px); }
  .grid.two, .grid.three, .admin-grid { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
  .countdown { text-align: left; }
  .score-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .user-copy { display: none; }
}

@media (max-width: 520px) {
  .auth-card { padding: 28px; }
  .tabs { overflow-x: auto; }
  .tab { padding-inline: 12px; }
  .theme-row { grid-template-columns: 40px minmax(0,1fr); }
  .theme-author { grid-column: 2; }
  .topbar { align-items: flex-start; }
}

/* Admin recovery console */
.text-link { color: var(--text); font-weight: 750; text-decoration: none; border-bottom: 1px solid #bfc8d3; }
.text-link:hover { border-bottom-color: var(--accent); }
.image-link { display: block; width: 100%; height: 100%; }
.admin-editor-stack details.card { padding: 0; overflow: hidden; }
.admin-editor-stack summary { list-style: none; cursor: pointer; padding: 20px 24px; font-weight: 850; display: flex; align-items: center; gap: 10px; }
.admin-editor-stack summary::-webkit-details-marker { display: none; }
.admin-editor-stack details[open] summary { border-bottom: 1px solid var(--line); }
.admin-list { padding: 0 24px 24px; }
.admin-record { padding: 20px 0; border-bottom: 1px solid var(--line); }
.admin-record:last-child { border-bottom: 0; }
.admin-record.new-record { margin: 18px 0 4px; padding: 18px; background: var(--surface-2); border: 0; border-radius: 16px; }
.admin-record-head { display: flex; gap: 10px; justify-content: space-between; align-items: baseline; margin-bottom: 13px; }
.admin-record-head strong { font-size: 14px; }
.admin-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.admin-form-grid .span-2 { grid-column: 1 / -1; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }

@media (max-width: 720px) {
  .admin-form-grid { grid-template-columns: 1fr; }
  .admin-form-grid .span-2 { grid-column: auto; }
  .admin-record-head { align-items: flex-start; flex-direction: column; }
}
