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

:root {
  --page: #f3f5f4;
  --paper: #ffffff;
  --ink: #202522;
  --muted: #66706a;
  --line: #d7ddd9;
  --dark: #202624;
  --dark-2: #303735;
  --red: #9e3d38;
  --red-dark: #7f2f2b;
  --teal: #167d79;
  --green: #557653;
  --gold: #946018;
  --coral: #a24c3e;
  --blue-gray: #506b80;
  --focus: #1e73be;
  --radius: 8px;
  --shadow: 0 10px 30px rgba(32, 37, 34, 0.10);
}

html {
  color-scheme: light;
  background: var(--page);
}

body {
  margin: 0;
  min-width: 280px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--page);
  color: var(--ink);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", Inter, Arial, sans-serif;
  line-height: 1.5;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

button {
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(30, 115, 190, 0.28);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.game-header {
  width: 100%;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  width: min(1120px, 100%);
  min-height: 82px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.title-block {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  background: var(--ink);
  color: #ffffff;
  border-radius: 50%;
  font-family: Georgia, serif;
  font-size: 15px;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.title-block h1 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: 0;
}

.title-block p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.segmented {
  height: 38px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  background: #e9eeeb;
  border-radius: 7px;
}

.lang-btn {
  min-width: 40px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.lang-btn.active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1px 5px rgba(32, 37, 34, 0.14);
}

.icon-command,
.icon-only {
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.icon-command {
  padding: 0 11px;
}

.icon-command[aria-pressed="false"] {
  color: var(--muted);
  background: #edf0ee;
}

.icon-only {
  width: 38px;
  padding: 0;
  font-size: 21px;
}

.command-icon {
  font-size: 16px;
  line-height: 1;
}

main {
  flex: 1;
}

.game-workspace {
  width: 100%;
  min-height: 620px;
  background: var(--page);
}

#gameApp {
  width: 100%;
  min-height: inherit;
}

.screen {
  width: min(1000px, 100%);
  min-height: 620px;
  margin: 0 auto;
  padding: 42px 24px 54px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.screen-topline {
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.topline-left {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.back-step-btn {
  min-height: 42px;
  padding: 8px 14px;
  flex: 0 0 auto;
  border: 2px solid var(--red);
  border-radius: 6px;
  background: var(--paper);
  color: var(--red-dark);
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
}

.back-step-btn:hover {
  background: #fff4f3;
}

.step-countdown {
  width: min(250px, 100%);
  margin: 0 auto 24px;
  padding: 12px 16px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
  text-align: center;
}

.step-countdown span,
.night-countdown span {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.step-countdown strong,
.night-countdown strong {
  display: block;
  font-family: "Roboto Mono", Consolas, monospace;
  font-size: 52px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.discussion-countdown {
  width: min(340px, 100%);
  border-color: var(--gold);
}

.discussion-countdown strong {
  font-size: 66px;
}

.pause-timer-btn {
  min-width: 112px;
  min-height: 42px;
  margin-top: 10px;
  padding: 8px 14px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--ink);
  color: #ffffff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
}

.pause-timer-btn:hover {
  background: #343b37;
}

.phase-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.phase-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c7cfca;
}

.phase-dot.active {
  background: var(--red);
}

.setup-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 48px;
  align-items: center;
}

.setup-intro h2 {
  max-width: 680px;
  margin-bottom: 12px;
  font-family: Georgia, "Noto Serif TC", serif;
  font-size: 42px;
  line-height: 1.12;
  letter-spacing: 0;
}

.setup-intro > p {
  max-width: 560px;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 16px;
}

.role-roster {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.night-order-roster {
  width: min(560px, 100%);
  margin-bottom: 26px;
}

.mini-role {
  min-width: 0;
}

.mini-role-art,
.role-art,
.role-avatar {
  display: block;
  object-fit: cover;
  object-position: center;
}

.mini-role-art {
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background-color: #f4f0e7;
}

.mini-role span {
  display: block;
  margin-top: 6px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-werewolf { --role-color: var(--red); }
.role-villager { --role-color: var(--green); }
.role-seer { --role-color: var(--teal); }
.role-minion { --role-color: var(--gold); }
.role-drunk { --role-color: var(--coral); }
.role-robber { --role-color: var(--blue-gray); }

.setup-form {
  padding: 26px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--red);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.form-title {
  margin-bottom: 18px;
  font-size: 18px;
}

.player-field {
  display: block;
  margin-bottom: 14px;
}

.player-field span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.player-field input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfb;
  color: var(--ink);
}

.player-field input:focus {
  border-color: var(--focus);
  background: var(--paper);
}

.primary-btn,
.secondary-btn,
.quiet-btn,
.target-btn,
.choice-btn {
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
}

.primary-btn {
  min-height: 48px;
  padding: 12px 20px;
  border: 1px solid var(--red);
  background: var(--red);
  color: #ffffff;
}

.primary-btn:hover {
  border-color: var(--red-dark);
  background: var(--red-dark);
}

.primary-btn:disabled {
  border-color: #aab1ad;
  background: #aab1ad;
  cursor: not-allowed;
}

.setup-form .primary-btn {
  width: 100%;
  margin-top: 8px;
}

.secondary-btn {
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
}

.quiet-btn {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
}

.privacy-screen,
.role-reveal-screen,
.day-screen,
.vote-screen {
  align-items: center;
  text-align: center;
}

.privacy-icon {
  width: 82px;
  height: 82px;
  margin-bottom: 22px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  font-size: 34px;
}

.privacy-screen h2,
.day-screen h2,
.vote-screen h2 {
  max-width: 640px;
  margin-bottom: 10px;
  font-family: Georgia, "Noto Serif TC", serif;
  font-size: 34px;
  line-height: 1.2;
}

.privacy-screen > p,
.day-screen > p,
.vote-screen > p {
  max-width: 540px;
  margin-bottom: 24px;
  color: var(--muted);
}

.privacy-screen .primary-btn,
.day-screen .primary-btn,
.vote-screen .primary-btn {
  min-width: 210px;
}

.role-reveal-layout {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(260px, 330px) minmax(260px, 430px);
  gap: 42px;
  align-items: center;
  justify-content: center;
  text-align: left;
}

.role-card {
  width: 100%;
  max-width: 330px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-top: 6px solid var(--role-color);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.role-art {
  width: 100%;
  height: auto;
  background-color: #f4f0e7;
}

.role-card-copy {
  padding: 18px 20px 20px;
}

.role-name {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  text-align: center;
}

.role-name-en {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.reveal-copy .eyebrow,
.night-copy .eyebrow,
.guide-heading .eyebrow,
.result-heading .eyebrow {
  margin-bottom: 8px;
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.reveal-copy h2 {
  margin-bottom: 12px;
  font-family: Georgia, "Noto Serif TC", serif;
  font-size: 34px;
  line-height: 1.2;
}

.role-help {
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 16px;
}

.team-label {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin-bottom: 22px;
  padding: 4px 9px;
  border: 1px solid currentColor;
  border-radius: 999px;
  color: var(--role-color);
  font-size: 11px;
  font-weight: 900;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.night-screen {
  width: 100%;
  min-height: 620px;
  background: var(--dark);
  color: #f4f7f5;
}

.night-inner {
  width: min(900px, 100%);
  min-height: inherit;
  margin: 0 auto;
  padding: 30px 24px 42px;
  display: flex;
  flex-direction: column;
}

.night-progress-line {
  width: 100%;
  height: 5px;
  overflow: hidden;
  background: #454e4a;
}

.night-progress-fill {
  width: 100%;
  height: 100%;
  transform: scaleX(1);
  transform-origin: left center;
  background: #e0b560;
}

.night-meta {
  margin: 16px 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #aeb8b3;
  font-size: 13px;
  font-weight: 700;
}

.night-meta-left {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.night-back {
  border-color: #e0b560;
  background: #303735;
  color: #fff3d2;
}

.night-back:hover {
  background: #414b46;
}

.night-countdown {
  width: min(290px, 100%);
  margin: 0 auto 18px;
  padding: 10px 16px;
  border: 2px solid #e0b560;
  border-radius: var(--radius);
  color: #ffffff;
  text-align: center;
}

.night-countdown span {
  color: #e0c98f;
}

.night-countdown strong {
  font-size: 60px;
}

.night-pause-btn {
  border-color: #e0b560;
  background: #e0b560;
  color: #202624;
}

.night-pause-btn:hover {
  background: #f0ca73;
}

.repeat-btn {
  min-height: 36px;
  padding: 6px 11px;
  border: 1px solid #59635e;
  border-radius: 6px;
  background: transparent;
  color: #f4f7f5;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.night-main {
  flex: 1;
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 34px;
  align-items: center;
}

.role-avatar {
  width: 150px;
  height: 150px;
  border: 4px solid var(--role-color);
  border-radius: 50%;
  background-color: #f4f0e7;
  box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.05);
}

.night-copy h2 {
  margin-bottom: 8px;
  font-family: Georgia, "Noto Serif TC", serif;
  font-size: 34px;
  line-height: 1.15;
}

.night-instruction {
  max-width: 620px;
  margin-bottom: 20px;
  color: #c8d0cc;
}

.action-area {
  min-height: 170px;
  padding: 18px;
  border: 1px solid #4b5550;
  border-radius: var(--radius);
  background: var(--dark-2);
}

.action-label {
  margin-bottom: 12px;
  color: #aeb8b3;
  font-size: 12px;
  font-weight: 800;
}

.target-grid,
.center-grid {
  display: grid;
  gap: 10px;
}

.target-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.center-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.target-btn,
.choice-btn {
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid #65716b;
  background: #3a433f;
  color: #ffffff;
}

.target-btn:hover,
.choice-btn:hover,
.target-btn.selected,
.choice-btn.selected {
  border-color: #e0b560;
  background: #4b4637;
}

.target-btn:disabled,
.choice-btn:disabled {
  opacity: 0.64;
  cursor: default;
}

.center-card-back {
  display: block;
  color: #e0b560;
  font-family: Georgia, serif;
  font-size: 20px;
}

.peek-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 170px));
  gap: 12px;
}

.peek-card {
  overflow: hidden;
  border: 1px solid #65716b;
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
}

.peek-art {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.peek-name {
  display: block;
  padding: 8px;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

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

.action-complete {
  min-height: 130px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: #eef2ef;
}

.complete-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border: 2px solid #87ad83;
  border-radius: 50%;
  color: #a8d5a4;
  font-size: 21px;
  font-weight: 900;
}

.day-symbol {
  width: 92px;
  height: 92px;
  margin-bottom: 20px;
  display: grid;
  place-items: center;
  border: 3px solid var(--gold);
  border-radius: 50%;
  color: var(--gold);
  font-size: 42px;
}

.vote-options {
  width: min(580px, 100%);
  margin: 4px 0 22px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.vote-option {
  min-height: 88px;
  padding: 14px;
  overflow-wrap: anywhere;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
}

.vote-option.selected {
  border-color: var(--red);
  background: #fff4f3;
  color: var(--red-dark);
}

.result-screen {
  justify-content: flex-start;
}

.result-heading {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.result-heading h2 {
  margin-bottom: 8px;
  font-family: Georgia, "Noto Serif TC", serif;
  font-size: 38px;
  line-height: 1.15;
}

.result-heading p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.result-section-title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.result-grid + .result-section-title {
  margin-top: 26px;
}

.result-slot {
  min-width: 0;
}

.result-owner-line {
  min-height: 26px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
}

.result-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-top: 5px solid var(--role-color);
  border-radius: var(--radius);
  background: var(--paper);
}

.result-card.eliminated {
  box-shadow: 0 0 0 3px var(--red);
}

.result-art {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.result-copy {
  padding: 10px 12px 12px;
  text-align: center;
}

.result-owner {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-role {
  margin-top: 3px;
  font-size: 14px;
  font-weight: 900;
}

.status-ribbon {
  flex: 0 0 auto;
  padding: 4px 7px;
  border-radius: 4px;
  background: var(--ink);
  color: #ffffff;
  font-size: 10px;
  font-weight: 900;
}

.result-summary {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.summary-block {
  padding-top: 14px;
  border-top: 3px solid var(--ink);
}

.summary-block h3 {
  margin-bottom: 10px;
  font-size: 14px;
}

.summary-block p,
.summary-block li {
  color: var(--muted);
  font-size: 13px;
}

.summary-block ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.summary-block li + li {
  margin-top: 5px;
}

.result-actions {
  margin: 0 0 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.quick-guide {
  width: 100%;
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.guide-inner {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 62px 24px 70px;
}

.guide-heading {
  margin-bottom: 26px;
}

.guide-heading h2 {
  margin-bottom: 0;
  font-family: Georgia, "Noto Serif TC", serif;
  font-size: 30px;
}

.rule-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--ink);
}

.rule-steps article {
  min-width: 0;
  padding: 20px 20px 8px 0;
}

.rule-steps article + article {
  padding-left: 20px;
  border-left: 1px solid var(--line);
}

.step-number {
  display: block;
  margin-bottom: 18px;
  color: var(--red);
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: 700;
}

.rule-steps h3 {
  margin-bottom: 6px;
  font-size: 16px;
}

.rule-steps p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.rules-detail {
  margin-top: 34px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.rules-detail summary {
  padding: 17px 0;
  cursor: pointer;
  font-weight: 900;
}

.rule-copy {
  max-width: 760px;
  padding-bottom: 12px;
}

.rule-copy p {
  color: var(--muted);
  font-size: 13px;
}

.role-rule-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 28px;
  padding-bottom: 14px;
}

.role-rule-item {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.role-rule-item strong {
  font-size: 13px;
}

.role-rule-item p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

noscript {
  display: block;
  padding: 30px;
  text-align: center;
}

@media (max-width: 780px) {
  .header-inner {
    padding: 11px 14px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
    font-size: 13px;
  }

  .title-block h1 {
    font-size: 17px;
  }

  .title-block p,
  #voiceLabel {
    display: none;
  }

  .icon-command {
    width: 38px;
    padding: 0;
  }

  .game-workspace,
  .screen,
  .night-screen {
    min-height: 570px;
  }

  .screen {
    padding: 30px 18px 42px;
  }

  .screen-topline {
    align-items: flex-start;
  }

  .topline-left {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .step-countdown strong {
    font-size: 46px;
  }

  .discussion-countdown strong {
    font-size: 58px;
  }

  .setup-layout {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .setup-intro h2 {
    font-size: 32px;
  }

  .setup-intro > p {
    font-size: 14px;
  }

  .role-roster {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .setup-form {
    padding: 20px;
  }

  .role-reveal-layout {
    grid-template-columns: 1fr;
    gap: 24px;
    text-align: center;
  }

  .role-card {
    max-width: 250px;
    margin: 0 auto;
  }

  .reveal-copy h2,
  .privacy-screen h2,
  .day-screen h2,
  .vote-screen h2 {
    font-size: 28px;
  }

  .button-row {
    justify-content: center;
  }

  .night-inner {
    padding: 22px 16px 32px;
  }

  .night-meta {
    flex-wrap: wrap;
  }

  .night-countdown strong {
    font-size: 52px;
  }

  .night-main {
    grid-template-columns: 1fr;
    gap: 20px;
    align-content: center;
    text-align: center;
  }

  .role-avatar {
    width: 94px;
    height: 94px;
    margin: 0 auto;
  }

  .night-copy h2 {
    font-size: 28px;
  }

  .night-instruction {
    margin-right: auto;
    margin-left: auto;
    font-size: 14px;
  }

  .action-area {
    min-height: 156px;
    padding: 14px;
    text-align: left;
  }

  .target-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .peek-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-heading h2 {
    font-size: 31px;
  }

  .result-grid {
    gap: 7px;
  }

  .result-copy {
    padding: 8px 5px 9px;
  }

  .result-role {
    font-size: 11px;
  }

  .result-summary {
    grid-template-columns: 1fr;
  }

  .guide-inner {
    padding: 46px 18px 52px;
  }

  .role-rule-list {
    grid-template-columns: 1fr;
  }

  .rule-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rule-steps article:nth-child(3) {
    padding-left: 0;
    border-left: 0;
  }

  .rule-steps article:nth-child(n+3) {
    margin-top: 12px;
    border-top: 1px solid var(--line);
  }

  #toolhub-nav-host {
    display: none !important;
  }

  .game-header {
    position: sticky;
    top: 0;
    z-index: 20;
  }

  .header-inner {
    height: 56px;
    min-height: 56px;
    padding: 6px 10px;
  }

  .brand-mark,
  .icon-only {
    display: none;
  }

  .title-block h1 {
    max-width: 150px;
    font-size: 15px;
  }

  .game-workspace,
  #gameApp {
    height: calc(100vh - 56px);
    height: calc(100svh - 56px);
    min-height: 0;
  }

  .game-workspace[data-view="setup"],
  #gameApp[data-view="setup"] {
    height: auto;
    min-height: calc(100vh - 56px);
    min-height: calc(100svh - 56px);
  }

  .screen,
  .night-screen {
    height: 100%;
    min-height: 0;
  }

  .screen {
    padding: 8px 14px 10px;
    justify-content: flex-start;
    overflow: hidden;
  }

  .setup-screen,
  .result-screen {
    height: auto;
    min-height: calc(100vh - 56px);
    min-height: calc(100svh - 56px);
    overflow: visible;
  }

  .setup-screen {
    padding-bottom: 24px;
  }

  .result-screen {
    max-height: calc(100vh - 56px);
    max-height: calc(100svh - 56px);
    overflow-y: auto;
  }

  .screen-topline {
    min-height: 38px;
    margin-bottom: 7px;
    align-items: center;
  }

  .topline-left {
    align-items: center;
    flex-direction: row;
    gap: 7px;
  }

  .back-step-btn {
    min-height: 36px;
    padding: 5px 9px;
    font-size: 12px;
  }

  .step-countdown {
    width: 100%;
    min-height: 64px;
    margin: 0 0 7px;
    padding: 5px 9px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto 1fr;
    align-items: center;
    text-align: left;
  }

  .step-countdown span {
    margin: 0;
  }

  .step-countdown strong,
  .discussion-countdown strong {
    font-size: 40px;
  }

  .pause-timer-btn {
    min-width: 90px;
    min-height: 40px;
    margin: 0;
    grid-column: 2;
    grid-row: 1 / 3;
  }

  .privacy-icon {
    width: 58px;
    height: 58px;
    margin-bottom: 9px;
    font-size: 25px;
  }

  .privacy-screen h2,
  .day-screen h2,
  .vote-screen h2 {
    margin-bottom: 5px;
    font-size: 23px;
  }

  .privacy-screen > p,
  .day-screen > p,
  .vote-screen > p {
    margin-bottom: 10px;
    font-size: 12px;
  }

  .privacy-screen .primary-btn,
  .day-screen .primary-btn,
  .vote-screen .primary-btn {
    min-width: 190px;
    min-height: 44px;
  }

  .role-reveal-layout {
    grid-template-columns: minmax(112px, 42%) minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    text-align: left;
  }

  .role-card {
    max-width: 160px;
    margin: 0;
  }

  .role-card-copy {
    padding: 8px;
  }

  .role-name {
    font-size: 16px;
  }

  .reveal-copy .eyebrow {
    margin-bottom: 4px;
    font-size: 10px;
  }

  .reveal-copy h2 {
    margin-bottom: 6px;
    font-size: 22px;
  }

  .team-label {
    min-height: 24px;
    margin-bottom: 7px;
    padding: 3px 7px;
    font-size: 9px;
  }

  .role-help {
    margin-bottom: 8px;
    font-size: 11px;
    line-height: 1.4;
  }

  .role-help + .role-help {
    display: none;
  }

  .role-reveal-screen .button-row {
    justify-content: flex-start;
  }

  .role-reveal-screen .primary-btn {
    min-height: 42px;
    padding: 8px 10px;
    font-size: 12px;
  }

  .night-order-roster {
    width: 100%;
    margin-bottom: 10px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .night-order-roster .mini-role span {
    margin-top: 3px;
    font-size: 8px;
  }

  .night-inner {
    height: 100%;
    min-height: 0;
    padding: 8px 12px 10px;
    overflow: hidden;
  }

  .night-meta {
    min-height: 38px;
    margin: 5px 0;
    flex-wrap: nowrap;
    gap: 8px;
  }

  .night-meta-left {
    gap: 7px;
  }

  .repeat-btn {
    min-height: 34px;
    padding: 5px 8px;
    font-size: 11px;
  }

  .night-countdown {
    width: 100%;
    min-height: 62px;
    margin: 0 0 6px;
    padding: 5px 9px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto 1fr;
    align-items: center;
    text-align: left;
  }

  .night-countdown strong {
    font-size: 40px;
  }

  .night-countdown .pause-timer-btn {
    grid-column: 2;
    grid-row: 1 / 3;
  }

  .night-main {
    min-height: 0;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 10px;
    align-content: start;
    align-items: start;
    overflow: hidden;
    text-align: left;
  }

  .role-avatar {
    width: 64px;
    height: 64px;
    margin: 0;
    border-width: 3px;
  }

  .night-copy h2 {
    margin-bottom: 3px;
    font-size: 22px;
  }

  .night-copy .eyebrow {
    margin-bottom: 2px;
    font-size: 9px;
  }

  .night-instruction {
    margin: 0 0 6px;
    font-size: 11px;
    line-height: 1.35;
    text-align: left;
  }

  .action-area {
    min-height: 118px;
    padding: 8px;
    overflow: hidden;
  }

  .action-label {
    margin-bottom: 6px;
    font-size: 10px;
  }

  .target-btn,
  .choice-btn {
    min-height: 44px;
    padding: 6px;
    font-size: 11px;
  }

  .peek-name {
    padding: 4px;
    font-size: 9px;
  }

  .day-symbol {
    width: 58px;
    height: 58px;
    margin-bottom: 8px;
    font-size: 28px;
  }

  .vote-options {
    margin: 0 0 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .vote-option {
    min-height: 58px;
    padding: 8px;
  }

  .result-heading {
    margin-bottom: 10px;
    padding-bottom: 8px;
  }

  .result-actions {
    margin-bottom: 14px;
  }
}

@media (max-width: 430px) {
  .title-block {
    gap: 8px;
  }

  .title-block h1 {
    max-width: 112px;
    font-size: 15px;
    line-height: 1.2;
  }

  .header-controls {
    gap: 5px;
  }

  .lang-btn {
    min-width: 34px;
  }

  .icon-only,
  .icon-command {
    width: 36px;
  }

  .setup-intro h2 {
    font-size: 28px;
  }

  .setup-form {
    padding: 17px;
  }

  .center-grid,
  .target-grid,
  .mode-choices {
    grid-template-columns: 1fr;
  }

  .center-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .target-btn,
  .choice-btn {
    min-height: 48px;
  }

  .result-grid {
    grid-template-columns: repeat(3, minmax(74px, 1fr));
    overflow-x: auto;
  }

  .result-owner {
    font-size: 9px;
  }

  .status-ribbon {
    padding: 3px 4px;
    font-size: 8px;
  }

  .rule-steps {
    grid-template-columns: 1fr;
  }

  .rule-steps article,
  .rule-steps article + article,
  .rule-steps article:nth-child(3) {
    padding: 16px 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .rule-steps article:first-child {
    border-top: 0;
  }

  .rule-steps article:nth-child(n+3) {
    margin-top: 0;
  }

  .step-number {
    margin-bottom: 8px;
  }
}

@media (max-width: 350px) {
  .header-inner {
    gap: 8px;
  }

  .brand-mark,
  .icon-only {
    display: none;
  }

  .title-block h1 {
    max-width: 104px;
  }
}

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