:root {
  --ink: #e8eef8;
  --ink-deep: #0f1624;
  --muted: #8b9bb8;
  --panel: rgba(18, 28, 48, 0.92);
  --panel-light: rgba(255, 255, 255, 0.96);
  --lantern: #ff9f43;
  --lantern-deep: #e67700;
  --moon: #7ec8e3;
  --wolf: #c92a2a;
  --seer: #339af0;
  --village: #51cf66;
  --font-d: "ZCOOL KuaiLe", "Noto Sans SC", sans-serif;
  --font-b: "Noto Sans SC", system-ui, sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: var(--font-b);
  color: var(--ink);
  font-size: 18px;
  line-height: 1.5;
  background: #0a101c;
}

.scene {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 55% 40% at 15% 5%, rgba(255, 159, 67, 0.18), transparent 55%),
    radial-gradient(ellipse 45% 35% at 90% 8%, rgba(126, 200, 227, 0.16), transparent 50%),
    radial-gradient(ellipse 60% 45% at 50% 100%, rgba(201, 42, 42, 0.1), transparent 55%),
    linear-gradient(168deg, #152238 0%, #0a101c 48%, #0d1526 100%);
  animation: sky-drift 18s ease-in-out infinite alternate;
}

@keyframes sky-drift {
  from { filter: hue-rotate(0deg); }
  to { filter: hue-rotate(8deg); }
}

