:root {
  color-scheme: light;
  --bg: #f3f7fb;
  --panel: #ffffff;
  --panel-tint: #f7fafc;
  --ink: #111827;
  --muted: #64748b;
  --line: #dbe4ee;
  --brand: #0f766e;
  --brand-dark: #134e4a;
  --accent: #e4572e;
  --gold: #f2b84b;
  --blue: #2563eb;
  --violet: #7c3aed;
  --green-soft: #dcfce7;
  --red-soft: #fee2d5;
  --blue-soft: #dbeafe;
  --gold-soft: #fff1c2;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.1);
  --shadow-soft: 0 8px 22px rgba(15, 23, 42, 0.065);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #e0f2fe 0, var(--bg) 230px),
    var(--bg);
  color: var(--ink);
  font-family: Inter, Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  font-weight: 850;
  line-height: 1;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease, background .16s ease;
}

button:hover,
.tab.active {
  border-color: var(--brand);
}

button:hover {
  box-shadow: 0 6px 16px rgba(15, 118, 110, .12);
}

button:active {
  transform: translateY(1px);
}

button:focus-visible {
  outline: 3px solid rgba(54, 98, 216, .22);
  outline-offset: 2px;
}

.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: white;
  box-shadow: 0 8px 18px rgba(15, 118, 110, .18);
}

.primary:hover {
  background: var(--brand-dark);
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid #cfdbe7;
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
  padding: 9px 11px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(54, 98, 216, .16);
  border-color: var(--blue);
}

textarea {
  resize: vertical;
}

.app-header {
  min-height: 190px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  align-items: center;
  gap: clamp(22px, 5vw, 58px);
  padding: 30px clamp(18px, 4vw, 54px) 24px;
  background:
    linear-gradient(125deg, rgba(255,255,255,.96) 0 46%, rgba(219,234,254,.76) 46% 72%, rgba(220,252,231,.78) 72%),
    #eef8ff;
  border-bottom: 1px solid rgba(15, 118, 110, .18);
  position: relative;
  overflow: hidden;
}

.app-header::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 4px;
  background: linear-gradient(90deg, var(--brand), var(--blue), var(--gold));
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--brand);
  font-weight: 800;
  letter-spacing: .02em;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2rem, 3.4vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 1.08rem;
}

.table-scene {
  position: relative;
  height: 150px;
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(255,255,255,.18) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,.18) 1px, transparent 1px),
    linear-gradient(135deg, #0f766e, #155e75);
  background-size: 30px 30px, 30px 30px, auto;
  box-shadow: inset 0 0 0 8px #8a5a2f, 0 16px 36px rgba(21, 94, 117, .2);
  overflow: hidden;
  transform: rotate(1deg);
}

.token,
.card,
.die {
  position: absolute;
  display: block;
  box-shadow: 0 10px 18px rgba(0,0,0,.23);
}

.token {
  width: 34px;
  height: 34px;
  border-radius: 50%;
}

.token::after {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: rgba(255,255,255,.42);
}

.token-a { left: 40px; top: 46px; background: var(--accent); }
.token-b { right: 65px; top: 35px; background: var(--gold); }
.token-c { left: 130px; bottom: 28px; background: var(--blue); }

