:root {
  --paper: #f5f2ea;
  --paper-deep: #ece7dc;
  --card: #fffdf8;
  --ink: #26312f;
  --muted: #7c817b;
  --line: #deddd4;
  --orange: #db754b;
  --orange-dark: #bd5834;
  --orange-soft: #fae8dc;
  --green: #507568;
  --chalkboard: #26332f;
  --chalkboard-deep: #1e2926;
  --cream: #fffaf0;
  --serif: "DM Serif Display", Georgia, serif;
  --sans: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --shadow: 0 16px 45px rgba(40, 45, 38, 0.07);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:not(:disabled) {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(219, 117, 75, 0.35);
  outline-offset: 3px;
}

button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: 230px;
  flex-direction: column;
  padding: 35px 24px 24px;
  background: #fbf9f3;
  border-right: 1px solid var(--line);
}

.brand,
.mobile-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -1.5px;
}

.brand-dot {
  color: var(--orange);
}

.brand-mark {
  display: grid;
  width: 31px;
  height: 31px;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
  padding: 3px;
  transform: rotate(-4deg);
  border-radius: 7px;
  background: var(--orange);
}

.brand-mark i {
  border: 1.5px solid #fff9ee;
  border-radius: 1px;
}

.main-nav {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 65px;
}

.nav-label,
.eyebrow,
.control-label {
  margin: 0;
  color: #8a8d86;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.8px;
}

.nav-label {
  margin: 0 12px 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 47px;
  padding: 0 13px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #6f756f;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-item:hover {
  background: #f0ede5;
  color: var(--ink);
}

.nav-item.active {
  background: var(--orange-soft);
  color: var(--orange-dark);
  font-weight: 700;
}

.nav-item .icon {
  width: 18px;
  height: 18px;
}

.nav-live-dot {
  width: 5px;
  height: 5px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--orange);
}

.nav-new {
  margin-left: auto;
  padding: 3px 5px;
  border-radius: 4px;
  background: #e7eee8;
  color: var(--green);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.7px;
}

.sidebar-bottom {
  margin-top: auto;
}

.streak-card {
  padding: 18px 16px 14px;
  border: 1px solid #e5e2d8;
  border-radius: 12px;
  background: #f7f4ec;
  text-align: center;
}

.streak-icon {
  display: grid;
  width: 38px;
  height: 38px;
  margin: -36px auto 10px;
  place-items: center;
  border: 4px solid #fbf9f3;
  border-radius: 50%;
  background: var(--orange-soft);
  color: var(--orange);
}

.streak-icon .icon {
  width: 18px;
}

.streak-card p {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 10px;
}

.streak-card strong {
  font-size: 13px;
}

.week-row {
  display: flex;
  justify-content: space-between;
  margin-top: 15px;
}

.week-row span {
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  border-radius: 50%;
  color: #a1a39c;
  font-size: 8px;
}

.week-row span.today {
  background: var(--orange);
  color: white;
}

.sidebar-footnote {
  margin: 18px 0 0;
  color: #a0a198;
  font-family: var(--serif);
  font-size: 12px;
  font-style: italic;
  text-align: center;
}

.main-content {
  min-height: 100vh;
  margin-left: 230px;
  background-image: radial-gradient(rgba(64, 72, 63, 0.035) 0.7px, transparent 0.7px);
  background-size: 8px 8px;
}

.topbar {
  display: flex;
  height: 77px;
  align-items: center;
  justify-content: space-between;
  padding: 0 42px;
  border-bottom: 1px solid var(--line);
  background: rgba(250, 248, 242, 0.8);
  backdrop-filter: blur(10px);
}

.mobile-brand {
  display: none;
}

.topbar-note {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #848980;
  font-size: 11px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7b9a80;
  box-shadow: 0 0 0 4px rgba(123, 154, 128, 0.1);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat-pill {
  display: flex;
  height: 34px;
  align-items: center;
  gap: 5px;
  padding: 0 12px;
  border: 1px solid #e2dfd5;
  border-radius: 20px;
  background: #fffdf8;
  font-size: 11px;
}

.stat-pill .icon {
  width: 14px;
  color: #cf9845;
  fill: #f2d69d;
  stroke-width: 1.4;
}

.stat-pill strong {
  margin-left: 3px;
}

.stat-pill span {
  color: #9b9d96;
  font-size: 9px;
}

.icon-button {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  border: 1px solid #e2dfd5;
  border-radius: 50%;
  background: #fffdf8;
  color: #737a72;
  transition: background 150ms ease;
}

.icon-button:hover {
  background: var(--paper-deep);
}

.icon-button .icon {
  width: 16px;
  height: 16px;
}

.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #f9f5e9;
  font-family: var(--serif);
  font-size: 15px;
}

.content-wrap {
  width: min(1130px, calc(100% - 72px));
  margin: 0 auto;
  padding: 43px 0 55px;
}

.view {
  animation: view-in 300ms ease both;
}

.game-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow {
  color: var(--orange-dark);
}

.game-heading .eyebrow span {
  margin: 0 5px;
  color: #b7b5ab;
}

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

.game-heading h1 {
  margin: 8px 0 5px;
  font-family: var(--serif);
  font-size: clamp(38px, 4vw, 48px);
  font-weight: 400;
  letter-spacing: -1.5px;
  line-height: 1.05;
}

.title-dot {
  color: var(--orange);
}

.game-heading > div > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.outline-button {
  display: inline-flex;
  height: 39px;
  align-items: center;
  gap: 8px;
  padding: 0 15px;
  border: 1px solid #d9d9d0;
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.65);
  color: #686f69;
  font-size: 11px;
  font-weight: 600;
}

