:root {
  color-scheme: light;
  --ink: #172133;
  --muted: #667085;
  --paper: #f5f7fb;
  --panel: #ffffff;
  --line: #d9e0ea;
  --yes: #d65345;
  --yes-dark: #ad3529;
  --no: #147f86;
  --no-dark: #0f6268;
  --gold: #e3a72d;
  --good: #18764e;
  --bad: #b63b32;
  --shadow: 0 16px 38px rgba(23, 33, 51, 0.12);
  font-family:
    "Yu Gothic UI", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100svh;
  background:
    linear-gradient(135deg, rgba(20, 127, 134, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(214, 83, 69, 0.12), transparent 42%),
    var(--paper);
  color: var(--ink);
}

button,
a {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app {
  width: min(1180px, calc(100% - 24px));
  height: 100svh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  margin: 0 auto;
  padding: 12px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 0;
}

.brand {
  min-width: 0;
}

.site-links {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px 10px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.1;
}

.site-links a {
  color: inherit;
  text-decoration: none;
}

.site-links a:hover {
  color: var(--no-dark);
  text-decoration: underline;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--no-dark);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.25rem, 2.4vw, 1.78rem);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(3, minmax(62px, 1fr));
  gap: 6px;
  width: min(286px, 48vw);
  flex: 0 0 auto;
}

.scoreboard div {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  padding: 5px 8px;
  text-align: center;
}

.scoreboard span {
  display: block;
  font-size: 1.12rem;
  font-weight: 900;
  line-height: 1.05;
}

.scoreboard small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.game-shell {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 248px;
  gap: 10px;
}

.play-area,
.side-panel {
  min-height: 0;
  border: 1px solid rgba(217, 224, 234, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.play-area {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 9px;
  overflow: hidden;
  padding: 12px;
}

.side-panel {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 10px;
  overflow: hidden;
  padding: 12px;
}

.progress-wrap {
  display: grid;
  gap: 5px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf4;
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--no), var(--gold), var(--yes));
  transition: width 180ms ease;
}

.person-stage {
  min-height: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 7px;
  padding: 2px 0;
  text-align: center;
}

.avatar {
  width: min(34svh, 278px, 42vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.avatar svg {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 14px 18px rgba(23, 33, 51, 0.15));
}

.play-area.has-result .avatar {
  width: min(28svh, 220px, 36vw);
}

.person-copy {
  width: min(680px, 100%);
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 5px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: #e9f6f6;
  color: var(--no-dark);
  padding: 3px 10px;
  font-size: 0.78rem;
  font-weight: 900;
}

#category {
  display: none;
}

h2 {
  max-width: 100%;
  font-size: clamp(1.5rem, 3vw, 2.28rem);
  line-height: 1.06;
  overflow-wrap: anywhere;
}

#knownFor {
  max-width: 100%;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.36;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.aliases {
  max-width: 100%;
  min-height: 1.1em;
  color: #8b5b15;
  font-size: 0.82rem;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.play-area.has-result .aliases {
  display: none;
}

.play-area.has-result .person-stage {
  align-content: end;
  gap: 4px;
}

.play-area.has-result .person-copy {
  gap: 3px;
}

.play-area.has-result .pill {
  min-height: 19px;
  padding: 2px 8px;
  font-size: 0.68rem;
}

.play-area.has-result #knownFor {
  font-size: 0.72rem;
  line-height: 1.18;
  -webkit-line-clamp: 1;
}

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

.choice {
  min-height: 56px;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  box-shadow: 0 12px 22px rgba(23, 33, 51, 0.17);
  font-size: 1.08rem;
  font-weight: 900;
  transition:
    transform 150ms ease,
    filter 150ms ease,
    opacity 150ms ease;
}

.choice:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.choice:disabled {
  cursor: default;
  transform: none;
  opacity: 0.58;
}

.choice.yes {
  background: linear-gradient(180deg, var(--yes), var(--yes-dark));
}

.choice.no {
  background: linear-gradient(180deg, var(--no), var(--no-dark));
}

.choice.selected {
  opacity: 1;
  outline: 3px solid rgba(227, 167, 45, 0.5);
}

