:root {
  --paper: #f3ecdd;
  --paper-deep: #e8ddc8;
  --cream: #fffaf0;
  --ink: #1d2a23;
  --muted: #6d7267;
  --faint: #9b9d90;
  --line: #d8cdb8;
  --line-strong: #c4b79e;
  --green: #256148;
  --green-soft: #dfece2;
  --red: #b3442e;
  --red-soft: #f4ded5;
  --gold: #bd8429;
  --gold-soft: #f3e5c4;
  --blue: #2d5f73;
  --blue-soft: #dce9ed;
  --shadow: 0 20px 50px rgba(45, 38, 24, 0.12);
  --shadow-soft: 0 8px 24px rgba(45, 38, 24, 0.08);
  --radius: 18px;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --font-ui: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-ui);
  background:
    radial-gradient(circle at 16% 8%, rgba(255, 250, 240, 0.95), transparent 28rem),
    radial-gradient(circle at 88% 22%, rgba(220, 233, 237, 0.65), transparent 24rem),
    linear-gradient(145deg, #f7f1e4 0%, var(--paper) 45%, #efe4d1 100%);
  overflow-x: hidden;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  pointer-events: none;
  opacity: 0.25;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140' viewBox='0 0 140 140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.16'/%3E%3C/svg%3E");
}

body.modal-open {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: var(--green);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.55;
}

.orb-a {
  top: 9rem;
  left: -7rem;
  width: 19rem;
  height: 19rem;
  background: radial-gradient(circle at 35% 35%, rgba(241, 200, 120, 0.7), rgba(241, 200, 120, 0));
}

.orb-b {
  top: 3rem;
  right: -5rem;
  width: 23rem;
  height: 23rem;
  background: radial-gradient(circle at 45% 45%, rgba(167, 205, 190, 0.7), rgba(167, 205, 190, 0));
}

.orb-c {
  bottom: -8rem;
  left: 35%;
  width: 26rem;
  height: 26rem;
  background: radial-gradient(circle at 50% 50%, rgba(211, 171, 181, 0.4), rgba(211, 171, 181, 0));
}