.outline-button:hover {
  border-color: #bfc3ba;
  background: var(--card);
}

.outline-button .icon {
  width: 16px;
}

.level-strip {
  display: flex;
  min-height: 52px;
  align-items: center;
  gap: 17px;
  margin: 31px 0 18px;
  padding: 8px 15px;
  border: 1px solid #e0ded5;
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.5);
}

.level-strip-label {
  color: #8d9088;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.4px;
}

.level-buttons {
  display: flex;
  align-items: center;
  gap: 7px;
}

.level-button {
  position: relative;
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #8e928a;
  font-size: 11px;
  font-weight: 600;
}

.level-button:hover:not(:disabled) {
  background: #ece9df;
}

.level-button.active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.level-button.solved:not(.active) {
  background: #e2ebe4;
  color: var(--green);
}

.level-button:disabled {
  opacity: 0.35;
}

.level-button .icon {
  width: 12px;
  height: 12px;
}

.level-progress-copy {
  margin-left: auto;
  color: #92958d;
  font-size: 10px;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 285px;
  gap: 18px;
  align-items: stretch;
}

.board-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(21, 33, 29, 0.5);
  border-radius: 13px;
  background: var(--chalkboard);
  box-shadow: var(--shadow);
  color: #f6f2e8;
}

.board-header {
  display: flex;
  min-height: 73px;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.board-header > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.board-kicker {
  color: #a7b5ab;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1.5px;
}

.board-header strong {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 400;
}

.board-difficulty {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #b6c0b7;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 1px;
}

.board-difficulty i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #9db995;
}

.board-stage {
  position: relative;
  display: grid;
  min-height: 412px;
  flex: 1;
  place-items: center;
  overflow: hidden;
  padding: 32px;
  background:
    radial-gradient(ellipse at 15% 30%, rgba(255, 255, 255, 0.025), transparent 45%),
    radial-gradient(ellipse at 85% 80%, rgba(255, 255, 255, 0.018), transparent 40%),
    repeating-linear-gradient(7deg, transparent 0, transparent 5px, rgba(255, 255, 255, 0.006) 6px);
}

.chalk-decoration {
  position: absolute;
  width: 45px;
  height: 45px;
  opacity: 0.08;
  border: 1px solid white;
  transform: rotate(12deg);
}

.chalk-one {
  top: 35px;
  right: 40px;
}

.chalk-two {
  bottom: 35px;
  left: 40px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.puzzle-grid {
  position: relative;
  z-index: 2;
  display: grid;
  width: min(310px, 100%);
  gap: 2px;
  padding: 3px;
  background: #8f745f;
  box-shadow: 0 12px 25px rgba(4, 12, 9, 0.22), 0 0 0 1px rgba(241, 206, 169, 0.25);
  touch-action: none;
  user-select: none;
}

.grid-cell {
  position: relative;
  display: grid;
  min-width: 0;
  aspect-ratio: 1;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--cream);
  box-shadow: inset 0 0 18px rgba(124, 94, 55, 0.035);
  color: #252622;
  font-family: var(--serif);
  font-size: clamp(31px, 4vw, 43px);
  line-height: 1;
  transition: background 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.puzzle-grid.wide-grid {
  width: min(430px, 100%);
}

.puzzle-grid.dense-grid .grid-cell {
  font-size: clamp(22px, 2.7vw, 34px);
}

.grid-cell:hover {
  background: #fff3df;
}

.grid-cell.in-selection {
  z-index: 1;
  background: #f9dfc7;
  box-shadow: inset 0 0 0 3px var(--orange);
  color: #a64d2b;
}

.grid-cell.is-found::after {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #d19a77;
  content: "";
}

.grid-cell.hint-cell {
  animation: hint-pulse 850ms ease 2;
}

.puzzle-grid.is-wrong {
  animation: board-shake 300ms ease;
}

.board-footer {
  display: flex;
  min-height: 49px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 25px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: #aab6ad;
  font-size: 9px;
}

.board-footer > span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.board-footer .icon {
  width: 13px;
  height: 13px;
}

.found-counter strong {
  color: #fff9ed;
  font-size: 12px;
}

.found-counter i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #d68c64;
}

.control-panel {
  display: flex;
  flex-direction: column;
  padding: 24px;
  border: 1px solid #e2ded3;
  border-radius: 13px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.target-block {
  text-align: center;
}

.target-number {
  display: grid;
  width: 90px;
  height: 83px;
  margin: 14px auto 12px;
  place-items: center;
  border: 1px solid #d8a484;
  border-radius: 5px;
  background: #fff9ef;
  box-shadow: 0 0 0 4px #fff9ef, 0 0 0 5px #eee0ce;
  color: #282923;
  font-family: var(--serif);
  font-size: 45px;
  line-height: 1;
}

.target-block p {
  margin: 0;
  color: #919289;
  font-size: 10px;
  line-height: 1.6;
}

.selection-readout {
  display: flex;
  min-height: 41px;
  align-items: center;
  justify-content: space-between;
  margin: 19px 0 21px;
  padding: 0 12px;
  border-radius: 7px;
  background: #f4f2eb;
  transition: background 150ms ease, color 150ms ease;
}

.selection-readout > span {
  color: #8b8f87;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1.1px;
}

.selection-readout strong {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 400;
}

.selection-readout.is-match {
  background: #e4eee6;
  color: #426555;
}

.selection-readout.is-match > span {
  color: #668271;
}

.selection-readout.is-miss {
  background: #f8eae0;
}

.answer-block .control-label {
  display: block;
  margin-bottom: 10px;
  text-align: center;
}

.answer-stepper {
  display: grid;
  height: 52px;
  grid-template-columns: 50px 1fr 50px;
  overflow: hidden;
  border: 1px solid #dcded5;
  border-radius: 8px;
  background: white;
}

.answer-stepper button {
  border: 0;
  background: #faf9f5;
  color: #747b73;
  font-size: 22px;
  transition: background 150ms ease;
}

.answer-stepper button:first-child {
  border-right: 1px solid #e4e4dc;
}

.answer-stepper button:last-child {
  border-left: 1px solid #e4e4dc;
}

.answer-stepper button:hover {
  background: #eeece5;
  color: var(--orange-dark);
}

.answer-stepper input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: white;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 25px;
  text-align: center;
  appearance: textfield;
  -moz-appearance: textfield;
}