.topbar {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.2rem 0.4rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.back {
  color: var(--moon);
  text-decoration: none;
  font-weight: 700;
}

.brand {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  flex: 1;
}

.mark {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #ffc078, #ff9f43);
  color: #1a1208;
  font-family: var(--font-d);
  font-size: 1.3rem;
  box-shadow: 0 0 24px rgba(255, 159, 67, 0.35);
  animation: lantern-pulse 2.8s ease-in-out infinite;
}

@keyframes lantern-pulse {
  0%, 100% { box-shadow: 0 0 18px rgba(255, 159, 67, 0.28); }
  50% { box-shadow: 0 0 32px rgba(255, 159, 67, 0.5); }
}

.brand h1 {
  margin: 0;
  font-family: var(--font-d);
  font-size: 1.5rem;
}

.brand p {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.72;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.5rem 1.2rem 3rem;
}

.panel {
  background: var(--panel-light);
  color: var(--ink-deep);
  border-radius: 18px;
  padding: 1.3rem;
  max-width: 560px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.panel h2 {
  margin: 0 0 0.8rem;
  font-family: var(--font-d);
  font-size: 1.8rem;
}

.field {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.field > span {
  font-size: 0.9rem;
  color: #5a6578;
  font-weight: 700;
}

.row { display: flex; gap: 0.5rem; }

.row input,
#minutesInput,
#customWord,
#mayorSelect {
  border: 1px solid #cfd8e6;
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  font: inherit;
  background: #fff;
  color: var(--ink-deep);
}

.row input { flex: 1; }
#minutesInput { max-width: 8rem; }

.name-list {
  list-style: none;
  margin: 0.8rem 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.name-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.7rem;
  background: #eef3f8;
  border-radius: 10px;
  font-weight: 700;
  color: var(--ink-deep);
}

.name-list button {
  border: 0;
  background: transparent;
  color: var(--lantern-deep);
  cursor: pointer;
  font: inherit;
}

.hint { color: #5a6578; font-size: 0.9rem; }
.hint.top { margin: 0 0 0.5rem; }
.hint strong { color: var(--ink-deep); }

.btn {
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  border-radius: 14px;
  padding: 0.75rem 1.3rem;
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn.primary {
  background: linear-gradient(145deg, #ffc078, #ff9f43);
  color: #1a1208;
}

.btn.secondary {
  background: #fff;
  color: var(--ink-deep);
  border: 1px solid #cfd8e6;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.btn.ghost-dark {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.btn.wide { width: 100%; margin-top: 0.6rem; }
.btn.big { font-size: 1.15rem; padding: 1rem 1.6rem; }

.layout { display: grid; gap: 1rem; }
@media (min-width: 900px) {
  .layout { grid-template-columns: 1fr 260px; }
}

.status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1.2rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 1.05rem;
}

.phase-box {
  margin-top: 0.85rem;
  padding: 1.1rem 1.15rem 1.25rem;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid rgba(126, 200, 227, 0.15);
  animation: fade-up 0.35s ease;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.phase-title {
  margin: 0 0 0.5rem;
  font-family: var(--font-d);
  font-size: 1.55rem;
  color: var(--lantern);
}

.msg {
  margin: 0.4rem 0 0.9rem;
  color: var(--muted);
}

.host-box {
  margin: 0.8rem 0;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px dashed rgba(255, 159, 67, 0.35);
}

.host-box.compact { padding: 0.7rem 0.85rem; }

.kicker {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--lantern);
  text-transform: none;
}

.target-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.word-view {
  min-width: 6rem;
  padding: 0.55rem 1rem;
  border-radius: 12px;
  background: #ffec99;
  color: #1a1208;
  font-family: var(--font-d);
  font-size: 1.35rem;
  text-align: center;
}

.word-view.is-hidden {
  filter: blur(10px);
  user-select: none;
  background: #2c3548;
  color: transparent;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.15);
}

.dm-list,
.reveal-roles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.dm-list li,
.reveal-roles li {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
}

.dm-peek {
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  max-width: 9rem;
  text-align: left;
}

.dm-peek .sub {
  display: block;
  margin-top: 0.15rem;
  font-weight: 500;
  color: var(--muted);
  user-select: none;
  word-break: break-all;
}

.dm-peek.is-open .sub {
  color: var(--lantern);
}

.dm-list label {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  cursor: pointer;
  width: 100%;
}

.dm-list input { margin-top: 0.3rem; accent-color: var(--lantern); }

.dm-body { flex: 1; }
.dm-body strong { display: block; color: var(--ink); }
.dm-body span { font-size: 0.88rem; color: var(--muted); }

.role-peeks {
  display: grid;
  gap: 0.4rem;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.role-peek-btn {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  border-radius: 12px;
  padding: 0.65rem 0.7rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}

.role-peek-btn .sub {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  user-select: none;
}

.role-peek-btn.is-open .sub {
  color: var(--lantern);
}

.host-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.timer-wrap {
  text-align: center;
  padding: 0.6rem 0 0.2rem;
}

.timer-wrap.small { padding: 0.2rem 0; }

.timer-label {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.timer {
  margin: 0.15rem 0 0.5rem;
  font-family: var(--font-d);
  font-size: clamp(3.2rem, 12vw, 5.2rem);
  line-height: 1;
  color: var(--moon);
  letter-spacing: 0.04em;
  animation: timer-breathe 2.4s ease-in-out infinite;
}

.timer.is-low { color: #ff8787; animation: timer-urgent 0.7s ease-in-out infinite; }
.timer.is-paused { opacity: 0.55; animation: none; }

@keyframes timer-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

@keyframes timer-urgent {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.04); opacity: 0.85; }
}

.tokens {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
  margin: 0.8rem 0;
}

@media (min-width: 560px) {
  .tokens { grid-template-columns: repeat(5, 1fr); }
}

.tok {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.75rem 0.4rem 0.85rem;
  border-radius: 16px;
  border: 2px solid transparent;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  transition: transform 0.12s ease, box-shadow 0.12s;
  color: #1a1208;
}

.tok > .ico {
  width: 1.55rem;
  height: 1.55rem;
  margin-bottom: 0.1rem;
}

.tok:active { transform: scale(0.96); }
.tok:disabled { opacity: 0.35; cursor: not-allowed; }

.tok .tok-name { font-size: 1.05rem; }
.tok .tok-n { font-size: 0.85rem; opacity: 0.75; }

.tok.yes { background: linear-gradient(160deg, #8ce99a, #51cf66); }
.tok.no { background: linear-gradient(160deg, #ffa8a8, #ff6b6b); }
.tok.maybe { background: linear-gradient(160deg, #a5d8ff, #74c0fc); }
.tok.close { background: linear-gradient(160deg, #ffe066, #fcc419); }
.tok.far { background: linear-gradient(160deg, #e599f7, #cc5de8); color: #1a0a20; }

.tok.flash {
  animation: tok-flash 0.45s ease;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.45);
}

@keyframes tok-flash {
  from { transform: scale(1.08); }
  to { transform: scale(1); }
}

.day-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0 0.8rem;
}

.asker-box {
  margin: 0.7rem 0 0.5rem;
  padding: 0.75rem 0.85rem;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.22);
}

.asker-pick {
  display: grid;
  gap: 0.4rem;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
}

.asker-btn {
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  border-radius: 12px;
  padding: 0.55rem 0.5rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}

.asker-btn .got {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.3;
}

.asker-btn.is-on {
  border-color: var(--lantern);
  background: rgba(255, 159, 67, 0.2);
  box-shadow: 0 0 0 1px rgba(255, 159, 67, 0.35);
}

.asker-btn.is-mayor {
  opacity: 0.55;
}

.answer-log {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  max-height: 9rem;
  overflow: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.answer-log li {
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.1);
}

.answer-log .yes { color: #8ce99a; }
.answer-log .no { color: #ffa8a8; }
.answer-log .maybe { color: #74c0fc; }
.answer-log .close { color: #ffe066; }
.answer-log .far { color: #e599f7; }

.vote-choices {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  margin-top: 0.6rem;
}

.vote-ballot {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

.ballot-row {
  display: grid;
  gap: 0.4rem;
  padding: 0.7rem 0.75rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
}

.ballot-row .who {
  font-weight: 700;
  font-size: 0.95rem;
}

.ballot-row .who .hint {
  font-weight: 500;
  font-size: 0.78rem;
  color: var(--muted);
  margin-left: 0.35rem;
}

.ballot-targets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.ballot-target {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  border-radius: 10px;
  padding: 0.4rem 0.65rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

.ballot-target.is-on {
  border-color: var(--lantern);
  background: rgba(255, 159, 67, 0.25);
  color: #ffec99;
}

.vote-tally {
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(126, 200, 227, 0.2);
}

.vote-tally .tally-title {
  margin: 0 0 0.5rem;
  font-weight: 700;
  color: var(--moon);
  font-size: 0.9rem;
}

.tally-bars {
  display: grid;
  gap: 0.4rem;
}

.tally-row {
  display: grid;
  grid-template-columns: 5.5rem 1fr 2rem;
  gap: 0.45rem;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 700;
}

.tally-bar-track {
  height: 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.tally-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffc078, #ff9f43);
  transition: width 0.2s ease;
}

.tally-row.is-lead .tally-bar-fill {
  background: linear-gradient(90deg, #8ce99a, #51cf66);
}

.tally-meta {
  margin: 0.55rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.vote-btn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  border-radius: 14px;
  padding: 0.9rem 0.8rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}

.vote-btn:hover {
  border-color: var(--lantern);
  background: rgba(255, 159, 67, 0.15);
}

.vote-btn .got {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
}

.reveal-roles .got-line {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.result-banner {
  margin: 0.3rem 0 0.6rem;
  font-family: var(--font-d);
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  color: var(--lantern);
}

.result-banner .ico {
  width: 1.5rem;
  height: 1.5rem;
  vertical-align: -0.2rem;
  margin-right: 0.25rem;
}

.word-reveal {
  margin: 0.6rem 0 1rem;
  font-size: 1.15rem;
}

.word-reveal strong {
  font-family: var(--font-d);
  font-size: 1.4rem;
  color: #ffec99;
}

.reveal-roles .tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.45rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
}

.tag.wolf { background: rgba(201, 42, 42, 0.35); color: #ffa8a8; }
.tag.seer { background: rgba(51, 154, 240, 0.35); color: #a5d8ff; }
.tag.villager { background: rgba(81, 207, 102, 0.25); color: #8ce99a; }
.tag.mayor { background: rgba(255, 159, 67, 0.3); color: #ffc078; }

.side {
  padding: 1rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  height: fit-content;
}

.side h2 {
  margin: 0 0 0.6rem;
  font-family: var(--font-d);
  font-size: 1.25rem;
}

.scores {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.scores li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
  font-weight: 700;
}

.scores .sub {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
}

.scores .sub .ico {
  width: 0.85rem;
  height: 0.85rem;
  margin-right: 0.1rem;
  vertical-align: -0.1rem;
}

.scores .pts {
  color: var(--lantern);
  font-family: var(--font-d);
  font-size: 1.2rem;
}

.rules .t {
  margin: 0 0 0.4rem;
  font-weight: 700;
  color: var(--moon);
}

.rules ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.rules li { margin-bottom: 0.35rem; }

.fx-banner {
  position: fixed;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  z-index: 40;
  min-width: min(90vw, 420px);
  padding: 1.2rem 1.6rem;
  border-radius: 18px;
  background: rgba(12, 18, 32, 0.94);
  border: 2px solid var(--lantern);
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  animation: fx-in 0.35s ease;
  pointer-events: none;
}

@keyframes fx-in {
  from { opacity: 0; transform: translate(-50%, -12px) scale(0.96); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

.fx-kicker {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.fx-title {
  margin: 0.25rem 0 0;
  font-family: var(--font-d);
  font-size: 1.8rem;
  color: var(--lantern);
}

/* —— 图标 / 图例 —— */
.ico {
  display: inline-block;
  width: 1.15rem;
  height: 1.15rem;
  vertical-align: -0.2rem;
  background: currentColor;
  flex-shrink: 0;
  -webkit-mask: center / contain no-repeat;
  mask: center / contain no-repeat;
}

.ico.tok-yes {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M9.2 17.6 3.6 12l1.9-1.9 3.7 3.7 9.3-9.3L20.4 6.4z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M9.2 17.6 3.6 12l1.9-1.9 3.7 3.7 9.3-9.3L20.4 6.4z'/%3E%3C/svg%3E");
}
.ico.tok-no {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M18.3 5.7 12 12l6.3 6.3-1.4 1.4L10.6 13.4 4.3 19.7 2.9 18.3 9.2 12 2.9 5.7 4.3 4.3l6.3 6.3 6.3-6.3z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M18.3 5.7 12 12l6.3 6.3-1.4 1.4L10.6 13.4 4.3 19.7 2.9 18.3 9.2 12 2.9 5.7 4.3 4.3l6.3 6.3 6.3-6.3z'/%3E%3C/svg%3E");
}
.ico.tok-maybe {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 3a7 7 0 0 1 7 7c0 2.6-1.4 4.2-3.2 5.6-.9.7-1.6 1.3-1.9 2.1H10c.3-1.2 1.1-2 2.1-2.8C13.8 13.4 15 12.3 15 10a3 3 0 1 0-6 0H6a5 5 0 0 1 10 0c0 1.5-.8 2.5-2.3 3.6-1 .8-2 1.6-2.4 3.1H9.2v2.2h5.6V19H9.2v-1.3c.4-1.8 1.4-2.7 2.5-3.5C13.5 13 15 11.8 15 10a3 3 0 0 0-3-3 3 3 0 0 0-3 3H6a5 5 0 0 1 6-5zm-1.2 16.2h2.4V22h-2.4z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 3a7 7 0 0 1 7 7c0 2.6-1.4 4.2-3.2 5.6-.9.7-1.6 1.3-1.9 2.1H10c.3-1.2 1.1-2 2.1-2.8C13.8 13.4 15 12.3 15 10a3 3 0 1 0-6 0H6a5 5 0 0 1 10 0c0 1.5-.8 2.5-2.3 3.6-1 .8-2 1.6-2.4 3.1H9.2v2.2h5.6V19H9.2v-1.3c.4-1.8 1.4-2.7 2.5-3.5C13.5 13 15 11.8 15 10a3 3 0 0 0-3-3 3 3 0 0 0-3 3H6a5 5 0 0 1 6-5zm-1.2 16.2h2.4V22h-2.4z'/%3E%3C/svg%3E");
}
.ico.tok-close {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M11 3h2v2.1A7 7 0 0 1 19 12h-2a5 5 0 0 0-5-5 5 5 0 0 0-5 5H5a7 7 0 0 1 6-6.9V3zm1 16a2.5 2.5 0 1 1 0-5 2.5 2.5 0 0 1 0 5z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M11 3h2v2.1A7 7 0 0 1 19 12h-2a5 5 0 0 0-5-5 5 5 0 0 0-5 5H5a7 7 0 0 1 6-6.9V3zm1 16a2.5 2.5 0 1 1 0-5 2.5 2.5 0 0 1 0 5z'/%3E%3C/svg%3E");
}
.ico.tok-far {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20zm0 2a8 8 0 1 0 0 16 8 8 0 0 0 0-16zm-4.2 4.2 1.4-1.4L12 9.2l2.8-2.8 1.4 1.4L13.4 10.6l2.8 2.8-1.4 1.4-2.8-2.8-2.8 2.8-1.4-1.4 2.8-2.8z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20zm0 2a8 8 0 1 0 0 16 8 8 0 0 0 0-16zm-4.2 4.2 1.4-1.4L12 9.2l2.8-2.8 1.4 1.4L13.4 10.6l2.8 2.8-1.4 1.4-2.8-2.8-2.8 2.8-1.4-1.4 2.8-2.8z'/%3E%3C/svg%3E");
}

.ico.role-wolf {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M3 10.5 6.2 7l2.1 1.2L12 4.5l3.7 3.7L17.8 7 21 10.5v2.2l-2.2.8-.6 4.2H5.8l-.6-4.2L3 12.7v-2.2zm5.2 5.3h7.6l.4-2.6-1.7-.6-.9 1.4h-3.2l-.9-1.4-1.7.6.4 2.6zM8.2 11.2c.7 0 1.2.5 1.2 1.2S8.9 13.6 8.2 13.6 7 13.1 7 12.4s.5-1.2 1.2-1.2zm7.6 0c.7 0 1.2.5 1.2 1.2s-.5 1.2-1.2 1.2-1.2-.5-1.2-1.2.5-1.2 1.2-1.2z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M3 10.5 6.2 7l2.1 1.2L12 4.5l3.7 3.7L17.8 7 21 10.5v2.2l-2.2.8-.6 4.2H5.8l-.6-4.2L3 12.7v-2.2zm5.2 5.3h7.6l.4-2.6-1.7-.6-.9 1.4h-3.2l-.9-1.4-1.7.6.4 2.6zM8.2 11.2c.7 0 1.2.5 1.2 1.2S8.9 13.6 8.2 13.6 7 13.1 7 12.4s.5-1.2 1.2-1.2zm7.6 0c.7 0 1.2.5 1.2 1.2s-.5 1.2-1.2 1.2-1.2-.5-1.2-1.2.5-1.2 1.2-1.2z'/%3E%3C/svg%3E");
  color: #ffa8a8;
}
.ico.role-seer {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 5c5.2 0 9.4 3.4 11 7-1.6 3.6-5.8 7-11 7S2.6 15.6 1 12c1.6-3.6 5.8-7 11-7zm0 2.2C8.1 7.2 4.9 9.4 3.5 12 4.9 14.6 8.1 16.8 12 16.8s7.1-2.2 8.5-4.8C19.1 9.4 15.9 7.2 12 7.2zm0 2.1a2.7 2.7 0 1 1 0 5.4 2.7 2.7 0 0 1 0-5.4z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 5c5.2 0 9.4 3.4 11 7-1.6 3.6-5.8 7-11 7S2.6 15.6 1 12c1.6-3.6 5.8-7 11-7zm0 2.2C8.1 7.2 4.9 9.4 3.5 12 4.9 14.6 8.1 16.8 12 16.8s7.1-2.2 8.5-4.8C19.1 9.4 15.9 7.2 12 7.2zm0 2.1a2.7 2.7 0 1 1 0 5.4 2.7 2.7 0 0 1 0-5.4z'/%3E%3C/svg%3E");
  color: #a5d8ff;
}
.ico.role-villager {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 3.5a3.8 3.8 0 1 1 0 7.6 3.8 3.8 0 0 1 0-7.6zM5.2 20.5c0-3.8 3-6.2 6.8-6.2s6.8 2.4 6.8 6.2v.8H5.2v-.8z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 3.5a3.8 3.8 0 1 1 0 7.6 3.8 3.8 0 0 1 0-7.6zM5.2 20.5c0-3.8 3-6.2 6.8-6.2s6.8 2.4 6.8 6.2v.8H5.2v-.8z'/%3E%3C/svg%3E");
  color: #8ce99a;
}
.ico.role-mayor {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M3 8.5 6.5 11 12 5.2 17.5 11 21 8.5v9.3H3V8.5zm2.2 3.4V15.8h13.6v-3.9L12 8.2 5.2 11.9z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M3 8.5 6.5 11 12 5.2 17.5 11 21 8.5v9.3H3V8.5zm2.2 3.4V15.8h13.6v-3.9L12 8.2 5.2 11.9z'/%3E%3C/svg%3E");
  color: #ffc078;
}

.phase-ico {
  display: inline-block;
  width: 1.35rem;
  height: 1.35rem;
  margin-right: 0.35rem;
  vertical-align: -0.25rem;
  border-radius: 50%;
  background: currentColor;
  -webkit-mask: center / contain no-repeat;
  mask: center / contain no-repeat;
}
.phase-ico.night {
  color: #adb5bd;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M14.2 3.1A9 9 0 1 0 20.9 14 7.2 7.2 0 0 1 14.2 3.1z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M14.2 3.1A9 9 0 1 0 20.9 14 7.2 7.2 0 0 1 14.2 3.1z'/%3E%3C/svg%3E");
}
.phase-ico.day {
  color: #ffd43b;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M11 1h2v3h-2V1zm0 19h2v3h-2v-3zM1 11h3v2H1v-2zm19 0h3v2h-3v-2zM4.2 4.2l2.1 2.1-1.4 1.4-2.1-2.1 1.4-1.4zm14.9 14.9 2.1 2.1-1.4 1.4-2.1-2.1 1.4-1.4zM4.2 19.8l1.4-1.4 2.1 2.1-1.4 1.4-2.1-2.1zm14.9-14.9 1.4-1.4 2.1 2.1-1.4 1.4-2.1-2.1zM12 7a5 5 0 1 1 0 10 5 5 0 0 1 0-10z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M11 1h2v3h-2V1zm0 19h2v3h-2v-3zM1 11h3v2H1v-2zm19 0h3v2h-3v-2zM4.2 4.2l2.1 2.1-1.4 1.4-2.1-2.1 1.4-1.4zm14.9 14.9 2.1 2.1-1.4 1.4-2.1-2.1 1.4-1.4zM4.2 19.8l1.4-1.4 2.1 2.1-1.4 1.4-2.1-2.1zm14.9-14.9 1.4-1.4 2.1 2.1-1.4 1.4-2.1-2.1zM12 7a5 5 0 1 1 0 10 5 5 0 0 1 0-10z'/%3E%3C/svg%3E");
}

.token-legend-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
  margin: 0.35rem 0 0.15rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}
.token-legend-bar .ico { width: 0.95rem; height: 0.95rem; }
.token-legend-bar .tok-yes { color: #8ce99a; }
.token-legend-bar .tok-no { color: #ffa8a8; }
.token-legend-bar .tok-maybe { color: #74c0fc; }
.token-legend-bar .tok-close { color: #ffe066; }
.token-legend-bar .tok-far { color: #e599f7; }

.setup-legend {
  margin-top: 1.1rem;
  padding-top: 0.9rem;
  border-top: 1px dashed #d5deed;
}
.legend-title {
  margin: 0.55rem 0 0.45rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #5a6578;
  letter-spacing: 0.04em;
}
.legend-grid {
  display: grid;
  gap: 0.45rem;
  grid-template-columns: 1fr 1fr;
}
.legend-item {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  padding: 0.5rem 0.55rem;
  border-radius: 12px;
  background: #eef3f8;
  color: var(--ink-deep);
}
.legend-item .ico {
  width: 1.35rem;
  height: 1.35rem;
  margin-top: 0.1rem;
}
.legend-item strong { display: block; font-size: 0.9rem; }
.legend-item span { display: block; font-size: 0.72rem; color: #5a6578; line-height: 1.35; }

.legend-tokens {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.mini-tok {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #1a1208;
}
.mini-tok .ico { width: 0.9rem; height: 0.9rem; color: inherit; }
.mini-tok.yes { background: #8ce99a; }
.mini-tok.no { background: #ffa8a8; }
.mini-tok.maybe { background: #74c0fc; }
.mini-tok.close { background: #ffe066; }
.mini-tok.far { background: #e599f7; }

.side-legend {
  margin: 0 0 1rem;
  padding: 0.75rem 0.8rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
}
.side-legend .t {
  margin: 0.35rem 0 0.35rem;
  font-weight: 700;
  color: var(--moon);
  font-size: 0.85rem;
}
.side-legend .t:first-child { margin-top: 0; }
.legend-compact {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
}
.legend-compact .ico { margin-right: 0.15rem; }
.legend-compact.tokens-c .tok-yes { color: #8ce99a; }
.legend-compact.tokens-c .tok-no { color: #ffa8a8; }
.legend-compact.tokens-c .tok-maybe { color: #74c0fc; }
.legend-compact.tokens-c .tok-close { color: #ffe066; }
.legend-compact.tokens-c .tok-far { color: #e599f7; }

.tag .ico {
  width: 0.9rem;
  height: 0.9rem;
  margin-right: 0.15rem;
  vertical-align: -0.12rem;
}
.tag.wolf .ico { color: #ffa8a8; }
.tag.seer .ico { color: #a5d8ff; }
.tag.villager .ico { color: #8ce99a; }
.tag.mayor .ico { color: #ffc078; }

.answer-log li .ico {
  width: 0.85rem;
  height: 0.85rem;
  margin-right: 0.2rem;
  vertical-align: -0.1rem;
}
.got-ico { white-space: nowrap; }
.got-ico .ico {
  width: 0.8rem;
  height: 0.8rem;
  margin-right: 0.05rem;
  vertical-align: -0.08rem;
}
.got-ico .tok-yes { color: #8ce99a; }
.got-ico .tok-no { color: #ffa8a8; }
.got-ico .tok-maybe { color: #74c0fc; }
.got-ico .tok-close { color: #ffe066; }
.got-ico .tok-far { color: #e599f7; }

.dm-body .ico {
  width: 1rem;
  height: 1rem;
  margin-right: 0.25rem;
  vertical-align: -0.15rem;
}

.scene::before {
  content: "";
  position: absolute;
  top: 4%;
  right: 8%;
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f1f3f5, #adb5bd 55%, transparent 70%);
  opacity: 0.35;
  animation: moon-drift 12s ease-in-out infinite alternate;
}
.scene::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 22%, rgba(255,255,255,0.55), transparent),
    radial-gradient(1.5px 1.5px at 28% 48%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1.5px 1.5px at 68% 18%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1.5px 1.5px at 82% 42%, rgba(255,255,255,0.35), transparent),
    radial-gradient(1.5px 1.5px at 55% 70%, rgba(255,255,255,0.3), transparent);
  pointer-events: none;
  opacity: 0.7;
}
@keyframes moon-drift {
  from { transform: translate(0, 0); }
  to { transform: translate(-12px, 8px); }
}