.card {
  width: 62px;
  height: 88px;
  border: 4px solid white;
  border-radius: 6px;
  background: repeating-linear-gradient(135deg, #283b52 0 7px, #f0d47b 7px 13px);
}

.card-a { left: 76px; top: 38px; transform: rotate(-14deg); }
.card-b { right: 95px; bottom: 28px; transform: rotate(10deg); background: repeating-linear-gradient(135deg, #6d2933 0 7px, #f5efe5 7px 13px); }

.die {
  right: 28px;
  top: 74px;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: #fffdf7;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 1.4rem;
}

.tabs {
  display: flex;
  gap: 10px;
  padding: 10px clamp(18px, 4vw, 54px);
  background: rgba(243, 247, 251, 0.9);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
}

.tab {
  padding: 0 18px;
  font-weight: 800;
  background: rgba(255,255,255,.72);
  min-height: 42px;
}

.tab.active {
  background: #ffffff;
  color: var(--brand-dark);
  box-shadow: 0 8px 20px rgba(15, 118, 110, .12);
}

main {
  padding: 22px clamp(18px, 4vw, 54px) 52px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.toolbar,
.inline-controls,
.form-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.toolbar {
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.86);
  box-shadow: var(--shadow-soft);
}

.search {
  min-width: min(390px, 100%);
  flex: 1;
}

.search span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.toolbar select,
.toolbar button {
  width: auto;
  min-width: 120px;
}

#newGameBtn {
  min-width: 132px;
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -8px 0 18px;
}

.filter-chip,
.active-filters button {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 999px;
  font-size: .88rem;
  font-weight: 850;
}

.filter-chip {
  padding: 0 11px;
  background: #e0f2fe;
  color: #075985;
}

.active-filters button {
  min-height: 34px;
  padding: 0 12px;
  border-color: #cbd5e1;
  color: #475569;
}

.wiki-grid {
  display: grid;
  grid-template-columns: minmax(300px, 340px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  min-height: 520px;
}

.wiki-grid > section:first-child {
  position: sticky;
  top: 82px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: calc(100vh - 104px);
  min-height: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.9);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.section-head span,
#gameCount {
  color: var(--muted);
  font-weight: 800;
}

.game-list,
.record-list {
  display: grid;
  gap: 9px;
}

.game-list {
  min-height: 0;
  max-height: calc(100vh - 178px);
  overflow-y: auto;
  padding: 3px 5px 3px 3px;
  overscroll-behavior: contain;
}

.game-list::-webkit-scrollbar,
.detail-panel::-webkit-scrollbar {
  width: 10px;
}

.game-list::-webkit-scrollbar-thumb,
.detail-panel::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: #b9c7d6;
  background-clip: content-box;
}

.game-card,
.detail-panel,
.tool-panel,
.stat-card,
.record-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.game-card {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-content: start;
  align-items: start;
  justify-content: stretch;
  justify-items: start;
  gap: 8px;
  width: 100%;
  height: 100px;
  min-height: 100px;
  padding: 13px 18px 12px 22px;
  text-align: left;
  position: relative;
  overflow: hidden;
  line-height: 1.25;
  box-shadow: none;
}

.game-title {
  display: grid;
  align-content: start;
  justify-items: start;
  gap: 2px;
  width: 100%;
  min-height: auto;
  margin-bottom: 0;
  text-align: left;
}

.game-title strong {
  display: block;
  font-size: 1.08rem;
  line-height: 1.24;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.game-title small {
  display: block;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: var(--line);
}

.game-card:hover {
  transform: translateY(-1px);
  background: #f8fbff;
  box-shadow: 0 10px 22px rgba(23, 32, 51, .08);
}

.game-card.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12), var(--shadow-soft);
  background: #ffffff;
}

.game-card.active::before {
  background: linear-gradient(180deg, var(--brand), var(--gold));
}

.meta,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: 100%;
  color: var(--muted);
  font-size: .84rem;
  text-align: left;
}

.game-card .meta {
  align-self: start;
  margin-bottom: 0;
}

.game-card .tag-row {
  display: none;
}

.game-card .meta span,
.detail-header .meta span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f2f6fb;
  color: #475467;
  font-weight: 800;
}

.game-card .meta .weight-chip {
  color: #23443f;
  background: #e8f7f1;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  border-radius: 999px;
  background: #eef4fb;
  padding: 3px 8px;
  color: #475569;
  font-weight: 700;
}

.tag-muted {
  background: #eef2f7;
  color: #667085;
}

.tag:nth-child(2n) {
  background: #eef4fb;
  color: #475569;
}

.tag:nth-child(3n) {
  background: #eef4fb;
  color: #475569;
}

.tag:nth-child(4n) {
  background: #eef4fb;
  color: #475569;
}

.detail-panel,
.tool-panel {
  padding: 22px;
}

.detail-panel {
  max-height: calc(100vh - 104px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  scroll-margin-top: 78px;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: -22px -22px 18px;
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, .1), rgba(54, 98, 216, .08)),
    var(--panel-tint);
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
}

.detail-actions {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

#backToList {
  display: none;
}

