:root {
  --green: #1a5c38;
  --green-dark: #124327;
  --bg: #f2f5f0;
  --card: #ffffff;
  --text: #1d2b22;
  --muted: #6b7a70;
  --ok: #1a7f37;
  --warn: #b45309;
  --danger: #b3261e;
  --border: #dde5dd;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.45;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: var(--green);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { color: #fff; text-decoration: none; font-weight: 700; }
.me { display: flex; align-items: center; gap: 8px; }
.me-name { font-weight: 600; }
.logout { color: #d7e8dc; font-size: 0.85em; }

.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  display: inline-flex; align-items: center; justify-content: center;
}
.avatar-fallback { color: var(--green); font-weight: 700; }

.container { max-width: 640px; margin: 0 auto; padding: 14px 12px 60px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.center { text-align: center; }
.hero h1 { margin: 8px 0; }
.intro { white-space: pre-line; }

h1 { font-size: 1.5rem; }
h2 { font-size: 1.3rem; margin: 4px 0 8px; }
h3 { font-size: 1.05rem; margin: 0 0 8px; }

.btn {
  display: inline-block;
  padding: 12px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:active { background: var(--green-dark); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-big { width: 100%; padding: 15px 18px; font-size: 1.1rem; text-align: center; margin-top: 6px; }
.btn-mini { padding: 2px 8px; font-size: 0.8rem; border-radius: 8px; }
.btn:disabled { opacity: 0.6; }
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btnrow form { display: flex; gap: 6px; align-items: center; margin: 0; }

label { display: block; font-weight: 600; margin: 12px 0 4px; }
input[type="text"], input[type="password"], select {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  margin-bottom: 10px;
}
input[type="file"] { width: 100%; margin: 8px 0; font-size: 0.95rem; }
.file-input-hidden { display: none; }
.multi-list { list-style: none; margin: 8px 0; padding: 0; }
.multi-list li { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-top: 1px solid var(--border); }
.multi-list li:first-child { border-top: none; }
.mini-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; display: block; }
.multi-name { flex: 1; font-weight: 600; }
.file-chosen { color: var(--ok); font-weight: 600; }
.file-preview img.preview, .file-preview video.preview { max-height: 220px; margin: 8px 0 4px; }
.upload-form .btnrow { margin: 8px 0; }
.upload-form button[type="submit"] { width: 100%; margin-top: 6px; }

.alert {
  background: #fdecea;
  border: 1px solid #f5c6c0;
  color: var(--danger);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.banner {
  background: #e6f4ea;
  border: 1px solid #b7dfc2;
  color: var(--ok);
  font-weight: 700;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
  text-align: center;
  animation: pop 0.4s ease;
}
@keyframes pop { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.station-order { color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; }
.station-desc { white-space: pre-line; }

.task-head { display: flex; align-items: center; gap: 8px; }
.task-head h3 { margin: 0; flex: 1; }
.task-type { font-size: 1.3rem; }
.tag {
  font-size: 0.72rem;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 2px 8px;
}
.task-question { margin: 8px 0; }

.status { font-weight: 700; margin: 8px 0 4px; }
.status.ok, .ok { color: var(--ok); }
.status.pending, .pending { color: var(--warn); }
.status.rejected, .rejected { color: var(--danger); }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 0.9rem; }

.checklist { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  background: var(--bg);
  color: var(--muted);
}
.chip-ok { background: #e6f4ea; border-color: #b7dfc2; color: var(--ok); }
.chip-pending { background: #fef3e2; border-color: #f5d9ab; color: var(--warn); }
.chip-rejected { background: #fdecea; border-color: #f5c6c0; color: var(--danger); }

.progress {
  position: relative;
  height: 22px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0;
}
.progress-bar { height: 100%; background: var(--green); transition: width 0.2s; }
.progress-bar.indeterminate { animation: pulsebar 1.2s ease-in-out infinite; }
@keyframes pulsebar { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.progress-label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; color: var(--text);
}
.upload-error { color: var(--danger); font-weight: 600; }
.hidden { display: none; }

.checkin-result { font-weight: 700; min-height: 1.4em; }
.checkin-result.ok { color: var(--ok); }
.checkin-result.warn { color: var(--warn); }

.waiting { background: #fef8e7; border-color: #f3e3ae; }
.past ul { margin: 0; padding-left: 20px; }

.preview { max-width: 100%; max-height: 320px; border-radius: 10px; display: block; margin: 8px 0; }
.memory { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 10px; }
blockquote { margin: 8px 0; padding: 8px 12px; background: var(--bg); border-radius: 10px; }

.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.gallery-grid figure { margin: 0; }
.gallery-grid img, .gallery-grid video { width: 100%; border-radius: 10px; display: block; }
.gallery-grid figcaption { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }

/* velin */
.pending-item { border-top: 1px solid var(--border); padding: 10px 0; }
.pending-item:first-of-type { border-top: none; }
.pending-head small { color: var(--muted); margin-left: 6px; }
.table-wrap { overflow-x: auto; }
.matrix { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
.matrix th, .matrix td { border: 1px solid var(--border); padding: 6px 8px; text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; font-weight: 600; }
.inline { display: inline; }
.checkin-list { margin: 0; padding-left: 18px; }
.checkin-list li { margin-bottom: 4px; }
.final-player { width: 100%; border-radius: 12px; background: #000; margin: 10px 0; }
.bonus-heading { margin-top: 22px; }
.map-wrap { position: relative; }
#map-canvas { width: 100%; border: 1px solid var(--border); border-radius: 12px; display: block; }
.map-clock {
  position: absolute; top: 10px; right: 10px;
  background: rgba(0,0,0,0.65); color: #fff;
  font-weight: 700; font-variant-numeric: tabular-nums;
  padding: 4px 10px; border-radius: 8px;
}
.map-controls { margin-top: 10px; }
.map-controls select { width: auto; margin: 0; }
.map-follow { display: inline-flex; align-items: center; gap: 6px; font-size: 0.9rem; margin: 0; font-weight: 600; }
.qr-img { width: min(80vw, 420px); image-rendering: pixelated; margin: 12px auto; display: block; }
.qr-url { font-size: 1.4rem; font-weight: 800; letter-spacing: 0.04em; margin: 4px 0; }
@media print {
  .topbar { display: none; }
  .card { border: none; box-shadow: none; }
}

.state-running { color: var(--ok); }
.state-setup { color: var(--warn); }
.state-finished { color: var(--danger); }