.ghost-button,
.next-button {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  padding: 7px 12px;
  font-weight: 900;
}

.ghost-button:hover,
.next-button:hover {
  border-color: #aeb9c8;
  background: #f9fbfe;
}

.ghost-button.full {
  width: 100%;
}

.result-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: start;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fbfcfe;
  padding: 10px;
}

.result-panel.good {
  border-color: rgba(24, 118, 78, 0.32);
  background: #f2fbf6;
}

.result-panel.bad {
  border-color: rgba(182, 59, 50, 0.32);
  background: #fff5f3;
}

.result-head,
.work-detail,
.explanation {
  min-width: 0;
}

.result-head {
  grid-column: 1;
  grid-row: 1;
}

.result-kicker {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.result-panel.good .result-kicker {
  color: var(--good);
}

.result-panel.bad .result-kicker {
  color: var(--bad);
}

h3 {
  margin-top: 1px;
  font-size: clamp(0.98rem, 1.7vw, 1.2rem);
  line-height: 1.24;
  overflow-wrap: anywhere;
}

.work-detail {
  grid-column: 1;
  grid-row: 2;
  display: grid;
  gap: 3px;
  border-left: 4px solid var(--gold);
  padding-left: 9px;
  font-size: 0.94rem;
  font-weight: 900;
  line-height: 1.34;
}

.work-detail p {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.15;
}

.work-list {
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.work-list li {
  min-width: 0;
  display: flex;
  gap: 3px;
  align-items: baseline;
  flex-wrap: wrap;
  line-height: 1.22;
}

.work-list strong {
  overflow-wrap: anywhere;
}

.work-list span {
  color: #3c4657;
  font-size: 0.86em;
  white-space: nowrap;
}

.work-detail small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.explanation {
  grid-column: 1 / -1;
  color: #3c4657;
  font-size: 0.84rem;
  line-height: 1.36;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.result-footer {
  grid-row: 1 / span 2;
  grid-column: 2;
  display: grid;
  justify-items: end;
  align-content: start;
  gap: 6px;
}

.source-link {
  max-width: 124px;
  color: var(--no-dark);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: right;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.next-button {
  min-width: 84px;
  border-color: transparent;
  background: var(--ink);
  color: #ffffff;
}

.next-button:hover {
  background: #263247;
  color: #ffffff;
}

.control-group {
  display: grid;
  gap: 7px;
}

.control-label {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 900;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  border-radius: 8px;
  background: #eef2f6;
  padding: 4px;
}

.segmented button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.segmented button.active {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 3px 10px rgba(23, 33, 51, 0.12);
}

.round-readout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.round-readout strong {
  color: var(--ink);
  font-size: 1.55rem;
  line-height: 1;
}

.mini-log {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 6px;
  overflow: hidden;
}

.log-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  border-radius: 8px;
  background: #f5f7fb;
  padding: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.log-mark {
  display: grid;
  place-items: center;
  width: 24px;
  aspect-ratio: 1;
  border-radius: 50%;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 900;
}

.log-item.good .log-mark {
  background: var(--good);
}

.log-item.bad .log-mark {
  background: var(--bad);
}

.log-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legal-doc,
.legal-doc body {
  height: auto;
  min-height: 100%;
  overflow: auto;
}

.legal-page {
  padding: 18px;
}

.legal-shell {
  width: min(860px, 100%);
  margin: 0 auto;
}

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

.legal-home {
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 900;
  text-decoration: none;
}

.legal-nav {
  justify-content: flex-end;
}

.legal-content {
  border: 1px solid rgba(217, 224, 234, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  padding: 26px;
}

.legal-kicker {
  color: var(--no-dark);
  font-size: 0.78rem;
  font-weight: 900;
}

.legal-content h1 {
  margin-top: 4px;
}

.legal-content h2 {
  margin-top: 22px;
  font-size: 1.08rem;
}

.legal-content p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.96rem;
  font-weight: 700;
  line-height: 1.8;
}

.contact-mail a {
  color: var(--no-dark);
  font-size: 1.12rem;
  font-weight: 900;
}

@media (max-width: 900px) {
  .app {
    width: calc(100% - 12px);
    gap: 6px;
    padding: 6px 0;
  }

  .topbar {
    gap: 8px;
  }

  .site-links {
    margin-top: 2px;
    gap: 5px 7px;
    font-size: 0.62rem;
  }

  .eyebrow {
    display: none;
  }

  h1 {
    font-size: clamp(1rem, 4.8vw, 1.28rem);
  }

  .scoreboard {
    width: min(190px, 52vw);
    gap: 4px;
  }

  .scoreboard div {
    min-height: 38px;
    padding: 4px;
  }

  .scoreboard span {
    font-size: 0.98rem;
  }

  .scoreboard small {
    font-size: 0.66rem;
  }

  .game-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 6px;
  }

  .side-panel {
    order: -1;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-rows: auto;
    align-items: center;
    gap: 8px;
    padding: 7px;
    box-shadow: none;
  }

  .control-group {
    gap: 0;
  }

  .control-label,
  .mini-log {
    display: none;
  }

  .round-readout {
    min-width: 58px;
    display: grid;
    justify-items: center;
    gap: 1px;
    border: 0;
    padding: 0;
    font-size: 0.7rem;
  }

  .round-readout strong {
    font-size: 1.1rem;
  }

  .ghost-button.full {
    width: auto;
    min-height: 34px;
    padding: 6px 9px;
    white-space: nowrap;
  }

  .play-area {
    gap: 7px;
    padding: 8px;
  }

  .progress-label {
    font-size: 0.74rem;
  }

  .progress-track {
    height: 6px;
  }

  .person-stage {
    gap: 5px;
    padding: 0;
  }

  .avatar {
    width: min(29svh, 230px, 59vw);
  }

  .play-area.has-result .avatar {
    width: min(22svh, 178px, 50vw);
  }

  .person-copy {
    gap: 3px;
  }

  .pill {
    min-height: 21px;
    padding: 2px 8px;
    font-size: 0.7rem;
  }

  h2 {
    font-size: clamp(1.34rem, 7vw, 1.95rem);
  }

  #knownFor {
    font-size: 0.74rem;
    line-height: 1.24;
  }

  .aliases {
    display: none;
  }

  .actions {
    gap: 7px;
  }

  .choice {
    min-height: 46px;
    font-size: 0.98rem;
  }

  .result-panel {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 7px;
    padding: 8px;
  }

  .result-kicker {
    font-size: 0.7rem;
  }

  h3 {
    font-size: 0.92rem;
  }

  .work-detail {
    font-size: 0.82rem;
    line-height: 1.25;
    padding-left: 7px;
  }

  .work-detail p {
    font-size: 0.68rem;
  }

  .work-list {
    gap: 0;
  }

  .work-list li {
    line-height: 1.16;
  }

  .work-detail small,
  .source-link,
  .explanation {
    font-size: 0.7rem;
  }

  .source-link {
    max-width: 92px;
  }

  .next-button {
    min-width: 70px;
    min-height: 34px;
    padding: 6px 9px;
  }
}

@media (max-width: 560px) {
  .legal-page {
    padding: 10px;
  }

  .legal-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .legal-content {
    padding: 18px;
  }

  .segmented button {
    min-height: 32px;
    padding: 0;
  }

  .avatar {
    width: min(28svh, 210px, 62vw);
  }

  .play-area.has-result .avatar {
    width: min(21svh, 168px, 48vw);
  }

  .explanation {
    -webkit-line-clamp: 1;
  }
}

@media (max-height: 700px) {
  .app {
    gap: 5px;
    padding: 5px 0;
  }

  .topbar {
    min-height: 34px;
  }

  .scoreboard div {
    min-height: 34px;
  }

  .avatar {
    width: min(27svh, 205px, 50vw);
  }

  .play-area.has-result .avatar {
    width: min(19svh, 152px, 44vw);
  }

  #knownFor {
    -webkit-line-clamp: 1;
  }

  .choice {
    min-height: 42px;
  }

  .result-panel {
    padding: 7px;
  }
}