.detail-header button {
  align-self: start;
  min-width: 72px;
  border-color: #b8d8d3;
  background: #ffffff;
  color: var(--brand-dark);
}

.detail-header button:hover {
  background: #ecfdf5;
}

.detail-header h2 {
  font-size: clamp(1.55rem, 2.4vw, 2.25rem);
  line-height: 1.18;
}

.fact-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}

.fact-grid span {
  display: grid;
  gap: 3px;
  min-height: 70px;
  padding: 12px;
  border: 1px solid #dce7f2;
  border-radius: var(--radius);
  background: #f9fcff;
}

.fact-grid .weight-fact {
  gap: 7px;
}

.fact-grid strong {
  font-size: 1.05rem;
  color: var(--ink);
}

.fact-grid small {
  color: var(--muted);
  font-weight: 800;
}

.summary-panel {
  margin: 0 0 18px;
  padding: 18px 20px;
  border-left: 5px solid var(--brand);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #ecfdf5, #f8fbff);
}

.summary-panel span {
  display: block;
  margin-bottom: 7px;
  color: var(--brand-dark);
  font-weight: 900;
}

.summary-panel p {
  max-width: 82ch;
  margin: 0;
  color: #243042;
  line-height: 1.72;
  font-size: 1.03rem;
}

.detail-tags {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid #e6edf4;
}

.detail-tags strong {
  display: block;
  margin-bottom: 8px;
  color: #344054;
  font-size: .9rem;
}

.section-group {
  padding: 20px 0;
  border-top: 1px solid #e6edf4;
}

.section-group summary {
  cursor: pointer;
  margin: 0;
  list-style: none;
  font-size: 1.15rem;
  font-weight: 950;
  color: #111827;
}

.section-group summary::-webkit-details-marker {
  display: none;
}

.section-group summary::after {
  content: "열기";
  float: right;
  min-width: 46px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef4fb;
  color: var(--muted);
  font-size: .78rem;
  text-align: center;
}

.section-group[open] summary::after {
  content: "닫기";
}

.section-group .detail-sections {
  margin-top: 14px;
}

.detail-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 24px;
}

.info-block {
  padding-top: 0;
}

.info-block.full {
  grid-column: 1 / -1;
}

.info-block h3 {
  margin: 0 0 8px;
  font-size: .92rem;
  color: var(--brand-dark);
}

.info-block p {
  max-width: 78ch;
  margin: 0;
  color: #344054;
  line-height: 1.68;
}

.info-block ol {
  max-width: 78ch;
  margin: 0;
  padding-left: 20px;
  color: #344054;
  line-height: 1.68;
}

.info-block li + li {
  margin-top: 6px;
}

.faq-list {
  margin: 0;
}

.faq-list dt {
  font-weight: 800;
  margin-top: 10px;
}

.faq-list dt:first-child {
  margin-top: 0;
}

.faq-list dd {
  margin: 4px 0 0;
  color: #344054;
  line-height: 1.68;
}

.variant-list {
  display: grid;
  gap: 10px;
}

.variant-card {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
  background: #f8fbff;
}

.variant-card strong {
  color: var(--ink);
}

.variant-card span,
.variant-card em {
  color: var(--muted);
  font-size: .88rem;
  font-style: normal;
  font-weight: 800;
}

.variant-card p,
.variant-card ul {
  margin: 0;
  color: #344054;
  line-height: 1.6;
}

.subdued {
  color: var(--muted);
}

.source-list {
  display: grid;
  gap: 6px;
}

.source-list a {
  color: var(--brand-dark);
  overflow-wrap: anywhere;
}

.tool-grid,
.record-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.wide {
  grid-column: span 1;
}

.score-tool {
  grid-column: 1 / -1;
}

.tool-panel.wide:not(.score-tool) {
  grid-column: span 1;
}

.compact-tool {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 0;
  height: 100%;
}

.timer-display {
  margin: 0;
  padding: 20px 18px;
  border-radius: var(--radius);
  background: #eef6ff;
  font-size: clamp(3.2rem, 8vw, 5.6rem);
  line-height: 1;
  font-weight: 900;
  color: var(--blue);
  font-variant-numeric: tabular-nums;
  text-align: center;
  min-height: 128px;
  display: grid;
  place-items: center;
}

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

