:root {
  --brand: #5b1a2e;
  --brand-2: #8a2f45;
  --paper: #f6f1ea;
  --card: #fffdfb;
  --ink: #231a1c;
  --muted: #7d6e70;
  --line: #e7dcd2;
  --accent: #b08d57;
  --ok: #2f6b4f;
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Noto Sans SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background:
    radial-gradient(1100px 520px at 50% -12%, #fff8f0 0%, rgba(255, 248, 240, 0) 62%),
    radial-gradient(800px 500px at 100% 100%, rgba(91, 26, 46, 0.05) 0%, rgba(91, 26, 46, 0) 60%),
    var(--paper);
  min-height: 100vh;
}

.shell {
  max-width: 680px;
  margin: 0 auto;
  padding: 18px 18px calc(120px + env(safe-area-inset-bottom));
  min-height: 100vh;
}

.brandbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 2px 18px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.02em;
}

.mark {
  width: 18px;
  height: 18px;
  display: inline-block;
  background:
    linear-gradient(135deg, var(--brand) 0 45%, transparent 45% 55%, var(--brand) 55% 100%);
  transform: rotate(45deg);
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.brandname { font-weight: 600; color: var(--brand); letter-spacing: 0.08em; }
.sessionlabel { margin-left: auto; max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.view { animation: fade 0.35s ease both; }

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
  font-weight: 600;
}

h1 {
  font-family: "Songti SC", "Noto Serif SC", "STSong", Georgia, serif;
  font-size: 26px;
  line-height: 1.35;
  margin: 0 0 10px;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: 0.01em;
}

h2 {
  font-family: "Songti SC", "Noto Serif SC", "STSong", Georgia, serif;
  font-size: 20px;
  margin: 0 0 8px;
  color: var(--brand);
}

.muted { color: var(--muted); font-size: 14px; line-height: 1.7; }

.card {
  background: var(--card);
  border: 1px solid rgba(91, 26, 46, 0.08);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 12px 30px rgba(60, 30, 40, 0.05);
  margin-bottom: 14px;
}

.card.center { text-align: center; padding: 30px 22px; }

.label {
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 8px;
}

.story {
  margin: 0;
  font-size: 15px;
  line-height: 1.8;
  color: #3a2c2f;
  white-space: pre-wrap;
}

.rulehint {
  font-size: 13px;
  color: var(--muted);
  padding: 2px 4px 12px;
  display: flex;
  gap: 6px;
  align-items: center;
}

.rulehint::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.options { display: grid; gap: 10px; }

.option {
  position: relative;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  padding: 14px 14px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.6;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.08s ease;
  -webkit-tap-highlight-color: transparent;
}

.option:active { transform: scale(0.995); }

.option .letter {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f2e6da;
  color: var(--brand);
  font-weight: 700;
  font-size: 13px;
  margin-top: 1px;
}

.option .otext { flex: 1; }

.option.selected {
  border-color: var(--brand);
  background: #fbf1ee;
  box-shadow: 0 0 0 3px rgba(91, 26, 46, 0.06);
}

.option.selected .letter { background: var(--brand); color: #fff; }

.option.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: #f4efea;
}

.option .tag {
  position: absolute;
  right: 12px;
  bottom: 10px;
  font-size: 11px;
  color: var(--muted);
  background: #efe6dd;
  border-radius: 999px;
  padding: 2px 8px;
}

.submitbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 680px;
  padding: 12px 18px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(246, 241, 234, 0.98) 60%, rgba(246, 241, 234, 0.86));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(91, 26, 46, 0.08);
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 10;
}

.count { font-size: 13px; color: var(--muted); white-space: nowrap; }
.count b { color: var(--brand); font-size: 16px; }

button, input { font-family: inherit; }

.primary {
  flex: 1;
  height: 50px;
  border: 0;
  border-radius: 14px;
  background: var(--brand);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(91, 26, 46, 0.22);
  transition: background 0.15s ease, transform 0.08s ease, opacity 0.15s ease;
}

.primary:active { transform: translateY(1px); }
.primary:disabled { background: #cbb9b3; box-shadow: none; cursor: not-allowed; }

form.stack { display: grid; gap: 12px; margin-top: 18px; text-align: left; }

label.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }

input {
  height: 48px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  font-size: 16px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(91, 26, 46, 0.08); }

.codebox { display: flex; gap: 10px; margin-top: 18px; }
.codebox input { flex: 1; text-transform: uppercase; letter-spacing: 0.28em; font-size: 18px; text-align: center; font-weight: 600; }
.codebox button { flex: none; width: 110px; }

.waiting { text-align: center; padding: 42px 20px; }
.waiting .spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 20px;
  border-radius: 50%;
  border: 3px solid rgba(91, 26, 46, 0.15);
  border-top-color: var(--brand);
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.dots::after {
  content: "";
  animation: dots 1.6s steps(4, end) infinite;
}

@keyframes dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
  100% { content: ""; }
}

.check {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(47, 107, 79, 0.1);
  margin: 0 auto 18px;
  position: relative;
}

.check::after {
  content: "";
  position: absolute;
  left: 23px;
  top: 16px;
  width: 16px;
  height: 28px;
  border: solid var(--ok);
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}

.offline {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fff4e5;
  color: #8a5a12;
  font-size: 13px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  max-width: 88%;
  background: rgba(35, 26, 28, 0.92);
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
  padding: 12px 16px;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 30;
  text-align: center;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

.footnote {
  margin-top: 16px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
  text-align: center;
}

@media (min-width: 720px) {
  .shell { padding-top: 28px; }
  h1 { font-size: 30px; }
  .option:hover { border-color: #c9b3a8; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