.topbar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  width: min(1480px, calc(100% - 3rem));
  margin: 0 auto;
  padding: 1.4rem 0 0.8rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 2.8rem;
  height: 2.8rem;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 0.9rem;
  color: var(--cream);
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.18), transparent 40%),
    var(--green);
  box-shadow: var(--shadow-soft);
  transform: rotate(-4deg);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-copy strong {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.mode-switch {
  display: flex;
  gap: 0.2rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
}

.mode {
  padding: 0.48rem 0.95rem;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: transparent;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.mode:hover {
  color: var(--ink);
}

.mode.is-active {
  color: var(--cream);
  background: var(--ink);
  box-shadow: 0 3px 8px rgba(29, 42, 35, 0.25);
}

.icon-button {
  display: grid;
  width: 2.4rem;
  height: 2.4rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  background: rgba(255, 250, 240, 0.7);
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}

.icon-button:hover {
  background: var(--cream);
  transform: translateY(-1px);
}

main {
  position: relative;
  z-index: 1;
  width: min(1480px, calc(100% - 3rem));
  margin: 0 auto;
}

.kicker {
  display: inline-block;
  color: var(--gold);
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.game-grid {
  display: grid;
  grid-template-columns: minmax(215px, 0.78fr) minmax(460px, 1.7fr) minmax(215px, 0.78fr);
  align-items: start;
  gap: 1rem;
  padding: 0.9rem 0 2rem;
}

.side-panel,
.board {
  border: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.76);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}

.side-panel {
  display: flex;
  min-height: 610px;
  max-height: 760px;
  flex-direction: column;
  padding: 1rem;
  border-radius: var(--radius);
}

.panel-heading {
  display: flex;
  align-items: center;
  gap: 0.78rem;
  padding: 0.25rem 0.2rem 0.9rem;
}

.side-arrow {
  display: grid;
  width: 2.1rem;
  height: 2.1rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--green);
  font-family: var(--font-display);
  font-size: 1.2rem;
  background: var(--cream);
}

.panel-heading h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.panel-heading p {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
}

.search-box {
  position: relative;
  display: block;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.search-box .search-icon {
  position: absolute;
  top: 50%;
  left: 0.8rem;
  color: var(--faint);
  font-family: var(--font-display);
  font-size: 1.1rem;
  transform: translateY(-50%);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 0.72rem 0.8rem 0.72rem 2.2rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  outline: 0;
  color: var(--ink);
  font-size: 0.82rem;
  background: rgba(255, 255, 255, 0.55);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.search-box input::placeholder {
  color: var(--faint);
}

.search-box input:focus {
  border-color: var(--green);
  background: var(--cream);
  box-shadow: 0 0 0 3px rgba(37, 97, 72, 0.12);
}

.list-heading {
  display: flex;
  justify-content: space-between;
  padding: 1rem 0.25rem 0.5rem;
  color: var(--faint);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.word-list {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 0.38rem;
  overflow: auto;
  padding: 0.05rem 0.15rem 0.2rem;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.word-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  width: 100%;
  padding: 0.55rem 0.62rem;
  border: 1px solid transparent;
  border-radius: 0.85rem;
  text-align: left;
  background: transparent;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.word-row:hover,
.word-row:focus-visible {
  border-color: var(--line);
  outline: 0;
  background: var(--cream);
  transform: translateX(2px);
}

.word-row.is-helpful {
  border-color: rgba(37, 97, 72, 0.2);
  background: rgba(223, 236, 226, 0.46);
}

.word-row.is-rare .word-name {
  color: var(--muted);
  font-weight: 500;
}

.guess-mark {
  display: inline-block;
  margin-left: 0.28rem;
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 0.68em;
  font-weight: 400;
  vertical-align: 0.08em;
  cursor: help;
}

.word-main {
  min-width: 0;
}

.word-name {
  display: block;
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.word-letters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.12rem;
  margin-top: 0.25rem;
}

.letter-token {
  display: inline-grid;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.16rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 0.27rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  line-height: 1;
  background: rgba(255, 255, 255, 0.55);
}

.letter-token.is-multi {
  border-color: rgba(45, 95, 115, 0.3);
  color: var(--blue);
  background: var(--blue-soft);
}

.word-add {
  flex: 0 0 auto;
  display: grid;
  width: 1.55rem;
  height: 1.55rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--green);
  font-family: var(--font-display);
  font-size: 1rem;
  background: var(--cream);
}

.word-row:hover .word-add {
  color: var(--cream);
  background: var(--green);
}

.empty-state {
  margin: 1rem 0.2rem;
  color: var(--faint);
  font-size: 0.78rem;
  line-height: 1.5;
}

.board {
  position: relative;
  display: flex;
  min-height: 610px;
  flex-direction: column;
  gap: 0.8rem;
  padding: 1rem;
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
}

.challenge-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.95rem;
  background: linear-gradient(100deg, rgba(243, 229, 196, 0.62), rgba(255, 250, 240, 0.45));
}

.challenge-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.challenge-copy strong {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 600;
}

.challenge-stats {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.challenge-stats span {
  padding: 0.32rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
  white-space: nowrap;
  background: rgba(255, 250, 240, 0.72);
}

.chain-stage {
  position: relative;
  display: flex;
  min-height: 210px;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 0.4rem;
  border: 1px dashed var(--line-strong);
  border-radius: 1.1rem;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.6), transparent 65%),
    linear-gradient(180deg, rgba(255, 250, 240, 0.2), rgba(232, 221, 200, 0.2));
}

.chain {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  flex-wrap: wrap;
}

.chain-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--faint);
  text-align: center;
}

.chain-empty[hidden] {
  display: none;
}

.empty-glyph {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 2.4rem;
  line-height: 1;
}

.chain-empty p {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.chain-empty small {
  margin-top: 0.25rem;
  font-size: 0.7rem;
}

.chain-card {
  position: relative;
  min-width: 5.6rem;
  max-width: 12rem;
  padding: 0.7rem 0.7rem 0.55rem;
  border: 1px solid var(--line-strong);
  border-radius: 1rem;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.85), rgba(255, 250, 240, 0.65)),
    var(--cream);
  box-shadow: 0 7px 18px rgba(45, 38, 24, 0.1);
  animation: card-in 260ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.chain-card::before {
  position: absolute;
  top: 0.35rem;
  left: 50%;
  width: 1.2rem;
  height: 0.16rem;
  border-radius: 999px;
  content: "";
  background: var(--line);
  transform: translateX(-50%);
}

.chain-card .chain-word {
  display: block;
  margin-top: 0.12rem;
  overflow-wrap: anywhere;
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
}

.chain-card .word-letters {
  justify-content: center;
  margin-top: 0.42rem;
}

.chain-card .guess-mark {
  position: absolute;
  top: 0.32rem;
  right: 0.42rem;
  margin: 0;
  font-size: 0.62rem;
}

