:root {
  --bg: #f5efe6;
  --paper: #fffaf2;
  --ink: #2b2118;
  --ink-soft: #6b5c4d;
  --accent: #c0432c;
  --accent-soft: #e8b4a8;
  --line: #d8cbb8;
  --string: #c0432c;
  --string-new: #1d6f42;
  --shadow: 0 6px 24px rgba(60, 40, 20, 0.08);
  --radius: 14px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  background: none;
  border: 0;
  cursor: pointer;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px;
}

.brand:hover {
  color: var(--accent);
}

.brand-mark {
  display: inline-block;
  font-size: 26px;
  color: var(--accent);
  transform: translateY(-1px);
}

.crumb {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-soft);
}

main {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 22px 48px;
}

.foot {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 22px 40px;
  color: var(--ink-soft);
  font-size: 14px;
  text-align: center;
}

/* Home */

.intro {
  margin: 0 0 28px;
}
.intro h1 {
  font-family: var(--serif);
  font-size: 40px;
  line-height: 1.1;
  margin: 0 0 10px;
}
.intro p {
  margin: 0;
  color: var(--ink-soft);
  max-width: 640px;
}

.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.category {
  margin-bottom: 32px;
}

.category-title {
  font-family: var(--serif);
  font-size: 22px;
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 120ms ease, box-shadow 120ms ease,
    border-color 120ms ease;
  box-shadow: var(--shadow);
}

.card:hover,
.card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--accent-soft);
  outline: none;
}

.card-thumb {
  background: #faf3e6;
  border: 1px solid var(--line);
  border-radius: 10px;
  aspect-ratio: 3 / 2;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card-thumb svg {
  width: 100%;
  height: 100%;
}

.card-title {
  font-family: var(--serif);
  font-size: 22px;
  margin: 0;
}

.card-desc {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.card-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
}

.tag {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: #f1e5d2;
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 3px 9px;
}

.tag.diff-1 {
  background: #d8ecd8;
  color: #2f5d3a;
}
.tag.diff-2 {
  background: #f7e4b8;
  color: #6b5008;
}
.tag.diff-3 {
  background: #f3cfc6;
  color: #7a2c1c;
}

/* Game view */

.game-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 18px;
}

.game-head h1 {
  font-family: var(--serif);
  font-size: 34px;
  margin: 0;
}

.game-blurb {
  color: var(--ink-soft);
  margin: 0 0 22px;
  max-width: 680px;
}

.viewer {
  display: grid;
  grid-template-columns: minmax(280px, 1.2fr) 1fr;
  gap: 22px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

@media (max-width: 720px) {
  .viewer {
    grid-template-columns: 1fr;
  }
}

.stage {
  background: #fffdf7;
  border: 1px dashed var(--line);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 3 / 2;
}

.stage svg {
  width: 100%;
  height: 100%;
}

.stage.has-plate {
  flex-direction: column;
  aspect-ratio: auto;
  padding: 14px;
  gap: 12px;
  align-items: stretch;
}

.stage.has-plate svg {
  height: auto;
  max-height: 220px;
}

.plate {
  margin: 0;
  padding: 12px 0 0;
  border-top: 1px dashed var(--line);
  text-align: center;
}

.plate img {
  max-width: 100%;
  max-height: 260px;
  height: auto;
  border-radius: 4px;
  filter: sepia(0.06);
}

.plate figcaption {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 8px;
  letter-spacing: 0.04em;
}

.step-body h2 {
  font-family: var(--serif);
  font-size: 22px;
  margin: 0 0 8px;
}

.step-body .step-num {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 4px;
}

.step-body p {
  margin: 0 0 12px;
}

.step-body .tip {
  background: #f7eedd;
  border-left: 3px solid var(--accent);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--ink);
}

.controls {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.btn {
  background: var(--ink);
  color: var(--paper);
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease;
}
.btn:hover {
  background: var(--accent);
}
.btn:disabled {
  background: #d4c8b6;
  cursor: not-allowed;
}
.btn.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.progress {
  flex: 1;
  height: 6px;
  background: #ece2cf;
  border-radius: 999px;
  overflow: hidden;
  margin: 0 12px;
}

.progress > span {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width 200ms ease;
}

.glossary {
  margin-top: 28px;
  padding: 18px 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.glossary h3 {
  font-family: var(--serif);
  margin: 0 0 8px;
  font-size: 18px;
}

.glossary dl {
  margin: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 14px;
}

.glossary dt {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.glossary dd {
  margin: 0 0 4px;
  font-size: 14px;
  color: var(--ink-soft);
}

/* SVG diagram styling */

.hand {
  fill: #f0d9b5;
  stroke: #8a6a45;
  stroke-width: 1.4;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.hand.active {
  fill: #ffce7e;
  stroke: #5a3a18;
  stroke-width: 1.8;
}

.hand-detail {
  fill: none;
  stroke: #8a6a45;
  stroke-width: 0.9;
  opacity: 0.45;
  stroke-linecap: round;
}

.finger-tip {
  fill: #8a6a45;
}

.finger-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  fill: #5a3a18;
  text-anchor: middle;
}

.label {
  font-family: var(--mono);
  font-size: 9px;
  fill: #8a6a45;
}

.string-line {
  fill: none;
  stroke: var(--string);
  stroke-width: 2.2;
  stroke-linecap: round;
}

.string-new {
  stroke: var(--string-new);
  stroke-width: 2.6;
}

.string-loose {
  stroke-dasharray: 4 4;
  opacity: 0.7;
}

.arrow {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 5 4;
  opacity: 0.85;
}
