:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --ink: #17201d;
  --muted: #62706a;
  --line: #d8dfdb;
  --panel: #ffffff;
  --panel-soft: #eef4f1;
  --accent: #0f766e;
  --accent-dark: #0b5d58;
  --accent-soft: #dff3ef;
  --danger: #b42318;
  --warn: #946200;
  --ok: #167348;
  --shadow: 0 18px 50px rgba(22, 32, 29, 0.08);
  font-family: Inter, "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.12), transparent 32rem),
    linear-gradient(180deg, #f8faf9 0%, var(--bg) 100%);
  color: var(--ink);
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.hidden { display: none !important; }

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  letter-spacing: 0;
}

.mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-weight: 950;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  gap: 22px;
  align-items: stretch;
}

.intro {
  padding: 20px 0;
}

h1, h2, h3, p { margin-top: 0; }
h1 {
  font-size: clamp(2.2rem, 6vw, 4.8rem);
  line-height: 0.98;
  letter-spacing: 0;
  margin-bottom: 18px;
}
h2 { font-size: 1.3rem; letter-spacing: 0; margin-bottom: 14px; }
h3 { font-size: 1.02rem; letter-spacing: 0; margin-bottom: 8px; }
p { line-height: 1.65; }

.lead {
  color: #40504a;
  font-size: 1.02rem;
  max-width: 56ch;
}

.notice-list {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.notice-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: #33433e;
}

.notice-item span {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 900;
}

.panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.panel.soft {
  background: rgba(238, 244, 241, 0.8);
  box-shadow: none;
}

.stack { display: grid; gap: 14px; }
.stack-lg { display: grid; gap: 20px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.span-2 { grid-column: span 2; }

label {
  display: grid;
  gap: 7px;
  color: #2d3b36;
  font-size: 0.92rem;
  font-weight: 800;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 44px;
  padding: 11px 12px;
  outline: none;
}

textarea {
  min-height: 106px;
  resize: vertical;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.checkbox {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: flex-start;
  font-weight: 700;
  color: #33433e;
}

.checkbox input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin-top: 4px;
}

.btn {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  font-weight: 900;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn.primary:hover { background: var(--accent-dark); }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 34px; padding: 0 10px; font-size: 0.86rem; }
.btn:disabled { cursor: not-allowed; opacity: 0.62; }

.status {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
  overflow-wrap: anywhere;
}
.status.ok { background: #eaf8f0; color: var(--ok); border-color: #b9dfca; }
.status.warn { background: #fff8e7; color: var(--warn); border-color: #ebd393; }
.status.error { background: #fff1ef; color: var(--danger); border-color: #efbab4; }

.invite-copy {
  display: grid;
  gap: 10px;
  align-items: stretch;
}

.invite-copy-title {
  font-weight: 950;
}

.copy-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.copy-link-text {
  min-height: 38px;
  border: 1px solid #a9d8c7;
  border-radius: 8px;
  background: #fff;
  color: #064e45;
  padding: 9px 10px;
  font-family: Consolas, "Noto Sans Mono", monospace;
  font-size: 0.84rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  user-select: text;
}

.camera-box {
  display: grid;
  gap: 10px;
}

video, canvas, .photo-preview {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1715;
  object-fit: cover;
}

.photo-preview {
  display: block;
}

.muted { color: var(--muted); }
.fineprint {
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.55;
}

.admin-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.submission-list {
  display: grid;
  gap: 9px;
  max-height: 620px;
  overflow: auto;
  padding-right: 4px;
}

.submission-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.submission-item.active,
.submission-item:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.item-title { font-weight: 950; margin-bottom: 4px; overflow-wrap: anywhere; }
.item-meta { color: var(--muted); font-size: 0.84rem; line-height: 1.5; overflow-wrap: anywhere; }

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.fact {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 11px;
}
.fact span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  margin-bottom: 4px;
}
.fact strong {
  display: block;
  font-size: 0.98rem;
  overflow-wrap: anywhere;
}

.photo-frame {
  width: 100%;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf2ef;
  object-fit: cover;
}

.code {
  font-family: Consolas, "Noto Sans Mono", monospace;
  font-size: 0.86rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.empty {
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 920px) {
  .shell { width: min(100% - 22px, 720px); padding-top: 18px; }
  .topbar { align-items: flex-start; }
  .hero, .admin-layout, .detail-grid, .grid-2, .grid-3, .facts { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .intro { padding: 4px 0; }
  h1 { font-size: clamp(2rem, 14vw, 3.6rem); }
  .nav-actions { justify-content: flex-start; }
  .copy-link-row { grid-template-columns: 1fr; }
}