.chain-card.is-fresh {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(37, 97, 72, 0.1), 0 7px 18px rgba(45, 38, 24, 0.1);
}

.chain-card.is-palindrome {
  border-color: var(--green);
  background: linear-gradient(160deg, #f7fff8, var(--green-soft));
}

.status-card {
  padding: 0.8rem 0.9rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(255, 250, 240, 0.62);
  transition: background 200ms ease, border-color 200ms ease;
}

.status-card.is-win {
  border-color: rgba(37, 97, 72, 0.45);
  background: var(--green-soft);
}

.status-card.is-near {
  border-color: rgba(189, 132, 41, 0.35);
  background: rgba(243, 229, 196, 0.36);
}

.status-top {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

.status-icon {
  display: grid;
  width: 1.9rem;
  height: 1.9rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--gold);
  font-family: var(--font-display);
  background: var(--cream);
}

.status-card.is-win .status-icon {
  color: var(--cream);
  background: var(--green);
  border-color: var(--green);
}

.status-top strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 600;
}

.status-top p {
  margin: 0.14rem 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.meter {
  height: 0.34rem;
  margin-top: 0.6rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--paper-deep);
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--green));
  transition: width 260ms ease;
}

.meter-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 0.38rem;
  color: var(--faint);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.mirror {
  padding: 0.5rem 0.15rem 0.2rem;
}

.mirror-label {
  margin-bottom: 0.35rem;
  color: var(--faint);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-align: center;
  text-transform: uppercase;
}

.mirror-empty {
  color: var(--faint);
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-style: italic;
}

.mirror-row {
  display: flex;
  justify-content: center;
  gap: 0.2rem;
  min-height: 1.9rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 0.12rem 0;
  scrollbar-width: thin;
}

.mirror-token {
  display: inline-grid;
  min-width: 1.75rem;
  height: 1.75rem;
  padding: 0 0.28rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  background: rgba(255, 250, 240, 0.72);
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.mirror-token.is-multi {
  border-color: rgba(45, 95, 115, 0.3);
  color: var(--blue);
  background: var(--blue-soft);
}

.mirror-token.is-match {
  border-color: rgba(37, 97, 72, 0.35);
  color: var(--green);
  background: var(--green-soft);
}

.mirror-token.is-mismatch {
  border-color: rgba(179, 68, 46, 0.38);
  color: var(--red);
  background: var(--red-soft);
}

.mirror-token.is-center {
  border-color: var(--gold);
  color: #7d5515;
  background: var(--gold-soft);
}

.mirror-rule {
  height: 1px;
  margin: 0.2rem auto;
  background: repeating-linear-gradient(90deg, var(--line-strong) 0 5px, transparent 5px 10px);
  width: 82%;
}

.mirror-back {
  opacity: 0.82;
}

.board-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin-top: auto;
  padding-top: 0.2rem;
}

.action {
  padding: 0.58rem 0.85rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(255, 250, 240, 0.8);
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.action:hover:not(:disabled) {
  background: var(--cream);
  box-shadow: 0 4px 12px rgba(45, 38, 24, 0.1);
  transform: translateY(-1px);
}

.action:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.action-primary {
  border-color: var(--green);
  color: var(--cream);
  background: var(--green);
}

.action-primary:hover:not(:disabled) {
  color: var(--cream);
  background: #1c503a;
}

.action-quiet {
  border-color: transparent;
  color: var(--muted);
  background: transparent;
}

.action-quiet:hover:not(:disabled) {
  color: var(--ink);
  background: rgba(255, 250, 240, 0.7);
  box-shadow: none;
}

.hint-card {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 0.8rem;
  border: 1px solid rgba(189, 132, 41, 0.35);
  border-radius: 0.95rem;
  background: rgba(243, 229, 196, 0.5);
  animation: rise 240ms ease both;
}

.hint-card[hidden] {
  display: none;
}

.hint-mark {
  display: grid;
  width: 1.7rem;
  height: 1.7rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: #7d5515;
  background: var(--gold-soft);
}

.hint-copy {
  min-width: 0;
  flex: 1;
}

.hint-copy strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.95rem;
}

.hint-copy p {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.73rem;
  line-height: 1.45;
}

.hint-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: flex-end;
}

.hint-actions .action {
  padding: 0.42rem 0.65rem;
  font-size: 0.67rem;
}

.footer {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.2rem 0 2rem;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.68rem;
  line-height: 1.6;
}