.field-chip {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field-chip span {
  color: var(--muted);
  font-size: .8rem;
  font-weight: 900;
}

.field-chip input,
.field-chip select {
  min-height: 54px;
  font-weight: 900;
  text-align: center;
  background: #f8fbff;
}

.tool-controls input,
.tool-controls select,
.tool-controls button {
  min-height: 54px;
  font-size: 1.05rem;
  font-weight: 800;
}

.tool-controls button {
  font-size: 1.08rem;
}

.score-wrap {
  overflow-x: auto;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.score-cards {
  display: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 650px;
}

th,
td {
  border: 1px solid var(--line);
  padding: 12px;
  text-align: center;
}

th {
  background: #f1f6fb;
  color: #334155;
  font-size: .9rem;
  font-weight: 950;
}

td input {
  min-width: 92px;
  min-height: 46px;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 800;
}

.player-name-input {
  min-width: 150px;
  min-height: 46px;
  text-align: left;
  font-weight: 900;
  background: #fffdf7;
}

#scoreWinner {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: #854d0e;
}

.score-tool .section-head {
  padding-bottom: 14px;
  border-bottom: 1px solid #e6edf4;
}

.score-tool > .inline-controls {
  padding: 12px;
  border: 1px solid #e6edf4;
  border-radius: var(--radius);
  background: #f8fbff;
}

.score-tool > .inline-controls input {
  min-height: 48px;
  font-weight: 800;
}

.result-box {
  margin-top: 14px;
  min-height: 62px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--panel-tint);
  line-height: 1.5;
}

.dice-tool .result-box {
  margin-top: 0;
  min-height: 128px;
  display: grid;
  place-items: center;
  border-style: solid;
  background: linear-gradient(135deg, #fffdf7, #eef6ff);
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--ink);
}

.tool-panel textarea {
  min-height: 132px;
  line-height: 1.55;
  background: #fff;
}

.tool-panel.wide:not(.score-tool) .result-box {
  border-style: solid;
  background: #fffdf7;
  font-weight: 800;
}

.word-bag {
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
  background: #f8fbff;
}

.word-bag:empty {
  display: none;
}

.word-bag,
.stats-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  white-space: nowrap;
}

.check input {
  width: auto;
  min-height: auto;
}

.record-grid {
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
}

.record-grid .wide:last-child {
  grid-column: 1 / -1;
}

.record-card,
.stat-card {
  padding: 14px;
}

.record-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.delete-record {
  min-height: 32px;
  padding: 0 10px;
  border-color: #fecaca;
  color: #b91c1c;
  font-size: .82rem;
}

.delete-record:hover {
  background: #fff1f2;
  border-color: #fca5a5;
}

.stat-card {
  min-width: 210px;
}

#recordForm {
  display: grid;
  gap: 10px;
}

dialog {
  width: min(760px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(20, 18, 15, .42);
}

#gameForm {
  display: grid;
  gap: 10px;
  padding: 18px;
}

#gameForm fieldset {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
  background: #f8fbff;
}

#gameForm legend {
  padding: 0 6px;
  color: var(--brand-dark);
  font-weight: 950;
}

.top-button {
  position: fixed;
  right: clamp(16px, 3vw, 28px);
  bottom: clamp(16px, 3vw, 28px);
  z-index: 30;
  width: 54px;
  height: 54px;
  min-height: 54px;
  padding: 0;
  border: 1px solid rgba(15, 118, 110, .28);
  border-radius: 999px;
  background: #ffffff;
  color: var(--brand-dark);
  font-size: .82rem;
  font-weight: 950;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .16);
}