.answer-stepper input::-webkit-inner-spin-button,
.answer-stepper input::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}

.primary-button {
  display: inline-flex;
  min-height: 47px;
  align-items: center;
  justify-content: center;
  gap: 11px;
  padding: 0 20px;
  border: 0;
  border-radius: 8px;
  background: var(--orange);
  box-shadow: 0 4px 0 #b95734;
  color: white;
  font-size: 12px;
  font-weight: 700;
  transition: background 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.primary-button:hover {
  background: #cf6740;
  transform: translateY(-1px);
  box-shadow: 0 5px 0 #b95734;
}

.primary-button:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #b95734;
}

.primary-button .icon {
  width: 17px;
}

.check-button {
  width: 100%;
  margin-top: 17px;
}

.secondary-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 15px;
}

.secondary-actions button {
  display: flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  background: transparent;
  color: #7d827a;
  font-size: 10px;
  font-weight: 600;
}

.secondary-actions button:first-child {
  border-right: 1px solid #e4e3db;
}

.secondary-actions button:hover:not(:disabled) {
  color: var(--orange-dark);
}

.secondary-actions button:disabled {
  opacity: 0.4;
}

.secondary-actions .icon {
  width: 14px;
  height: 14px;
}

#hint-count {
  display: grid;
  width: 15px;
  height: 15px;
  place-items: center;
  border-radius: 50%;
  background: #eeeae0;
  font-size: 8px;
}

.game-feedback {
  min-height: 29px;
  margin-top: 9px;
  color: #8b8e86;
  font-size: 9px;
  line-height: 1.45;
  text-align: center;
}

.game-feedback.success {
  color: var(--green);
}

.game-feedback.error {
  color: var(--orange-dark);
}

.found-tray {
  display: flex;
  align-items: center;
  gap: 25px;
  margin-top: 13px;
  padding: 13px 18px;
  border: 1px solid #dfddd3;
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.75);
  animation: view-in 200ms ease;
}

.found-tray > div:first-child {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 4px;
}

.found-tray > div:first-child > span:last-child {
  color: #96988f;
  font-size: 8px;
}

.found-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.found-chip {
  padding: 6px 8px;
  border: 1px solid #e2d8ca;
  border-radius: 5px;
  background: #faf4e9;
  color: #9b6548;
  font-size: 9px;
  font-weight: 600;
}

.rules-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 24px;
  padding: 0 4px;
}

.rules-strip > div {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.rule-number {
  display: grid;
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #d9d9cf;
  border-radius: 50%;
  color: #92958c;
  font-family: var(--serif);
  font-size: 10px;
}

.rules-strip p {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 1px 0 0;
}

.rules-strip strong {
  font-size: 10px;
  font-weight: 600;
}

.rules-strip p span {
  color: #95978f;
  font-size: 9px;
  line-height: 1.4;
}

.modal {
  width: min(490px, calc(100% - 32px));
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 37px;
  border: 1px solid #e2ddd1;
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 30px 100px rgba(18, 28, 24, 0.28);
  color: var(--ink);
}

.modal::backdrop {
  background: rgba(24, 34, 30, 0.65);
  backdrop-filter: blur(5px);
}

.modal[open] {
  animation: modal-in 250ms ease both;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
}

.modal h2 {
  margin: 8px 0 9px;
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 400;
}

.modal-intro {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.how-example {
  display: grid;
  grid-template-columns: 115px 1fr;
  align-items: center;
  gap: 22px;
  margin: 23px 0;
  padding: 17px;
  border-radius: 10px;
  background: var(--chalkboard);
}

.mini-example-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  padding: 2px;
  background: #9b7e63;
}

.mini-example-grid span {
  display: grid;
  aspect-ratio: 1;
  place-items: center;
  background: var(--cream);
  font-family: var(--serif);
  font-size: 20px;
}

.mini-example-grid i {
  position: absolute;
  inset: 2px 2px auto;
  height: calc(33.333% - 1px);
  border: 2px solid var(--orange);
  pointer-events: none;
}

.example-copy > span {
  color: #c7a78c;
  font-size: 8px;
  letter-spacing: 1.3px;
}

.example-copy strong {
  display: block;
  margin: 5px 0;
  color: #fff8e9;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 400;
}

.example-copy p {
  margin: 0;
  color: #b4bdb5;
  font-size: 9px;
  line-height: 1.55;
}

.instruction-list {
  display: flex;
  flex-direction: column;
  gap: 17px;
  margin: 0 0 27px;
  padding: 0;
  list-style: none;
}

.instruction-list li {
  display: flex;
  gap: 12px;
}

.instruction-list li > span {
  display: grid;
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--orange-soft);
  color: var(--orange-dark);
  font-size: 10px;
  font-weight: 700;
}

