/* SPDX-License-Identifier: AGPL-3.0-or-later */
:root {
  --paper: #f7f4eb;
  --surface: #fffdf7;
  --soft: #efebe0;
  --ink: #1b2421;
  --muted: #66736e;
  --faint: #8a958f;
  --line: #dcd6c8;
  --accent: #00695c;
  --accent-soft: #dceee9;
  --gold: #9b761b;
  --danger: #a03e3e;
  --danger-soft: #f7e5e1;
  --ok: #2e7258;
  --shadow: 0 18px 50px rgba(38, 44, 38, .08);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Noto Serif SC", serif;
  --sans: "Avenir Next", "Segoe UI", "Noto Sans SC", sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(0,105,92,.08), transparent 30rem),
    var(--paper);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
}
button, input, textarea { font: inherit; }
code, pre { font-family: var(--mono); }
.admin-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 64px; padding: 0 24px;
  background: rgba(247,244,235,.9); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 10;
}
.admin-brand { color: var(--ink); text-decoration: none; font-weight: 750; letter-spacing: -.03em; font-size: 16px; }
.admin-brand span { color: var(--faint); font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: .08em; }
.admin-bar-right { display: flex; align-items: center; gap: 12px; }
.fingerprint { color: var(--faint); font-family: var(--mono); font-size: 9px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-main { max-width: 1120px; margin: 0 auto; padding: 38px 22px 90px; }
.eyebrow { color: var(--accent); font-family: var(--mono); font-size: 9px; letter-spacing: .16em; text-transform: uppercase; }
h1 { margin: 7px 0 8px; font-family: var(--serif); font-size: clamp(30px, 4vw, 46px); font-weight: 500; letter-spacing: -.04em; line-height: 1.1; }
h2 { margin: 0 0 4px; font-size: 15px; }
p { margin: 0; }
.lead { max-width: 68ch; color: var(--muted); }
.login-card { max-width: 760px; margin: 18px auto; padding: clamp(24px, 4vw, 42px); background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.login-step { display: flex; gap: 16px; margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.step-no { display: grid; place-items: center; flex: none; width: 32px; height: 32px; color: var(--accent); background: var(--accent-soft); border-radius: 50%; font-family: var(--mono); font-size: 11px; }
.login-step p { margin: 2px 0 14px; color: var(--muted); font-size: 12px; }
.challenge-panel { margin: 24px 0 0 48px; padding: 18px; background: var(--soft); border: 1px solid var(--line); border-radius: 16px; }
.challenge-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; color: var(--faint); font-family: var(--mono); font-size: 9px; }
.challenge-meta code { color: var(--ink); }
.challenge-box { margin: 10px 0 14px; padding: 12px; overflow: auto; color: var(--accent); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; font-size: 11px; word-break: break-all; white-space: pre-wrap; }
.cmd-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 0 6px; color: var(--muted); font-size: 10px; }
.command-box { margin: 0; padding: 12px; overflow: auto; color: #dfeee8; background: #16231f; border-radius: 9px; font-size: 10px; line-height: 1.7; white-space: pre-wrap; }
.hint { margin-top: 14px; color: var(--muted); font-size: 11px; }
textarea { width: 100%; margin: 12px 0; padding: 12px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font-family: var(--mono); font-size: 11px; resize: vertical; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 14px; border: 1px solid transparent; border-radius: 999px; cursor: pointer; font-size: 11px; font-weight: 650; text-decoration: none; }
.btn.primary { color: #fff; background: var(--accent); }
.btn.primary:hover { background: #00554a; }
.btn.ghost { color: var(--muted); background: transparent; border-color: var(--line); }
.btn.ghost:hover { color: var(--ink); background: var(--soft); }
.btn.tiny { min-height: 27px; padding: 0 9px; color: var(--muted); background: var(--surface); border-color: var(--line); font-size: 9px; }
.btn.wide { width: 100%; }
.btn.danger { color: var(--danger); background: var(--danger-soft); border-color: #e7c3ba; }
.btn:disabled { opacity: .5; cursor: wait; }
.error { min-height: 20px; margin-top: 12px; color: var(--danger); font-size: 12px; }
.key-note { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--faint); font-size: 10px; }
.key-note code { color: var(--muted); }
code { padding: 1px 4px; background: var(--soft); border-radius: 4px; font-size: .92em; }
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin-bottom: 20px; }
.stat { padding: 15px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.stat b { display: block; font-family: var(--serif); font-size: 30px; font-weight: 500; line-height: 1; }
.stat span { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.tabs { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 18px; }
.tab { min-height: 32px; padding: 0 12px; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 999px; cursor: pointer; font-size: 10px; }
.tab:hover { color: var(--ink); background: var(--soft); }
.tab.active { color: var(--accent); background: var(--accent-soft); border-color: #c8e1d9; }
.submission-list { display: grid; gap: 12px; }
.submission { padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.submission-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.submission h3 { margin: 0; font-family: var(--serif); font-size: 23px; font-weight: 500; letter-spacing: -.02em; }
.submission h3 small { margin-left: 7px; color: var(--faint); font-family: var(--mono); font-size: 9px; font-weight: 400; letter-spacing: .04em; }
.badges { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
.badge { padding: 3px 7px; color: var(--muted); background: var(--soft); border-radius: 999px; font-family: var(--mono); font-size: 8px; }
.badge.ok { color: var(--ok); background: var(--accent-soft); }
.badge.no { color: var(--danger); background: var(--danger-soft); }
.submission-intro { margin: 10px 0; color: var(--muted); font-size: 12px; white-space: pre-wrap; }
.submission dl { display: grid; grid-template-columns: 110px minmax(0,1fr); gap: 4px 12px; margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 11px; }
.submission dt { color: var(--faint); font-family: var(--mono); font-size: 9px; }
.submission dd { margin: 0; overflow-wrap: anywhere; }
.submission-actions { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin-top: 14px; }
.submission-actions textarea { flex: 1 1 260px; min-height: 34px; height: 34px; margin: 0; padding: 7px 10px; font-family: var(--sans); font-size: 11px; }
.empty { padding: 38px; color: var(--faint); text-align: center; background: var(--surface); border: 1px dashed var(--line); border-radius: 16px; }
.review-note { margin-top: 10px; color: var(--faint); font-size: 10px; }
@media (max-width: 700px) {
  .admin-bar { padding: 0 14px; }
  .fingerprint { display: none; }
  .admin-main { padding: 24px 14px 70px; }
  .login-card { padding: 22px 17px; border-radius: 18px; }
  .challenge-panel { margin-left: 0; }
  .stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .dash-head { align-items: flex-start; flex-direction: column; }
  .submission dl { grid-template-columns: 84px minmax(0,1fr); }
}

[hidden] { display: none !important; }


.admin-lang { display: inline-flex; align-items: center; gap: 5px; color: var(--faint); font-family: var(--mono); font-size: 8px; letter-spacing: .06em; }
.admin-lang select { max-width: 120px; padding: 4px 6px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; font-family: var(--sans); font-size: 10px; }
.admin-ai-note { max-width: 1120px; margin: 14px auto 0; padding: 0 22px; }
.translation-note { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; padding: 9px 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; font-size: 10.5px; line-height: 1.5; }
.translation-kind { display: inline-grid; place-items: center; min-width: 28px; height: 17px; padding: 0 5px; color: #fff; background: var(--accent); border-radius: 999px; font-family: var(--mono); font-size: 7px; font-weight: 600; letter-spacing: .04em; }
.translation-note a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 700px) {
  .admin-lang span { display: none; }
  .admin-lang select { max-width: 105px; }
  .admin-ai-note { padding: 0 14px; }
}


.view-switch { display: inline-flex; gap: 4px; margin-bottom: 22px; padding: 3px; background: var(--soft); border: 1px solid var(--line); border-radius: 999px; }
.view-tab { min-height: 30px; padding: 0 12px; color: var(--muted); background: transparent; border: 0; border-radius: 999px; cursor: pointer; font-size: 10px; }
.view-tab.active { color: var(--accent); background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.entries-toolbar { display: flex; gap: 8px; margin-bottom: 14px; }
.entries-toolbar input { flex: 1; min-height: 38px; padding: 0 12px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; font-size: 11px; outline: none; }
.entries-toolbar input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,105,92,.1); }
.entries-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.entry-card { padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; }
.entry-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.entry-card h3 { margin: 0; font-family: var(--serif); font-size: 19px; font-weight: 500; }
.entry-card h3 small { margin-left: 6px; color: var(--faint); font-family: var(--mono); font-size: 8px; }
.entry-card p { margin: 5px 0 0; color: var(--muted); font-size: 10.5px; }
.entry-card .entry-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.entry-card .btn { min-height: 29px; padding: 0 10px; font-size: 9px; }
.editor-layer { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.editor-backdrop { position: absolute; inset: 0; background: rgba(18,28,24,.55); backdrop-filter: blur(5px); }
.editor-card { position: relative; width: min(980px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: clamp(20px,3vw,30px); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.editor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.editor-head h2 { font-family: var(--serif); font-size: 30px; font-weight: 500; letter-spacing: -.03em; }
.editor-head p { margin-top: 3px; color: var(--faint); font-family: var(--mono); font-size: 9px; }
.editor-form { display: block; }
.editor-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { color: var(--muted); font-size: 9.5px; font-weight: 600; }
.field input, .field select, .field textarea { width: 100%; padding: 7px 9px; color: var(--ink); background: var(--soft); border: 1px solid var(--line); border-radius: 7px; font-family: var(--sans); font-size: 10.5px; outline: none; }
.field input:focus, .field select:focus, .field textarea:focus { background: var(--surface); border-color: var(--accent); }
.field textarea { resize: vertical; line-height: 1.6; }
.field.checkbox { flex-direction: row; align-items: center; gap: 7px; margin: 10px 0; }
.field.checkbox input { width: auto; }
.field.checkbox span { font-size: 10px; }
.editor-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; padding-top: 14px; border-top: 1px solid var(--line); }
.editor-actions .btn { min-height: 36px; }
.editor-card .error { margin-bottom: 0; }
@media (max-width: 900px) {
  .entries-list { grid-template-columns: minmax(0,1fr); }
  .editor-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .editor-layer { padding: 0; }
  .editor-card { max-height: 100vh; border-radius: 0; min-height: 100vh; }
}
@media (max-width: 600px) {
  .editor-grid { grid-template-columns: minmax(0,1fr); }
}

.badge.ai { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); background: color-mix(in srgb, var(--accent) 8%, transparent); }