.top-button:hover {
  background: linear-gradient(180deg, #ffffff, #dff9ef);
}

@media (max-width: 1180px) {
  .wiki-grid {
    grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
    gap: 18px;
  }

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

@media (max-width: 900px) {
  .app-header,
  .wiki-grid,
  .tool-grid,
  .record-grid,
  .fact-grid,
  .detail-tags,
  .detail-sections {
    grid-template-columns: 1fr;
  }

  .app-header {
    gap: 18px;
    min-height: auto;
    padding-block: 24px 20px;
  }

  .wiki-grid > section:first-child {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .game-list {
    max-height: 420px;
  }

  .detail-panel {
    max-height: none;
    overflow: visible;
  }

  .table-scene {
    height: 128px;
    transform: none;
  }

  .toolbar select,
  .toolbar button,
  .inline-controls > * {
    width: 100%;
  }

  .active-filters {
    margin-top: -6px;
  }

  .tool-controls {
    grid-template-columns: 1fr 1fr;
  }

  .inline-controls,
  .form-row {
    flex-wrap: wrap;
  }

  .record-grid .wide:last-child {
    grid-column: auto;
  }

  .score-tool,
  .tool-panel.wide:not(.score-tool),
  .wide {
    grid-column: auto;
  }

  #tools {
    overflow-x: hidden;
  }

  .tool-panel {
    min-width: 0;
  }

  .score-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .score-wrap table {
    width: max-content;
    min-width: 620px;
  }

  .score-wrap {
    display: none;
  }

  .score-cards {
    display: grid;
    gap: 12px;
    margin-top: 14px;
  }

  .score-player-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #ffffff;
    padding: 12px;
  }

  .score-player-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
  }

  .score-player-head strong {
    min-width: 64px;
    padding: 8px 10px;
    border-radius: 999px;
    background: var(--gold-soft);
    color: #854d0e;
    text-align: center;
  }

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

  .score-round-grid label {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 850;
  }

  .score-round-grid input {
    min-height: 44px;
    text-align: center;
    font-weight: 900;
  }
}

@media (max-width: 560px) {
  .tabs {
    overflow-x: auto;
  }

  .tab {
    flex: 0 0 auto;
  }

  h1 {
    font-size: 1.9rem;
  }

  main {
    padding: 16px 14px 44px;
  }

  .app-header {
    padding-inline: 14px;
  }

  .tabs {
    padding-inline: 14px;
  }

  .toolbar {
    padding: 10px;
  }

  .detail-panel,
  .tool-panel,
  .wiki-grid > section:first-child {
    padding: 16px;
  }

  .detail-header {
    margin: -16px -16px 16px;
    padding: 16px;
  }

  .detail-actions {
    flex-direction: row;
    flex: 0 0 auto;
  }

  #backToList {
    display: inline-flex;
  }

  .fact-grid span {
    min-height: 62px;
  }

  .tool-controls {
    grid-template-columns: 1fr;
  }

  .timer-display {
    font-size: clamp(3rem, 18vw, 4.4rem);
  }

  .score-wrap table {
    min-width: 560px;
  }

  .wiki-grid > section:first-child {
    padding: 12px;
  }

  .game-list {
    max-height: 360px;
    gap: 8px;
    padding-right: 2px;
  }

  .game-card {
    display: grid;
    grid-template-rows: 1fr;
    align-items: center;
    align-content: center;
    justify-content: stretch;
    justify-items: start;
    height: auto;
    padding: 10px 12px 10px 14px;
    border-color: #e2e8f0;
    background: #ffffff;
    min-height: 42px;
  }

  .game-card.active {
    padding: 11px 12px 11px 15px;
    border-color: var(--brand);
    min-height: 46px;
  }

  .game-title {
    display: grid;
    align-items: center;
    justify-items: start;
    width: 100%;
    min-height: 100%;
    margin-bottom: 0;
    line-height: 1.2;
    text-align: left;
  }

  .game-title strong {
    display: block;
    font-size: .96rem;
    line-height: 1.2;
  }

  .game-title small {
    display: none;
  }

  .game-card .meta {
    display: none;
  }

  .game-card .meta span {
    min-height: 22px;
    padding: 1px 7px;
    font-size: .78rem;
  }

  .game-card .tag-row {
    display: none;
  }

  .game-card.active .tag-row {
    display: none;
  }

  .player-name-input {
    min-width: 128px;
  }

  .top-button {
    width: 48px;
    height: 48px;
    min-height: 48px;
    font-size: .76rem;
  }
}

@media (min-width: 561px) {
  #gameList > button.game-card {
    box-sizing: border-box;
    width: 100%;
    height: 100px !important;
    min-height: 100px !important;
    max-height: 100px !important;
  }
}
