/* =========================================================
   OSINT CTF — simple light theme (based on KouchaCoder)
   Fonts: Lato (Latin) / Noto Sans JP (Japanese)
   ========================================================= */

:root {
  --primary-600: #1e88e5;
  --primary-500: #2196f3;
  --primary-900: #0d47a1;
  --primary-800: #1565c0;
  --primary-700: #1976d2;
  --primary-200: #90caf9;
  --primary-100: #bbdefb;
  --primary-50: #e3f2fd;

  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --border: #e0e0e0;
  --text: #212121;
  --text-2: #5f6368;
  --text-3: #9e9e9e;

  --ok: #2e7d32;
  --warn: #f9a825;
  --bad: #c62828;
  --tile: #37474f;
  --tile-solved: #3a9d77;

  --radius: 8px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-2: 0 2px 4px rgba(0, 0, 0, 0.08), 0 3px 8px rgba(0, 0, 0, 0.06);
  --shadow-4: 0 4px 8px rgba(0, 0, 0, 0.1), 0 8px 24px rgba(0, 0, 0, 0.08);

  --font-sans: 'Lato', 'Noto Sans JP', 'Hiragino Sans', sans-serif;
  --font-head: var(--font-sans);
  --font-mono: ui-monospace, 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { padding: 0; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }
a { color: var(--primary-700); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 700; line-height: 1.4; margin: 0 0 12px; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
code, pre, kbd { font-family: var(--font-mono); }
:focus-visible { outline: 2px solid var(--primary-700); outline-offset: 2px; }

.shell { min-height: 100vh; display: flex; flex-direction: column; }
#view { flex: 1; outline: none; }

/* ---------- Material Symbols ---------- */
.msi {
  font-family: 'Material Symbols Rounded';
  font-weight: normal; font-style: normal; line-height: 1; letter-spacing: normal; text-transform: none;
  display: inline-block; white-space: nowrap; word-wrap: normal; direction: ltr;
  font-feature-settings: 'liga'; -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: -0.2em; user-select: none; flex-shrink: 0;
}

/* ---------- app bar ---------- */
.app-bar { background: var(--primary-800); color: #fff; box-shadow: var(--shadow-2); position: sticky; top: 0; z-index: 50; }
.app-bar-inner { max-width: 1240px; margin: 0 auto; padding: 0 20px; height: 56px; display: flex; align-items: center; gap: 8px; }
.brand { color: #fff; font-weight: 900; font-size: 19px; letter-spacing: 0.02em; margin-right: 12px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-logo, .logo-preview img { display: block; height: 32px; width: auto; max-width: 200px; object-fit: contain; }
.logo-bar { display: flex; align-items: center; height: 56px; padding: 0 16px; border-radius: 6px; background: var(--primary-800); }
.logo-preview { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 900; font-size: 19px; }
.fav-preview { display: flex; align-items: center; gap: 12px; }
.fav-tab { display: inline-flex; align-items: center; gap: 8px; max-width: 240px; padding: 8px 14px; border-radius: 8px 8px 0 0; background: #e8eaed; font-size: 12px; color: var(--text-2); }
.fav-tab img { width: 16px; height: 16px; object-fit: contain; flex: none; }
.fav-tab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fav-big { width: 48px; height: 48px; object-fit: contain; border: 1px solid var(--border); border-radius: 6px; padding: 4px; background: #fff; }
.nav-collapse { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.nav, .app-bar-right { display: flex; align-items: center; gap: 2px; }
.nav { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.app-bar-right { flex: none; }
.brand { flex: none; }
@media (max-width: 1400px) and (min-width: 1101px) {
  .app-bar-right a.compact > span:not(.msi):not(.count) { display: none; }
  .app-bar-right a.compact { padding: 8px; }
}
.nav a, .app-bar-right a {
  display: inline-flex; align-items: center; gap: 6px; color: rgba(255, 255, 255, 0.9);
  padding: 8px 11px; border-radius: 6px; font-size: 14px; font-weight: 700; white-space: nowrap;
}
.nav a:hover, .app-bar-right a:hover { background: rgba(255, 255, 255, 0.14); text-decoration: none; }
.nav a.active, .app-bar-right a.active { background: rgba(255, 255, 255, 0.2); color: #fff; }
.count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #e53935; color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.score-pill { padding: 0 8px; border-radius: 9px; background: rgba(255, 255, 255, 0.18); font-size: 12px; font-variant-numeric: tabular-nums; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: rgba(0, 0, 0, 0.06); color: var(--text); }
.menu-btn { display: none; margin-left: auto; color: #fff; }
.menu-btn:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }

/* ---------- page title band (KouchaCoder blue) ---------- */
.page-band { background: linear-gradient(135deg, var(--primary-800), var(--primary-500)); color: #fff; text-align: center; padding: 64px 32px; }
.page-band-inner { max-width: 1120px; margin: 0 auto; }
.page-band h1 { color: #fff; font-family: var(--font-head); font-size: 40px; font-weight: 500; letter-spacing: 2px; margin: 0; }
.page-band p { margin: 8px 0 0; color: rgba(255, 255, 255, 0.82); }
.profile-stat { color: #fff; font-size: 30px; font-weight: 500; letter-spacing: 2px; margin: 10px 0 0; font-variant-numeric: tabular-nums; }
.profile-stat small { font-size: 65%; font-weight: 400; }
.band-status { margin-top: 14px; }
.band-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 22px; }

/* ---------- layout ---------- */
.container { max-width: 1120px; margin: 0 auto; padding: 32px 20px 64px; }
.container-narrow { max-width: 560px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.spacer { flex: 1; }
.center { text-align: center; }
.empty-note { padding: 56px 16px; text-align: center; font-size: 20px; font-weight: 500; color: var(--text-3); }
.error-page { text-align: center; padding-top: 88px; }
.error-page h1 { font-size: 32px; font-weight: 500; letter-spacing: 2px; margin-bottom: 16px; }
.error-page h2 { font-size: 22px; font-weight: 500; letter-spacing: 2px; margin-top: 22px; }
.error-page hr { width: 50%; border: 0; border-top: 1px solid var(--border); }

/* ---------- cards ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-1); overflow: hidden; }
.card-head { padding: 14px 20px; border-bottom: 1px solid var(--border); font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-body { padding: 20px; }
.center-head { justify-content: center; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 16px;
  border-radius: 6px; border: 1px solid transparent; background: transparent; color: var(--primary-700);
  font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer; transition: background 0.15s, box-shadow 0.15s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--primary-50); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary-700); color: #fff; box-shadow: var(--shadow-1); }
.btn-primary:hover { background: var(--primary-800); }
.btn-outline { border-color: var(--primary-200); color: var(--primary-700); background: var(--surface); }
.btn-light { background: #fff; color: var(--primary-800); }
.btn-light:hover { background: var(--primary-50); }
.btn-ghost-light { color: #fff; border-color: rgba(255, 255, 255, 0.55); }
.btn-ghost-light:hover { background: rgba(255, 255, 255, 0.14); }
.btn-danger { color: var(--bad); border-color: #ffcdd2; background: var(--surface); }
.btn-danger:hover { background: #ffebee; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 700; color: var(--text-2); }
.hint { font-size: 12px; color: var(--text-2); }
.req { color: var(--bad); }
.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 24px; flex-wrap: wrap; }
.btn-submit { min-width: 130px; height: 40px; }
.form-card { margin-bottom: 20px; }
.search-row { display: flex; gap: 8px; margin-bottom: 20px; }
.search-row .btn { height: 39px; padding: 0 22px; }
.search-note { text-align: center; color: var(--text-2); margin: 0 0 16px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 20px; }
.pager select { width: auto; padding: 4px 8px; }
input[type='text'], input[type='password'], input[type='number'], input[type='date'], input[type='datetime-local'], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface);
  font-family: inherit; font-size: 14px; color: var(--text); transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary-700); box-shadow: 0 0 0 3px var(--primary-50); }
input[readonly] { background: var(--surface-2); color: var(--text-2); }
textarea { resize: vertical; min-height: 70px; line-height: 1.6; }
textarea.mono { font-family: var(--font-mono); font-size: 13px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--primary-700); }
label.inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 16px; align-items: start; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid > .checkbox { margin: 30px 0 16px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th, table.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
table.tbl th { background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; }
table.tbl tbody tr:hover { background: var(--primary-50); }
table.tbl.striped tbody tr:nth-child(odd) { background: #f5f6f7; }
table.tbl.striped tbody tr:hover { background: var(--primary-50); }
table.tbl tr.me td { background: #fff8e1; }
table.tbl tr.dim-row td { opacity: 0.55; }
table.tbl td.wrap { white-space: normal; }
table.tbl.compact td { padding: 6px 10px; }
.tbl td.ok { color: var(--ok); font-weight: 700; }
.tbl td.bad { color: var(--bad); font-weight: 700; }
table.tbl.ctf td { padding: 13px 16px; }
table.tbl.ctf tr > :not(:first-child) { text-align: center; }
table.tbl.ctf th { padding-left: 16px; }
table.tbl.board-table tr > .place { text-align: center; width: 80px; }
table.tbl.board-table tr > .name-col { text-align: left; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.place { font-weight: 700; width: 70px; }
.actions { text-align: right; }
.actions > * { margin-left: 4px; }
.thumb-sm { width: 44px; height: 32px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); display: block; }

/* ---------- chips / badges ---------- */
.chip { display: inline-flex; align-items: center; padding: 1px 10px; border-radius: 999px; background: var(--primary-50); color: var(--primary-800); font-size: 12px; font-weight: 700; margin-left: 6px; white-space: nowrap; }
.row > .chip:first-child, .challenge-tags .chip { margin-left: 0; }
.chip-gray { background: #eceff1; color: var(--text-2); }
.chip-warn { background: #fff3e0; color: #e65100; }
.chip-light { background: rgba(255, 255, 255, 0.18); color: #fff; margin: 8px 0 0; }
.chip-band { margin: 0; padding: 3px 14px; font-size: 13px; }
.chip-live { background: #e8f5e9; color: #1b5e20; }
.chip-live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #2e7d32; margin-right: 6px; animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.badge { display: inline-flex; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #fff; }
.badge-AC { background: var(--ok); }
.badge-WA { background: var(--warn); color: #4a3000; }
.badge-RE { background: var(--bad); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs a, .tabs button {
  display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px; font: 700 14px var(--font-sans);
  color: var(--text-2); border: 0; border-bottom: 3px solid transparent; background: none; white-space: nowrap; cursor: pointer;
}
.tabs a:hover, .tabs button:hover { color: var(--primary-700); text-decoration: none; }
.tabs a.active, .tabs button.active { color: var(--primary-700); border-bottom-color: var(--primary-700); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.seg button { background: var(--surface); border: 0; padding: 4px 12px; font: 700 12px var(--font-sans); color: var(--text-2); cursor: pointer; }
.seg button.active { background: var(--primary-50); color: var(--primary-800); }

/* ---------- statement (Markdown) ---------- */
.statement { line-height: 1.85; overflow-wrap: anywhere; }
.statement > :first-child { margin-top: 0; }
.statement > :last-child { margin-bottom: 0; }
.statement p { margin: 0 0 14px; }
.statement ul, .statement ol { padding-left: 24px; margin: 0 0 14px; }
.statement code { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); padding: 1px 6px; border-radius: 4px; font-size: 0.92em; }
.statement pre { background: var(--surface-2); border: 1px solid var(--border); padding: 12px 14px; border-radius: 6px; overflow-x: auto; font-size: 13px; line-height: 1.6; }
.statement pre code { background: none; border: none; padding: 0; }
.statement blockquote { margin: 0 0 14px; padding: 6px 16px; border-left: 4px solid var(--primary-200); color: var(--text-2); }
.statement table { border-collapse: collapse; margin-bottom: 14px; }
.statement th, .statement td { border: 1px solid var(--border); padding: 6px 12px; }
.statement img { max-width: 100%; height: auto; border-radius: 6px; margin: 4px 0; }
.statement h2 { font-size: 18px; margin-top: 24px; }
.section-title { font-size: 17px; font-weight: 700; color: var(--primary-800); border-left: 4px solid var(--primary-700); padding-left: 10px; margin: 28px 0 12px; }
.statement .section-title:first-child { margin-top: 0; }
.preview { border: 1px dashed var(--border); border-radius: 6px; padding: 14px; min-height: 120px; }

/* ---------- alerts ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 6px; font-size: 14px; margin-bottom: 16px; }
.alert .msi { margin-top: 1px; }
.alert-error { background: #ffebee; color: #b71c1c; border: 1px solid #ffcdd2; }
.alert-ok { background: #e8f5e9; color: #1b5e20; border: 1px solid #c8e6c9; }
.alert-info { background: var(--primary-50); color: var(--primary-900); border: 1px solid var(--primary-100); }
.alert-warn { background: #fff8e1; color: #6d4c00; border: 1px solid #ffe082; }
.alert.center { justify-content: center; }

/* ---------- challenge board ---------- */
.board-toolbar { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.cat-section { margin-bottom: 32px; }
.cat-heading { font-family: 'Lato', var(--font-head); font-size: 30px; font-weight: 400; margin: 0 0 16px; color: var(--text); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 18px; }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  min-height: 112px; padding: 18px 26px; border: 0; border-radius: 3px; cursor: pointer;
  background: var(--tile); color: #fff; font-family: var(--font-sans); box-shadow: var(--shadow-1); transition: opacity 0.15s;
}
/* Hover only fades the tile; it does not move or change hue. */
.tile:hover { opacity: 0.78; }
.tile.solved { background: var(--tile-solved); }
.tile.partial { box-shadow: inset 0 -4px 0 var(--warn), var(--shadow-1); }
.tile.hidden-chal { opacity: 0.6; outline: 2px dashed #90a4ae; outline-offset: -4px; }
.tile-name { font-size: 16px; font-weight: 700; letter-spacing: 0.03em; overflow-wrap: anywhere; text-align: center; }
.tile-value { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile-check { position: absolute; top: 6px; right: 8px; }
.tile-flag { position: absolute; top: 6px; left: 8px; font-size: 11px; font-weight: 700; color: #cfd8dc; }

/* challenge window (layout follows CTFd's) */
.modal.chal-modal { max-width: 800px; }
.chal-modal .modal-head { padding: 14px 14px 0 24px; }
.chal-head-slot { flex: 1; min-width: 0; }
.modal-tabs { margin: 0; border-bottom: 1px solid var(--border); }
.chal-pane { padding-top: 16px; }
.challenge-name { text-align: center; font-size: 30px; font-weight: 500; letter-spacing: 1px; margin: 8px 0 2px; overflow-wrap: anywhere; }
.challenge-value { text-align: center; font-size: 24px; font-weight: 400; margin: 0 0 8px; font-variant-numeric: tabular-nums; }
.challenge-tags { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.challenge-author { text-align: center; margin-bottom: 10px; }
.chal-pane > .statement { margin: 16px 0; }
.chal-files { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.chal-files .btn { min-width: 0; max-width: 100%; }
.file-name { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hints { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.hint-box { padding: 8px 14px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; }
.hint-box summary { display: flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 700; color: var(--text-2); }
.hint-box[open] summary { margin-bottom: 6px; }
.solution-note { margin-bottom: 12px; }
.answer-area { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 8px; }
.answer-row { display: flex; gap: 12px; align-items: flex-start; }
.answer { flex: 1; min-width: 0; }
.answer-input { height: 44px; font-size: 15px !important; }
.answer-row > .btn { flex: none; min-width: 96px; height: 44px; padding: 0 24px; }
.answer-row.stacked > .btn { flex: none; }
.answer-hint { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--text-3); margin-top: 4px; }
.answer-preview { color: var(--ok); font-weight: 700; }
.answer-preview.bad { color: var(--bad); }
.attempts { text-align: center; margin: 0 0 10px; }
.answer-msg { margin-top: 12px; }
.answer-msg .alert { margin: 0; justify-content: center; text-align: center; }
.solved-box { margin: 0; align-items: center; justify-content: center; }
.next-row { display: flex; justify-content: center; margin-top: 12px; }
.next-row:empty { display: none; }
.choice-list { display: grid; gap: 6px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--primary-700); background: var(--primary-50); }
.map-box { height: 300px; margin-top: 10px; border-radius: 6px; border: 1px solid var(--border); overflow: hidden; }

/* ---------- charts ---------- */
.chart { position: relative; }
.plot { width: 100%; }
.plot svg { display: block; width: 100%; height: auto; overflow: visible; }
.plot .grid { stroke: #eceff1; stroke-width: 1; }
.plot .axis { stroke: #b0bec5; stroke-width: 1; }
.plot .tick { fill: var(--text-2); font: 11px var(--font-sans); }
.plot .point-label { fill: var(--text-2); font: 11px var(--font-sans); }
.plot .mark { stroke: #fff; stroke-width: 2; }
.plot .crosshair { stroke: #90a4ae; stroke-width: 1; stroke-dasharray: 3 3; }
.plot .hover-ring { fill: none; stroke-width: 2; }
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; margin: 4px 0 10px; font-size: 13px; color: var(--text-2); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; flex: none; }
.swatch.line { width: 18px; height: 3px; }
.chart-tip { position: absolute; z-index: 5; min-width: 190px; background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-size: 13px; pointer-events: none; box-shadow: var(--shadow-4); }
.tip-row { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; }
.tip-row.hot { font-weight: 700; }
.pbar { display: flex; height: 22px; border-radius: 4px; overflow: hidden; gap: 2px; background: #fff; }
.pbar span { min-width: 3px; }
.pbar-wrap .legend { justify-content: flex-start; margin-top: 10px; }

/* ---------- admin ---------- */
.file-row { display: grid; grid-template-columns: 20px 1fr 2fr auto auto; gap: 8px; align-items: center; }
.hint-edit { padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); }
.hint-edit .row { margin-bottom: 6px; }
.test-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; padding: 12px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); }
.test-row input { flex: 1; min-width: 220px; }
.test-result { font-weight: 700; }
.test-result.ok { color: var(--ok); } .test-result.bad { color: var(--bad); } .test-result.warn { color: #e65100; }
.save-bar { position: sticky; bottom: 0; z-index: 20; display: flex; gap: 8px; align-items: center; margin-top: 16px; padding: 12px 16px; background: rgba(255, 255, 255, 0.96); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-4); }
.dropzone { display: grid; place-items: center; gap: 4px; text-align: center; padding: 28px; border: 2px dashed var(--border); border-radius: 8px; cursor: pointer; color: var(--text-2); }
.dropzone.over, .dropzone:hover { border-color: var(--primary-700); background: var(--primary-50); }
.code-list { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 12px; font-size: 14px; user-select: all; white-space: pre-wrap; }

/* ---------- misc ---------- */
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.mono { font-family: var(--font-mono); }
.empty { padding: 44px 20px; text-align: center; color: var(--text-3); }
.empty::before { content: 'inbox'; font-family: 'Material Symbols Rounded'; font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 48; display: block; font-size: 40px; line-height: 1; margin-bottom: 10px; opacity: 0.55; }
.empty.small::before { display: none; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 48px 0; color: var(--text-3); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--primary-700); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
footer.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 20px; text-align: center; color: var(--text-3); font-size: 13px; }

/* ---------- overlays ---------- */
.modal-overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: start center; padding: 6vh 16px 24px; overflow-y: auto; background: rgba(0, 0, 0, 0.45); }
.modal { width: 100%; max-width: 460px; background: var(--surface); border-radius: 10px; box-shadow: var(--shadow-4); }
.modal.wide { max-width: min(1100px, 96vw); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 14px 10px 24px; }
.modal-title { font-weight: 700; font-size: 16px; }
.modal-body { padding: 4px 24px 24px; }
.lightbox img { display: block; max-width: 100%; max-height: 72vh; margin: 0 auto; border-radius: 4px; }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 6px; background: #323232; color: #fff; box-shadow: var(--shadow-4); font-size: 14px; transition: opacity 0.3s, transform 0.3s; }
.toast.ok .msi { color: #81c784; } .toast.bad .msi { color: #e57373; } .toast.info .msi { color: #90caf9; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- Leaflet ---------- */
.leaflet-container { font-family: var(--font-sans); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .menu-btn { display: inline-grid; }
  .nav-collapse { display: none; position: absolute; top: 56px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0; padding: 8px 12px 14px; background: var(--primary-800); box-shadow: var(--shadow-4); }
  body.nav-open .nav-collapse { display: flex; }
  .nav, .app-bar-right { flex-direction: column; align-items: stretch; }
  .nav a, .app-bar-right a { padding: 10px 12px; }
  .app-bar-right { border-top: 1px solid rgba(255, 255, 255, 0.15); padding-top: 6px; margin-top: 6px; }
}
@media (max-width: 640px) {
  .container { padding: 16px 12px 48px; }
  .app-bar-inner { padding: 0 12px; }
  .page-band { padding: 32px 16px; }
  .page-band h1 { font-size: 28px; }
  .profile-stat { font-size: 22px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 14px 10px; min-height: 96px; }
  .cat-heading { font-size: 24px; }
  .answer-row > .btn { min-width: 0; padding: 0 16px; }
  .challenge-name { font-size: 24px; }
  .modal-overlay { padding: 0; }
  .modal { border-radius: 0; min-height: 100vh; }
  .modal-body { padding: 4px 16px 20px; }
  .file-row { grid-template-columns: 20px 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------- content warning gate ---------- */
.cw-gate { text-align: center; padding: 18px 8px 8px; }
.cw-icon { color: #ef6c00; }
.cw-gate h3 { margin: 6px 0 10px; font-size: 20px; }
.cw-text { display: inline-block; text-align: left; margin: 0 0 12px; padding: 12px 16px; border-radius: 6px; background: #fff8e1; border: 1px solid #ffe082; color: #6d4c00; }
.cw-actions { display: flex; justify-content: center; gap: 10px; margin: 18px 0 14px; flex-wrap: wrap; }
.cw-actions .btn { height: 40px; padding: 0 20px; }
.cw-skip { justify-content: center; color: var(--text-2); font-size: 13px; }

/* ---------- map answer ---------- */
.answer-row.stacked { flex-direction: column; align-items: stretch; }
.answer-row.stacked > .btn { align-self: flex-end; }
.map-answer { height: 380px; margin-top: 0; }
.map-answer.disabled { pointer-events: none; opacity: 0.6; }
.coords-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.map-help { margin: 0; }
.map-search { width: 280px; max-width: calc(100vw - 120px); background: #fff; border-radius: 6px; box-shadow: var(--shadow-2); font-family: var(--font-sans); }
.map-search-bar { display: flex; align-items: center; gap: 4px; padding: 0 8px; }
.map-search-bar input { border: 0; box-shadow: none; padding: 8px 4px; font-size: 13px; }
.map-search-bar input:focus { box-shadow: none; }
.map-search-icon { display: grid; place-items: center; width: 22px; color: var(--text-2); }
.map-search-icon .spinner { width: 14px; height: 14px; }
.map-search-results { max-height: 220px; overflow-y: auto; border-top: 1px solid var(--border); }
.map-search-results button { display: block; width: 100%; text-align: left; padding: 7px 10px; border: 0; border-bottom: 1px solid #f0f0f0; background: #fff; font: 12px/1.5 var(--font-sans); color: var(--text); cursor: pointer; }
.map-search-results button:hover { background: var(--primary-50); }
.map-search-empty { padding: 8px 10px; font-size: 12px; color: var(--text-3); }

/* ---------- own submissions ---------- */
.end-row { margin-bottom: 8px; }
.sub-cell { display: flex; align-items: center; gap: 4px; }
.sub-value { font-family: var(--font-mono); font-size: 13px; overflow-wrap: anywhere; }
.sub-value.masked { color: #e57373; letter-spacing: 0.08em; }
.icon-btn.eye { width: 30px; height: 30px; color: var(--primary-700); flex: none; }
table.tbl.subs td { vertical-align: middle; }
.tile-flag .msi { color: #ffcc80; }
.tile.hidden-chal:hover { opacity: 0.45; }

/* ---------- notifications ---------- */
.notice-card h3 { margin-bottom: 10px; }
.notice-body { margin: 0; padding-left: 15px; border-left: 4px solid var(--primary-200); }
.notice-body .statement { margin-bottom: 6px; }

/* ---------- admin ---------- */
.stat-summary { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 40px; text-align: center; font-size: 15px; }
.stat-summary b { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; margin-right: 4px; }
.stat-sub { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 32px; margin-top: 8px; font-size: 13px; color: var(--text-2); }
.solve-bars { display: grid; grid-template-columns: minmax(90px, 180px) 1fr 96px; gap: 7px 12px; align-items: center; font-size: 13px; }
.solve-bars .bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.solve-bars .bar-track { height: 16px; background: #eceff1; border-radius: 0 4px 4px 0; overflow: hidden; }
.solve-bars .bar-fill { display: block; height: 100%; background: #2a78d6; border-radius: 0 4px 4px 0; }
.solve-bars .bar-val { text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; }
.hist { display: flex; align-items: flex-end; gap: 2px; height: 180px; }
.hist-col { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.hist-bar { width: 100%; background: #2a78d6; border-radius: 4px 4px 0 0; }
.hist-n { font-size: 11px; color: var(--text-2); margin-bottom: 2px; }
.hist-axis { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--text-2); border-top: 1px solid #b0bec5; padding-top: 4px; }
.check-col { width: 36px; }
.check-col input { width: 16px; height: 16px; accent-color: var(--primary-700); vertical-align: middle; }
.toolbar-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar-row input[type='text'] { flex: 1; min-width: 200px; width: auto; }
.toolbar-row select { width: auto; }