.footer p {
  margin: 0;
}

.footer-mark {
  width: 100%;
  max-width: none;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.02em;
  text-align: left;
  word-spacing: 0.2em;
  overflow-wrap: anywhere;
}

.success {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(29, 42, 35, 0.42);
  backdrop-filter: blur(6px);
  animation: fade-in 220ms ease both;
}

.success[hidden] {
  display: none;
}

.success-card {
  position: relative;
  width: min(460px, 100%);
  overflow: hidden;
  padding: 2rem;
  border: 1px solid rgba(255, 250, 240, 0.4);
  border-radius: 1.5rem;
  text-align: center;
  background: var(--cream);
  box-shadow: 0 35px 80px rgba(20, 28, 23, 0.3);
  animation: success-pop 380ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.success-kicker {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  color: var(--cream);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: var(--green);
}

.success-card h2 {
  margin: 0.75rem 0 0;
  font-family: var(--font-display);
  font-size: 2.35rem;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.success-card p {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

.success-score {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin: 1rem 0 1.2rem;
}

.success-score span {
  padding: 0.4rem 0.62rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--paper);
}

.success-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
}

.confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  top: -10%;
  width: 0.42rem;
  height: 0.8rem;
  border-radius: 2px;
  animation: confetti-fall var(--fall-time) linear var(--fall-delay) both;
  transform: rotate(var(--start-rotate));
}

.help-dialog {
  width: min(620px, calc(100% - 2rem));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 1.4rem;
  color: var(--ink);
  background: var(--cream);
  box-shadow: 0 30px 80px rgba(20, 28, 23, 0.3);
}

.help-dialog::backdrop {
  background: rgba(29, 42, 35, 0.42);
  backdrop-filter: blur(5px);
}

.help-dialog form {
  padding: 1.4rem;
}

.help-head {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
}

.help-mark {
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: var(--cream);
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  background: var(--green);
}

.help-head h2 {
  margin: 0.18rem 0 0;
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.help-head .icon-button {
  margin-left: auto;
}

.help-body {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.6;
}

.help-body p {
  margin: 0.7rem 0;
}

.help-body strong {
  color: var(--ink);
}

.help-example {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: var(--paper);
}

.word-chip {
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.45rem;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 600;
  background: var(--cream);
}

.plus,
.equals {
  color: var(--faint);
  font-family: var(--font-display);
}

.letter-strip {
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.help-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0.8rem 0;
}

.help-grid > div {
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: var(--paper);
}

.help-letter {
  display: block;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
}

.help-grid small {
  display: block;
  margin-top: 0.18rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.03em;
}

.help-note {
  padding-top: 0.6rem;
  border-top: 1px solid var(--line);
  font-size: 0.75rem;
}

.help-close {
  width: 100%;
  margin-top: 0.8rem;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes success-pop {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes confetti-fall {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(var(--start-rotate));
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--drift), 34rem, 0) rotate(540deg);
  }
}

@media (max-width: 1050px) {
  .game-grid {
    grid-template-columns: minmax(190px, 0.8fr) minmax(380px, 1.8fr);
  }

  .side-right {
    grid-column: 1 / -1;
    min-height: 0;
    max-height: 320px;
  }

  .side-right .word-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar,
  main {
    width: min(100% - 1.2rem, 1480px);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.8rem;
    padding-top: 0.9rem;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .mode-switch {
    flex: 1;
  }

  .mode {
    flex: 1;
    padding-right: 0.55rem;
    padding-left: 0.55rem;
  }

  .game-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .board {
    order: -1;
    min-height: 0;
    padding: 0.7rem;
  }

  .side-panel {
    min-height: 0;
    max-height: 370px;
  }

  .side-right .word-list {
    display: flex;
  }

  .side-panel,
  .board {
    border-radius: 1.1rem;
  }

  .challenge-strip {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.4rem;
  }

  .challenge-stats {
    justify-content: flex-start;
  }

  .chain-stage {
    min-height: 170px;
  }

  .chain-card {
    min-width: 4.5rem;
    max-width: 8.5rem;
  }

  .mirror-row {
    justify-content: flex-start;
  }

  .board-actions {
    justify-content: stretch;
  }

  .board-actions .action {
    flex: 1 1 42%;
  }

  .hint-card {
    flex-wrap: wrap;
  }

  .hint-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .footer {
    flex-direction: column;
  }

  .footer-mark {
    text-align: left;
  }

  .help-grid {
    grid-template-columns: 1fr;
  }
}

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