:root {
  --bg: #f2f2f7;
  --card: #ffffff;
  --ink: #1d1d1f;
  --secondary: #6e6e73;
  --tertiary: #86868b;
  --line: rgba(60, 60, 67, 0.12);
  --fill: #f2f2f7;
  --blue: #007aff;
  --blue-press: #0066d6;
  --green: #34c759;
  --orange: #ff9f0a;
  --red: #ff3b30;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
  --radius: 18px;
  --radius-sm: 12px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 22px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: rgba(242, 242, 247, 0.78);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}
.brand strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.brand small {
  color: var(--secondary);
  font-size: 12px;
}
.seal {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: #111;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}
.seal.lg {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  font-size: 28px;
  margin: 0 auto 16px;
}
nav { display: flex; gap: 6px; }
nav a {
  color: var(--blue);
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 980px;
}
nav a:hover { background: rgba(0, 122, 255, 0.08); }

.wrap {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto 56px;
}
.hero { padding: 28px 0 8px; }
.hero.compact { padding-top: 20px; }
.eyebrow {
  margin: 0 0 6px;
  color: var(--secondary);
  font-size: 13px;
  font-weight: 600;
}
h1, h2 { margin: 0 0 8px; letter-spacing: -0.03em; }
h1 {
  font-size: clamp(34px, 6vw, 48px);
  font-weight: 700;
  line-height: 1.08;
}
h2 { font-size: 20px; font-weight: 650; }
.lead {
  max-width: 36em;
  color: var(--secondary);
  line-height: 1.55;
  font-size: 17px;
}

.section-label {
  margin: 8px 4px 8px;
  color: var(--tertiary);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 22px;
}
.meta-grid article,
.card,
.banner {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.meta-grid article { padding: 16px 18px; }
.meta-grid span {
  display: block;
  color: var(--secondary);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}
.meta-grid strong {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.meta-grid strong small {
  display: block;
  margin-top: 2px;
  color: var(--secondary);
  font-size: 13px;
  font-weight: 500;
}

.status { color: var(--orange); }
.status-open { color: var(--green); }
.status-ongoing { color: var(--blue); }
.status-finished { color: var(--tertiary); }

.banner {
  padding: 14px 18px;
  margin: 18px 0 8px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}
.banner.venue {
  display: grid;
  gap: 4px;
}
.banner.venue strong {
  font-size: 16px;
  font-weight: 650;
}
.banner.venue span {
  color: var(--secondary);
  font-size: 14px;
}
.layout {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: 18px;
  margin-top: 10px;
  align-items: start;
}
.stack { display: grid; gap: 0; align-content: start; }
.card { padding: 8px 0 12px; }
.card.inset { padding: 6px 0 14px; overflow: hidden; }
.card > h2,
.card-head,
.form,
.hint,
.closed,
.inline-form,
.muted,
.cancel-box {
  padding-left: 18px;
  padding-right: 18px;
}
.card > h2 { padding-top: 12px; }
.card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  padding-top: 14px;
  padding-bottom: 4px;
}
.card-head p, .hint, .muted { color: var(--secondary); }
.hint { margin: 0 0 12px; font-size: 14px; line-height: 1.5; }

.chain {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}
.chain li {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 18px;
  border-top: 0.5px solid var(--line);
}
.chain em {
  flex: 0 0 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--fill);
  color: var(--ink);
  font-style: normal;
  font-size: 14px;
  font-weight: 650;
}
.chain strong { display: block; font-size: 17px; font-weight: 600; }
.chain span { color: var(--secondary); font-size: 13px; }
.empty, td.empty {
  color: var(--secondary);
  justify-content: center;
  border: 0;
  padding: 28px 18px;
  text-align: center;
}

.safety ul {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}
.safety li {
  padding: 12px 18px;
  border-top: 0.5px solid var(--line);
  color: var(--secondary);
  font-size: 15px;
  line-height: 1.55;
}

.form { display: grid; gap: 10px; margin-top: 4px; }
.form.compact { margin-top: 12px; }
label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--secondary);
  font-weight: 500;
}
input, select, textarea, button { font: inherit; color: var(--ink); }
input, select, textarea {
  width: 100%;
  border: 0;
  background: var(--fill);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 17px;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.18);
}
button, .btn {
  appearance: none;
  border: 0;
  background: var(--blue);
  color: #fff;
  padding: 13px 18px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 980px;
  font-size: 16px;
  font-weight: 600;
}
button:hover, .btn:hover { background: var(--blue-press); }
.ghost, button.ghost, a.ghost {
  background: rgba(0, 122, 255, 0.1);
  color: var(--blue);
}
.ghost:hover, button.ghost:hover, a.ghost:hover {
  background: rgba(0, 122, 255, 0.16);
}
.form-msg { margin: 0; font-size: 14px; }
.form-msg.ok { color: var(--green); }
.form-msg.err { color: var(--red); }
.closed { line-height: 1.7; color: var(--secondary); padding-bottom: 8px; }
.cancel-box { margin-top: 8px; color: var(--secondary); padding-bottom: 4px; }
.cancel-box summary { cursor: pointer; color: var(--blue); font-size: 15px; }

.login-wrap { display: grid; place-items: center; min-height: 58vh; }
.login-card {
  width: min(420px, 100%);
  text-align: center;
  padding: 28px 0 24px;
}
.login-card h1 { font-size: 28px; }
.login-card .form, .login-card .hint { text-align: left; }

.admin-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 8px 0 10px;
}
.admin-tools .tool {
  flex: 1 1 220px;
  max-width: 280px;
}
.admin-tools .tool label { margin: 0; }
.admin-tools form, .inline-form { margin: 0; }
.inline-form { padding-bottom: 4px; }
.table-wrap { overflow: auto; margin-top: 4px; }
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 12px 14px;
  border-top: 0.5px solid var(--line);
  white-space: nowrap;
  font-size: 15px;
}
th {
  color: var(--secondary);
  font-weight: 500;
  font-size: 12px;
  border-top: 0;
}
.link-danger {
  background: none;
  color: var(--red);
  padding: 0;
  border: 0;
  border-radius: 0;
  font-weight: 500;
}
.foot {
  text-align: center;
  color: var(--tertiary);
  font-size: 12px;
  padding: 0 20px 40px;
  line-height: 1.7;
}

@media (max-width: 860px) {
  .topbar { padding-left: 16px; padding-right: 16px; }
  .meta-grid, .layout { grid-template-columns: 1fr; }
  .card-head { flex-direction: column; gap: 2px; }
}