.instruction-list p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.instruction-list strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 11px;
}

.modal-primary {
  width: 100%;
}

.success-modal {
  overflow: hidden;
  text-align: center;
}

.trophy-wrap {
  display: grid;
  width: 70px;
  height: 70px;
  margin: 0 auto 21px;
  place-items: center;
  border: 1px solid #e7c99d;
  border-radius: 50%;
  background: #fbf0d9;
  color: #bc873b;
}

.trophy-wrap .icon {
  width: 32px;
  height: 32px;
}

.success-modal > p:not(.eyebrow) {
  color: var(--muted);
  font-size: 12px;
}

.success-modal > p strong {
  color: var(--ink);
}

.reward-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 25px 0;
  padding: 14px 17px;
  border-radius: 8px;
  background: #f4f1e9;
  font-size: 11px;
}

.reward-row span:first-child {
  color: #a7742e;
  font-weight: 700;
}

.reward-row span:last-child {
  color: var(--muted);
}

.text-button {
  margin-top: 17px;
  border: 0;
  background: transparent;
  color: #81867e;
  font-size: 10px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.success-burst i {
  position: absolute;
  width: 6px;
  height: 13px;
  background: var(--orange);
  transform: rotate(25deg);
}

.success-burst i:nth-child(1) { top: 30px; left: 50px; transform: rotate(-30deg); }
.success-burst i:nth-child(2) { top: 75px; left: 28px; width: 9px; height: 6px; background: #7c9b83; }
.success-burst i:nth-child(3) { top: 27px; right: 55px; transform: rotate(45deg); background: #d4a545; }
.success-burst i:nth-child(4) { top: 90px; right: 27px; transform: rotate(70deg); }
.success-burst i:nth-child(5) { top: 145px; left: 45px; transform: rotate(55deg); background: #d4a545; }
.success-burst i:nth-child(6) { top: 150px; right: 44px; width: 8px; height: 8px; border-radius: 50%; background: #7c9b83; }

.toast {
  position: fixed;
  z-index: 100;
  right: 25px;
  bottom: 25px;
  max-width: min(340px, calc(100% - 32px));
  padding: 12px 17px;
  border-radius: 8px;
  background: var(--ink);
  box-shadow: 0 8px 30px rgba(20, 30, 25, 0.2);
  color: white;
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.library-hero {
  position: relative;
  display: grid;
  min-height: 300px;
  grid-template-columns: 1.1fr 1fr;
  overflow: hidden;
  padding: 40px 48px;
  border-radius: 15px;
  background: var(--chalkboard);
  color: white;
}

.library-hero h1 {
  margin: 10px 0 12px;
  font-family: var(--serif);
  font-size: 46px;
  font-weight: 400;
  line-height: 1.03;
}

.library-hero h1 em {
  color: #e7ae88;
  font-weight: 400;
}

.library-hero .eyebrow {
  color: #c4a68e;
}

.library-intro {
  max-width: 385px;
  color: #b7c0b8;
  font-size: 12px;
  line-height: 1.65;
}

.library-play {
  min-height: 42px;
  margin-top: 5px;
}

.hero-art {
  position: relative;
}

.hero-card {
  position: absolute;
  top: 22px;
  left: 65px;
  display: grid;
  width: 175px;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  padding: 3px;
  background: #9b7d62;
  box-shadow: 12px 18px 30px rgba(7, 16, 12, 0.3);
  transform: rotate(6deg);
}

.hero-card span {
  display: grid;
  aspect-ratio: 1;
  place-items: center;
  background: var(--cream);
  color: #272924;
  font-family: var(--serif);
  font-size: 31px;
}

.hero-target {
  position: absolute;
  top: 42px;
  right: 5px;
  display: flex;
  width: 75px;
  height: 85px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid #d5a37f;
  background: #fff8e9;
  box-shadow: 6px 9px 20px rgba(7, 16, 12, 0.25);
  color: #292b26;
  transform: rotate(-6deg);
}

.hero-target small {
  color: #a87959;
  font-size: 7px;
  letter-spacing: 1px;
}

.hero-target strong {
  font-family: var(--serif);
  font-size: 37px;
  font-weight: 400;
}

.hero-spark {
  position: absolute;
  color: #d9b393;
  font-family: var(--serif);
  font-size: 26px;
  opacity: 0.5;
}

.spark-one { top: 0; right: 70px; }
.spark-two { bottom: 5px; left: 20px; transform: rotate(20deg); }

.section-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin: 37px 0 18px;
}

.section-title-row h2 {
  margin: 5px 0 0;
  font-family: var(--serif);
  font-size: 29px;
  font-weight: 400;
}

.section-title-row > span {
  color: var(--muted);
  font-size: 10px;
}

.game-library-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 17px;
}

.library-card {
  display: grid;
  min-width: 0;
  grid-template-columns: 135px 1fr;
  overflow: hidden;
  padding: 0;
  border: 1px solid #deddd3;
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  text-align: left;
}

button.library-card {
  transition: transform 180ms ease, box-shadow 180ms ease;
}

button.library-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.library-card-art {
  display: grid;
  min-height: 188px;
  place-content: center;
  background: #e9e4d9;
}

.quad-art {
  grid-template-columns: repeat(2, 48px);
  gap: 1px;
  background: var(--chalkboard);
}

.quad-art span {
  display: grid;
  height: 48px;
  place-items: center;
  background: var(--cream);
  font-family: var(--serif);
  font-size: 20px;
}

.library-card-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  padding: 22px;
}

.game-number {
  color: var(--orange-dark);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 1.2px;
}

.library-card h3 {
  margin: 7px 0 5px;
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 400;
}

.library-card p {
  margin: 0 0 15px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.card-link,
.coming-soon {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--orange-dark);
  font-size: 10px;
  font-weight: 700;
}

.card-link .icon,
.coming-soon .icon {
  width: 14px;
  height: 14px;
}

.library-card.locked {
  opacity: 0.67;
}

.library-card.locked .game-number,
.library-card.locked .coming-soon {
  color: #81877f;
}

.pattern-art {
  grid-template-columns: repeat(3, 29px);
  gap: 5px;
}

.pattern-art i {
  width: 29px;
  height: 29px;
  border: 1px solid #a2aaa1;
  border-radius: 50%;
}

.pattern-art i:nth-child(2n) { border-radius: 2px; background: #a2aaa1; }
.pattern-art i:nth-child(3n) { background: var(--orange); border-color: var(--orange); }

.memory-art {
  grid-template-columns: repeat(2, 43px);
  gap: 5px;
}

.memory-art i {
  display: grid;
  height: 43px;
  place-items: center;
  border-radius: 5px;
  background: #fffaf0;
  box-shadow: 0 2px 4px rgba(30, 40, 35, 0.1);
  color: #65766b;
  font-family: var(--serif);
  font-size: 20px;
  font-style: normal;
}

.memory-art i:nth-child(2) { background: #dce6dd; }

.sum-art {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px;
}

.sum-art span {
  font-family: var(--serif);
  font-size: 26px;
}

.sum-art b {
  color: #9b9e96;
  font-size: 13px;
  font-weight: 400;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes board-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

@keyframes hint-pulse {
  0%, 100% { background: var(--cream); }
  50% { background: #f7c998; box-shadow: inset 0 0 0 3px var(--orange); }
}

@media (min-width: 1450px) {
  .sidebar { width: 250px; padding-right: 29px; padding-left: 29px; }
  .main-content { margin-left: 250px; }
  .content-wrap { width: 1180px; }
  .board-stage { min-height: 450px; }
  .puzzle-grid { width: 330px; }
  .control-panel { padding: 28px; }
  .game-layout { grid-template-columns: minmax(0, 1fr) 305px; }
}

@media (max-width: 1100px) {
  .sidebar { width: 205px; padding-right: 17px; padding-left: 17px; }
  .main-content { margin-left: 205px; }
  .content-wrap { width: calc(100% - 40px); }
  .topbar { padding: 0 25px; }
  .game-layout { grid-template-columns: minmax(0, 1fr) 255px; }
  .control-panel { padding: 20px; }
  .board-stage { padding: 25px; }
  .puzzle-grid { width: min(275px, 100%); }
  .rules-strip { gap: 15px; }
  .hero-card { left: 20px; }
  .hero-target { right: -15px; }
  .library-hero { padding: 35px; }
  .library-card { grid-template-columns: 110px 1fr; }
  .library-card-copy { padding: 16px; }
}

@media (max-width: 850px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .topbar { height: 67px; padding: 0 22px; }
  .mobile-brand { display: inline-flex; font-size: 24px; gap: 8px; }
  .mobile-brand .brand-mark { width: 25px; height: 25px; border-radius: 5px; }
  .topbar-note { display: none; }
  .content-wrap { width: min(680px, calc(100% - 36px)); padding-top: 32px; }
  .game-layout { grid-template-columns: minmax(0, 1fr) 260px; }
  .board-stage { min-height: 390px; padding: 23px; }
  .board-header { padding: 0 20px; }
  .board-footer { padding: 0 18px; }
  .board-footer > span:first-child { max-width: 120px; line-height: 1.4; }
  .rules-strip { grid-template-columns: 1fr; gap: 13px; }
  .rules-strip p span { font-size: 10px; }
  .library-hero { grid-template-columns: 1fr; }
  .hero-art { display: none; }
  .game-library-grid { grid-template-columns: 1fr; }
  .library-card { grid-template-columns: 140px 1fr; }
}

@media (max-width: 640px) {
  .content-wrap { width: calc(100% - 28px); padding: 25px 0 35px; }
  .topbar { padding: 0 15px; }
  .topbar-actions { gap: 8px; }
  .avatar { display: none; }
  .game-heading { align-items: flex-start; }
  .game-heading h1 { font-size: 39px; }
  .game-heading > div > p:last-child { max-width: 245px; line-height: 1.5; }
  .how-button { width: 37px; padding: 0; justify-content: center; }
  .how-button .icon { width: 18px; }
  .how-button { font-size: 0; }
  .level-strip { gap: 10px; margin-top: 24px; padding: 8px 10px; }
  .level-strip-label { display: none; }
  .level-buttons { gap: 4px; }
  .level-button { width: 27px; height: 27px; }
  .level-progress-copy { font-size: 8px; }
  .game-layout { grid-template-columns: 1fr; }
  .board-stage { min-height: 370px; padding: 28px; }
  .puzzle-grid { width: min(280px, 100%); }
  .grid-cell { font-size: 38px; }
  .control-panel { display: grid; grid-template-columns: 1fr 1fr; column-gap: 20px; padding: 22px; }
  .target-block { grid-row: span 2; }
  .target-number { width: 80px; height: 75px; }
  .selection-readout { margin: 0 0 14px; }
  .answer-block { align-self: start; }
  .check-button { grid-column: 1 / -1; }
  .secondary-actions, .game-feedback { grid-column: 1 / -1; }
  .game-feedback { margin-bottom: -7px; }
  .found-tray { align-items: flex-start; flex-direction: column; gap: 10px; }
  .rules-strip { margin-top: 22px; }
  .library-hero { min-height: 320px; padding: 30px; }
  .library-hero h1 { font-size: 42px; }
  .library-card { grid-template-columns: 110px 1fr; }
  .library-card-art { min-height: 180px; }
  .quad-art { grid-template-columns: repeat(2, 37px); }
  .quad-art span { height: 37px; font-size: 17px; }
  .pattern-art { grid-template-columns: repeat(3, 23px); }
  .pattern-art i { width: 23px; height: 23px; }
  .memory-art { grid-template-columns: repeat(2, 34px); }
  .memory-art i { height: 34px; }
  .sum-art { flex-wrap: wrap; gap: 3px; }
  .sum-art span { font-size: 20px; }
  .modal { padding: 31px 24px; }
  .how-example { grid-template-columns: 95px 1fr; gap: 15px; padding: 13px; }
  .toast { right: 16px; bottom: 16px; }
}

@media (max-width: 390px) {
  .stat-pill { padding: 0 9px; }
  .level-progress-copy { display: none; }
  .level-buttons { width: 100%; justify-content: space-between; }
  .control-panel { column-gap: 12px; padding: 18px; }
  .board-stage { padding: 24px; }
  .target-number { width: 72px; height: 69px; font-size: 39px; }
  .answer-stepper { grid-template-columns: 40px 1fr 40px; }
  .library-card { grid-template-columns: 95px 1fr; }
  .library-card-copy { padding: 14px; }
}

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

.gomoku-modebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 30px 0 18px;
}

.mode-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid #dfddd3;
  border-radius: 10px;
  background: #ece9df;
}

.mode-switch button {
  display: inline-flex;
  min-height: 35px;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #7b8179;
  font-size: 10px;
  font-weight: 600;
}

.mode-switch button.active {
  background: var(--card);
  box-shadow: 0 2px 8px rgba(38, 45, 39, 0.08);
  color: var(--orange-dark);
}

.mode-switch .icon {
  width: 15px;
  height: 15px;
}

#gomoku-mode-note {
  color: #8c9088;
  font-size: 9px;
}

.gomoku-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: stretch;
}

.gomoku-board-panel {
  min-width: 0;
}

.gomoku-board-stage {
  position: relative;
  display: grid;
  min-height: 520px;
  flex: 1;
  place-items: center;
  padding: 26px;
  background: radial-gradient(ellipse at 50% 40%, #31423b, #202d28 80%);
}

.gomoku-board {
  display: grid;
  width: min(490px, 100%);
  aspect-ratio: 1;
  grid-template-columns: repeat(11, 1fr);
  padding: 13px;
  border: 1px solid #b18b59;
  border-radius: 3px;
  background:
    repeating-linear-gradient(7deg, transparent 0, rgba(90, 57, 26, 0.025) 1px, transparent 3px, transparent 7px),
    #d8b783;
  box-shadow: 0 16px 30px rgba(5, 13, 10, 0.35), inset 0 0 30px rgba(110, 68, 29, 0.12);
}

.gomoku-cell {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: #634c32;
}

.gomoku-cell::before,
.gomoku-cell::after {
  position: absolute;
  z-index: 0;
  background: rgba(77, 57, 35, 0.63);
  content: "";
  pointer-events: none;
}

.gomoku-cell::before {
  top: 50%;
  right: 0;
  left: 0;
  height: 1px;
}

.gomoku-cell::after {
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
}

.gomoku-cell[data-row="0"]::after { top: 50%; }
.gomoku-cell[data-row="10"]::after { bottom: 50%; }
.gomoku-cell[data-col="0"]::before { left: 50%; }
.gomoku-cell[data-col="10"]::before { right: 50%; }

.intersection-dot {
  position: relative;
  z-index: 1;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(75, 55, 34, 0.75);
}

.gomoku-cell.star .intersection-dot {
  width: 5px;
  height: 5px;
}

.gomoku-cell:not(:disabled):hover .intersection-dot {
  width: 12px;
  height: 12px;
  background: rgba(189, 88, 52, 0.25);
  box-shadow: 0 0 0 2px rgba(189, 88, 52, 0.35);
}

.gomoku-cell:disabled {
  cursor: default;
}

.gomoku-stone {
  position: absolute;
  z-index: 3;
  width: 78%;
  height: 78%;
  border-radius: 50%;
  pointer-events: none;
  animation: stone-in 180ms ease both;
}

.gomoku-stone.black,
.mini-stone.black {
  border: 1px solid #17201d;
  background: radial-gradient(circle at 35% 28%, #53615a 0, #25312c 35%, #111916 90%);
  box-shadow: 0 3px 5px rgba(30, 34, 28, 0.35);
}

.gomoku-stone.white,
.mini-stone.white {
  border: 1px solid #c3b9a6;
  background: radial-gradient(circle at 35% 28%, #fffef9 0, #f5f0e5 50%, #d9d1c0 100%);
  box-shadow: 0 3px 5px rgba(30, 34, 28, 0.3);
}

.gomoku-cell.winning .gomoku-stone {
  box-shadow: 0 0 0 3px #e67e4f, 0 0 15px rgba(230, 126, 79, 0.75);
}

.target-marker {
  position: absolute;
  z-index: 4;
  display: grid;
  width: 55%;
  height: 55%;
  place-items: center;
  border: 2px solid var(--orange-dark);
  border-radius: 50%;
  background: rgba(255, 246, 225, 0.85);
  color: #a04b2c;
  font-size: clamp(7px, 1vw, 10px);
  font-weight: 700;
  pointer-events: none;
}

.gomoku-cell.has-stone .target-marker {
  top: -2px;
  right: -2px;
  width: 13px;
  height: 13px;
  border-width: 1px;
  font-size: 7px;
}

.gomoku-board-overlay {
  position: absolute;
  z-index: 8;
  inset: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  background: rgba(29, 42, 36, 0.88);
  color: #f8f2e6;
  text-align: center;
  backdrop-filter: blur(3px);
}

.gomoku-board-overlay .icon {
  width: 32px;
  height: 32px;
  margin-bottom: 14px;
  color: #e0aa84;
}

.gomoku-board-overlay strong {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 400;
}

.gomoku-board-overlay span {
  margin-top: 7px;
  color: #b8c1b9;
  font-size: 10px;
}

.gomoku-board-footer {
  min-height: 49px;
}

.stone-legend {
  display: flex;
  gap: 13px;
}

.stone-legend span,
.player-token {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stone-legend b {
  font-weight: 400;
}

.mini-stone {
  display: inline-block;
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  border-radius: 50%;
}

.gomoku-control-panel {
  padding: 20px;
}

.gomoku-players {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.gomoku-player {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 86px;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid #e3e0d6;
  border-radius: 8px;
  background: #faf8f2;
}

.gomoku-player.is-active {
  border-color: #dca07e;
  background: #fdf0e5;
}

.player-token b {
  overflow: hidden;
  font-size: 9px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gomoku-player > strong {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
}

.gomoku-player > strong small {
  margin-left: 5px;
  color: #999b92;
  font-family: var(--sans);
  font-size: 7px;
  letter-spacing: 0.8px;
}

.starter-badge {
  position: absolute;
  top: -6px;
  right: 6px;
  display: none;
  padding: 3px 5px;
  border-radius: 3px;
  background: var(--orange);
  color: white;
  font-size: 6px;
  font-weight: 700;
  letter-spacing: 0.6px;
}

.gomoku-player.is-starter .starter-badge {
  display: block;
}

.gomoku-phase-card {
  margin-top: 17px;
}

.gomoku-phase-card > p {
  margin: 8px 0 15px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.target-slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 16px 0;
}

.target-slots span {
  display: flex;
  height: 45px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px dashed #d6d5cb;
  border-radius: 6px;
  color: #a2a49c;
  font-size: 9px;
  font-weight: 700;
}

.target-slots span.filled {
  border-style: solid;
  border-color: #dfa986;
  background: #fcf0e5;
  color: #a75432;
}

.target-slots b {
  font-size: 8px;
  font-weight: 500;
}

.gomoku-phase-card .primary-button {
  width: 100%;
  min-height: 42px;
  font-size: 10px;
}

.gomoku-phase-card .primary-button:disabled {
  box-shadow: none;
  opacity: 0.45;
  cursor: not-allowed;
}

.bid-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.bid-heading p {
  margin: 5px 0 0;
  color: #90948b;
  font-size: 8px;
}

.bid-heading > strong {
  display: grid;
  min-width: 36px;
  height: 31px;
  place-items: center;
  border-radius: 5px;
  background: #f0ede5;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 400;
}

.bid-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 15px 0 12px;
}

.bid-list label {
  display: grid;
  height: 42px;
  grid-template-columns: 27px 1fr 65px;
  align-items: center;
  gap: 8px;
  padding: 0 7px;
  border: 1px solid #e2dfd5;
  border-radius: 7px;
  background: #faf8f2;
}

.bid-letter {
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border-radius: 50%;
  background: var(--orange-soft);
  color: var(--orange-dark);
  font-size: 9px;
  font-weight: 700;
}

.bid-coordinate {
  color: #7f847c;
  font-size: 9px;
}

.bid-list input {
  width: 100%;
  height: 29px;
  border: 1px solid #d7d8cf;
  border-radius: 5px;
  background: white;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  text-align: center;
}

.bid-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  color: #8c9088;
  font-size: 9px;
}

.bid-total strong {
  color: var(--ink);
  font-size: 10px;
}

.bid-total.over-limit strong {
  color: #b84e35;
}

.bid-error {
  min-height: 12px;
  margin: 8px 0 -5px !important;
  color: var(--orange-dark) !important;
  font-size: 8px !important;
  text-align: center;
}

.waiting-card {
  display: flex;
  min-height: 210px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.waiting-card strong {
  margin-top: 15px;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 400;
}

.waiting-dots {
  display: flex;
  gap: 6px;
}

.waiting-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--orange);
  animation: waiting-bounce 900ms ease infinite alternate;
}

.waiting-dots i:nth-child(2) { animation-delay: 180ms; }
.waiting-dots i:nth-child(3) { animation-delay: 360ms; }

.gomoku-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 18px;
  border-top: 1px solid #e7e4da;
  padding-top: 12px;
}

.gomoku-actions button {
  display: flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: #7d837a;
  font-size: 9px;
}

.gomoku-actions button:first-child {
  border-right: 1px solid #e4e2d9;
}

.gomoku-actions .icon {
  width: 13px;
  height: 13px;
}

.online-lobby {
  text-align: center;
}

.online-lobby h3 {
  margin: 8px 0 6px;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 400;
}

.online-lobby > p {
  margin-bottom: 17px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.online-lobby .primary-button {
  width: 100%;
  min-height: 41px;
  font-size: 10px;
}

.lobby-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0;
  color: #a1a39b;
  font-size: 7px;
  letter-spacing: 1px;
}

.lobby-divider::before,
.lobby-divider::after {
  height: 1px;
  flex: 1;
  background: #e4e1d7;
  content: "";
}

.join-room-row {
  display: grid;
  grid-template-columns: 1fr 65px;
  gap: 7px;
}

.join-room-row input {
  min-width: 0;
  height: 39px;
  border: 1px solid #dcdad0;
  border-radius: 6px;
  background: #faf9f4;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 3px;
  text-align: center;
  text-transform: uppercase;
}

.join-room-row button {
  border: 1px solid #d4d5cb;
  border-radius: 6px;
  background: #eeeee6;
  font-size: 10px;
  font-weight: 600;
}

.connection-status {
  min-height: 14px;
  margin: 10px 0 0 !important;
  color: var(--orange-dark) !important;
}

.room-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
  padding: 9px 11px;
  border: 1px solid #ddded4;
  border-radius: 7px;
  background: #f1f3eb;
}

.room-banner > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.room-banner span {
  color: #899087;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 1px;
}

.room-banner strong {
  font-size: 14px;
  letter-spacing: 2px;
}

.room-banner button {
  display: flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: var(--green);
  font-size: 9px;
  font-weight: 600;
}

.room-banner .icon {
  width: 13px;
  height: 13px;
}

.gomoku-art {
  grid-template-columns: repeat(3, 29px);
  gap: 10px;
  background-color: #d7b784;
  background-image: linear-gradient(rgba(88, 61, 31, 0.2) 1px, transparent 1px), linear-gradient(90deg, rgba(88, 61, 31, 0.2) 1px, transparent 1px);
  background-size: 29px 29px;
}

.gomoku-art i {
  width: 20px;
  height: 20px;
  border-radius: 50%;
}

.gomoku-art i.black { background: #24312b; box-shadow: 0 2px 4px rgba(0,0,0,.25); }
.gomoku-art i.white { background: #fff9eb; box-shadow: 0 2px 4px rgba(0,0,0,.18); }

.gomoku-instruction-list {
  margin-top: 24px;
}

.exact-five-rule {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 24px;
  padding: 14px 16px;
  border-left: 3px solid var(--orange);
  border-radius: 0 7px 7px 0;
  background: var(--orange-soft);
}

.exact-five-rule strong {
  color: var(--orange-dark);
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 400;
}

.exact-five-rule span {
  color: #8c6d5b;
  font-size: 9px;
  line-height: 1.5;
}

.gomoku-results-modal h2 {
  margin-bottom: 22px;
}

.results-table {
  overflow: hidden;
  border: 1px solid #e2dfd5;
  border-radius: 8px;
}

.results-row {
  display: grid;
  min-height: 49px;
  grid-template-columns: 1.2fr 1fr 1fr 1fr;
  align-items: center;
  border-bottom: 1px solid #e8e5dc;
  font-size: 10px;
  text-align: center;
}

.results-row:last-child {
  border-bottom: 0;
}

.results-row > span:first-child {
  text-align: left;
  padding-left: 15px;
}

.results-header {
  min-height: 34px;
  background: #f3f0e8;
  color: #8a8f86;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.8px;
}

.result-point {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
}

.result-point b {
  color: #969990;
  font-size: 8px;
  font-weight: 500;
}

.result-winner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 8px;
  font-weight: 600;
}

.carry-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0;
  padding: 12px;
  border-radius: 7px;
  background: #f3f1e9;
  color: #747c73;
  font-size: 9px;
  line-height: 1.5;
}

@keyframes stone-in {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes waiting-bounce {
  from { opacity: 0.35; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(-2px); }
}

@media (max-width: 1100px) {
  .gomoku-layout { grid-template-columns: minmax(0, 1fr) 275px; }
  .gomoku-board-stage { padding: 20px; }
  .gomoku-board { width: min(440px, 100%); }
}

@media (max-width: 850px) {
  .gomoku-layout { grid-template-columns: minmax(0, 1fr) 265px; }
  .gomoku-board-stage { min-height: 420px; }
  .gomoku-control-panel { padding: 17px; }
  #gomoku-mode-note { max-width: 210px; text-align: right; }
}

@media (max-width: 640px) {
  .gomoku-modebar { align-items: flex-start; flex-direction: column; gap: 10px; margin-top: 23px; }
  .mode-switch { width: 100%; }
  .mode-switch button { flex: 1; justify-content: center; padding: 0 7px; }
  #gomoku-mode-note { max-width: none; text-align: left; }
  .gomoku-layout { grid-template-columns: 1fr; }
  .gomoku-board-stage { min-height: 0; padding: 20px; }
  .gomoku-board { width: min(430px, 100%); padding: 9px; }
  .gomoku-board-overlay { inset: 20px; }
  .gomoku-control-panel { display: flex; flex-direction: column; padding: 21px; }
  .gomoku-control-panel > * { width: 100%; }
  .gomoku-phase-card { min-height: 0; }
  .gomoku-player { min-height: 80px; }
  .gomoku-rules-strip { grid-template-columns: 1fr; }
  .gomoku-board-footer { padding: 0 15px; }
  .gomoku-board-footer > span:first-child { max-width: 190px; }
}

@media (prefers-reduced-motion: reduce) {
  .gomoku-stone, .waiting-dots i { animation: none; }
}
