:root {
  --ink: #173735;
  --ink-soft: #42605d;
  --muted: #70817e;
  --page: #edf2f0;
  --paper: #fbfdfc;
  --paper-strong: #ffffff;
  --line: #d4dfdc;
  --line-strong: #b9c9c5;
  --teal: #1d776d;
  --teal-dark: #145b54;
  --mint: #d9ebe6;
  --mint-bright: #b9ddd4;
  --coral: #ef6655;
  --coral-soft: #ffe0db;
  --blue: #467fba;
  --blue-soft: #e0ebf8;
  --violet: #7b67ae;
  --violet-soft: #ebe6f7;
  --orange: #d9793d;
  --orange-soft: #f9e6da;
  --shadow: 0 20px 55px rgba(28, 67, 63, 0.11);
  --shadow-small: 0 8px 22px rgba(28, 67, 63, 0.09);
  --radius: 28px;
  color-scheme: light;
  font-family:
    "Microsoft YaHei UI",
    "Microsoft YaHei",
    "PingFang SC",
    "Noto Sans CJK SC",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(235, 242, 239, 0.08)),
    url("./assets/backgrounds/wuwu-background-guofeng-1920.jpg"),
    var(--page);
  background-position: center top;
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(29, 119, 109, 0.34);
  outline-offset: 3px;
}

.page-glow {
  position: fixed;
  z-index: -1;
  width: 32vw;
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.04;
  pointer-events: none;
}

.glow-left {
  top: 34%;
  left: -18vw;
  background: #aed8cf;
}

.glow-right {
  right: -20vw;
  bottom: -8%;
  background: #f3b8ae;
}

.hero {
  display: flex;
  width: min(1480px, calc(100% - 48px));
  margin: 0 auto;
  padding: 28px 0 24px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 72px;
  aspect-ratio: 1;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 24px;
  color: var(--paper);
  background: var(--ink);
  box-shadow: 0 12px 28px rgba(23, 55, 53, 0.24);
  transform: rotate(-3deg);
}

.brand-mark::before,
.brand-mark::after {
  position: absolute;
  content: "";
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
}

.brand-mark::before {
  width: 58px;
  height: 58px;
}

.brand-mark::after {
  width: 36px;
  height: 36px;
}

.brand-mark span {
  position: absolute;
  z-index: 1;
  font-size: 23px;
  font-weight: 900;
}

.brand-mark span:first-child {
  top: 10px;
  left: 12px;
}

.brand-mark span:last-child {
  right: 11px;
  bottom: 9px;
}

.eyebrow,
.panel-kicker,
.mission-kicker {
  margin: 0;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.brand h1 {
  margin: 3px 0 2px;
  font-size: clamp(32px, 4vw, 54px);
  font-weight: 950;
  letter-spacing: -0.055em;
  line-height: 1;
}

.hero-copy {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.ghost-button,
.soft-button,
.mode-button,
.primary-button,
.icon-button {
  border: 0;
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease;
}

.ghost-button,
.soft-button {
  display: inline-flex;
  min-height: 44px;
  padding: 9px 15px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.66);
  box-shadow: 0 5px 14px rgba(28, 67, 63, 0.05);
  font-size: 13px;
  font-weight: 800;
}

.ghost-button:hover,
.soft-button:hover {
  border-color: var(--line-strong);
  background: var(--paper-strong);
  transform: translateY(-1px);
}

.button-icon {
  display: grid;
  width: 26px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 9px;
  color: var(--teal);
  background: var(--mint);
  font-size: 12px;
}

.game-layout {
  display: grid;
  width: min(1480px, calc(100% - 48px));
  margin: 0 auto 42px;
  grid-template-columns: minmax(0, 1fr) 356px;
  align-items: start;
  gap: 22px;
}

.board-panel,
.panel-card {
  border: 1px solid rgba(255, 255, 255, 0.82);
  background: rgba(251, 253, 252, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.board-panel {
  min-width: 0;
  padding: 20px;
  border-radius: var(--radius);
}

.mission-strip {
  display: grid;
  grid-template-columns: auto minmax(240px, 1fr) minmax(170px, 260px) auto;
  align-items: center;
  gap: 18px;
  padding: 2px 4px 18px;
}

.level-stamp {
  display: grid;
  width: 66px;
  aspect-ratio: 1;
  place-items: center;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    linear-gradient(145deg, var(--mint), rgba(255, 255, 255, 0.8));
}

.level-stamp span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.level-stamp strong {
  margin-top: -2px;
  color: var(--teal-dark);
  font-size: 25px;
  line-height: 1;
}

.mission-copy {
  min-width: 0;
}

.mission-copy h2 {
  margin: 3px 0 0;
  font-size: clamp(21px, 2.2vw, 30px);
  letter-spacing: -0.035em;
}

.mission-copy > p:last-child {
  max-width: 650px;
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.55;
}

.dot-separator {
  margin: 0 5px;
  color: var(--line-strong);
}

.score-block {
  min-width: 0;
}

.score-number {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 5px;
}

.score-number > span {
  font-size: 27px;
  font-weight: 950;
  letter-spacing: -0.055em;
}

.score-number small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.score-track {
  height: 8px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe8e5;
}

.score-track > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), #49ad9b);
  transition: width 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.moves-block {
  display: grid;
  min-width: 80px;
  padding-left: 18px;
  border-left: 1px solid var(--line);
  place-items: center;
}

.moves-block span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.moves-block strong {
  color: var(--coral);
  font-size: 30px;
  line-height: 1.1;
}

.mode-row {
  display: flex;
  min-height: 51px;
  margin-bottom: 12px;
  padding: 6px;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f1f5f3;
}

.interaction-strip {
  display: flex;
  min-height: 52px;
  margin-bottom: 12px;
  padding: 9px 12px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f1f5f3;
}

.interaction-strip .mode-hint {
  max-width: 660px;
  margin: 0;
  text-align: left;
}

.interaction-key {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.interaction-key span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 750;
}

.interaction-key b {
  display: grid;
  width: 24px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 8px;
  color: var(--paper);
  background: var(--teal);
  font-size: 11px;
}

.mode-button {
  display: inline-flex;
  min-height: 37px;
  padding: 7px 13px;
  align-items: center;
  gap: 7px;
  border-radius: 12px;
  background: transparent;
  font-size: 13px;
  font-weight: 850;
}

.mode-button:hover {
  background: rgba(255, 255, 255, 0.72);
}

.mode-button.is-active {
  color: var(--paper);
  background: var(--ink);
  box-shadow: 0 5px 14px rgba(23, 55, 53, 0.2);
}

.mode-button > span {
  font-size: 16px;
}

.mode-hint {
  margin: 0 9px 0 auto;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  text-align: right;
}

.board-shell {
  position: relative;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: clamp(8px, 1.2vw, 14px);
  overflow: hidden;
  border: 1px solid #bccdc8;
  border-radius: 24px;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.7), transparent 22%),
    linear-gradient(145deg, #dcebe7, #c9ddd8);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 14px 30px rgba(29, 78, 72, 0.13);
}

.board-shell::before {
  position: absolute;
  inset: 5px;
  border: 1px dashed rgba(23, 55, 53, 0.13);
  border-radius: 20px;
  content: "";
  pointer-events: none;
}

.board {
  position: relative;
  z-index: 1;
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  grid-template-rows: repeat(9, minmax(0, 1fr));
  gap: clamp(2px, 0.43vw, 6px);
}

.tile {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  padding: 3.5%;
  cursor: pointer;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(175, 194, 189, 0.84);
  border-radius: clamp(7px, 13%, 16px);
  background: rgba(255, 255, 255, 0.93);
  box-shadow:
    0 3px 0 rgba(139, 163, 157, 0.45),
    0 4px 9px rgba(32, 83, 77, 0.07);
  transform: translateY(0);
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease,
    background-color 150ms ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

.tile::after {
  position: absolute;
  inset: 5%;
  border: 2px solid transparent;
  border-radius: 12px;
  content: "";
  pointer-events: none;
  transition: border-color 150ms ease;
}

.tile:hover {
  z-index: 2;
  border-color: var(--line-strong);
  box-shadow:
    0 3px 0 rgba(139, 163, 157, 0.45),
    0 8px 18px rgba(32, 83, 77, 0.14);
  transform: translateY(-2px);
}

.tile-empty {
  cursor: default;
  border-style: dashed;
  border-color: rgba(175, 194, 189, 0.48);
  background: rgba(247, 251, 249, 0.26);
  box-shadow: none;
}

.tile-empty:hover {
  border-color: rgba(175, 194, 189, 0.48);
  box-shadow: none;
  transform: none;
}

.tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scale(1.08);
  filter: drop-shadow(0 3px 2px rgba(31, 51, 49, 0.12));
  pointer-events: none;
}

.tile-name {
  position: absolute;
  z-index: 2;
  right: 4px;
  bottom: 3px;
  left: 4px;
  padding: 2px 3px;
  overflow: hidden;
  border-radius: 6px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.83);
  font-size: clamp(7px, 0.68vw, 11px);
  font-weight: 850;
  line-height: 1.25;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  backdrop-filter: blur(4px);
  pointer-events: none;
}

.tile[hidden] .tile-name {
  display: none;
}

.tile.is-selected {
  z-index: 3;
  border-color: var(--coral);
  background: #fff5f3;
  box-shadow:
    0 3px 0 #d75243,
    0 0 0 3px rgba(239, 102, 85, 0.2),
    0 10px 20px rgba(153, 66, 55, 0.14);
  transform: translateY(-3px) scale(1.025);
}

.tile.is-selected::after {
  border-color: rgba(239, 102, 85, 0.75);
}

.tile.is-swap-first {
  z-index: 3;
  border-color: var(--teal);
  box-shadow:
    0 3px 0 var(--teal-dark),
    0 0 0 3px rgba(29, 119, 109, 0.18);
  animation: lift 700ms ease-in-out infinite alternate;
}

.tile.is-dragging {
  z-index: 4;
  opacity: 0.34;
  transform: scale(0.94);
}

.tile.is-drop-target {
  z-index: 3;
  border-color: var(--teal);
  background: #e5f4ef;
  box-shadow:
    0 3px 0 var(--teal-dark),
    0 0 0 3px rgba(29, 119, 109, 0.2);
  transform: translateY(-2px);
}

.tile.is-hint {
  z-index: 3;
  border-color: var(--blue);
  animation: hintPulse 900ms ease-in-out infinite alternate;
}

.tile.is-hint::before {
  position: absolute;
  z-index: 4;
  top: 3px;
  left: 3px;
  display: grid;
  width: clamp(15px, 1.6vw, 23px);
  aspect-ratio: 1;
  place-items: center;
  border: 2px solid #ffffff;
  border-radius: 50%;
  color: #ffffff;
  background: var(--blue);
  box-shadow: 0 2px 5px rgba(34, 74, 114, 0.28);
  content: attr(data-hint-order);
  font-size: clamp(8px, 0.85vw, 12px);
  font-weight: 950;
  line-height: 1;
}

.tile.is-clearing {
  pointer-events: none;
  animation: clearTile 360ms cubic-bezier(0.55, 0.06, 0.68, 0.19) forwards;
}

.tile-fallback {
  display: grid;
  width: 70%;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  color: var(--paper);
  background: var(--teal);
  font-size: clamp(18px, 2.6vw, 34px);
  font-weight: 900;
}

.drag-ghost {
  position: absolute;
  z-index: 30;
  display: grid;
  width: clamp(44px, 8vw, 86px);
  aspect-ratio: 1;
  place-items: center;
  padding: 7px;
  border: 2px solid rgba(23, 55, 53, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 36px rgba(23, 55, 53, 0.24);
  pointer-events: none;
  transform: translate(-50%, -56%) rotate(-3deg);
}

.drag-ghost img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.board-actions {
  display: flex;
  margin-top: 12px;
  justify-content: center;
  gap: 8px;
}

.board-actions .soft-button {
  min-width: 112px;
  background: rgba(255, 255, 255, 0.7);
}

.side-panel {
  display: grid;
  gap: 14px;
}

.panel-card {
  padding: 20px;
  border-radius: 24px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel-card h2 {
  margin: 4px 0 0;
  font-size: 19px;
  letter-spacing: -0.025em;
}

.item-card {
  overflow: hidden;
}

.item-detail-layout {
  display: grid;
  margin-top: 15px;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: stretch;
  gap: 13px;
}

.item-detail-image {
  display: grid;
  min-height: 112px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 35%, #ffffff, #e2eeea);
}

.item-detail-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.item-detail-image > span {
  color: var(--line-strong);
  font-size: 38px;
  font-weight: 900;
}

.item-facts {
  display: grid;
  margin: 0;
  gap: 6px;
}

.item-facts div {
  display: grid;
  min-width: 0;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: baseline;
  gap: 8px;
}

.item-facts dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
}

.item-facts dd {
  min-width: 0;
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
}

.item-fact {
  margin: 13px 0 0;
  padding: 10px 11px;
  border-radius: 12px;
  color: var(--ink-soft);
  background: #f0f4f3;
  font-size: 11px;
  line-height: 1.65;
}

.item-tags {
  display: flex;
  margin-top: 10px;
  flex-wrap: wrap;
  gap: 5px;
}

.count-pill {
  flex: 0 0 auto;
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--teal-dark);
  background: var(--mint);
  font-size: 12px;
  font-weight: 900;
}

.selection-list {
  display: flex;
  min-height: 44px;
  margin: 16px 0 9px;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px;
}

.selection-empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.selection-chip {
  padding: 6px 9px;
  cursor: pointer;
  border: 1px solid #f1b3a9;
  border-radius: 10px;
  color: #983f34;
  background: var(--coral-soft);
  font-size: 12px;
  font-weight: 800;
}

.selection-chip::after {
  margin-left: 5px;
  content: "×";
  opacity: 0.65;
}

.selection-chip:hover {
  border-color: var(--coral);
}

.selection-status {
  min-height: 40px;
  margin: 0;
  padding: 9px 11px;
  border-radius: 12px;
  color: var(--ink-soft);
  background: #f0f4f3;
  font-size: 12px;
  line-height: 1.55;
}

.tag-choices {
  display: grid;
  margin-top: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

  .quiz-prompt {
    display: flex;
    margin: 0 0 3px;
    padding: 9px 11px;
    grid-column: 1 / -1;
    flex-direction: column;
    gap: 2px;
    border: 1px dashed rgba(29, 119, 109, 0.26);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.52);
  }

  .quiz-prompt strong {
    color: var(--teal-dark);
    font-size: 13px;
  }

  .quiz-prompt span {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
  }

.tag-choice {
  display: flex;
  min-height: 48px;
  padding: 9px 11px;
  cursor: pointer;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 13px;
  font-weight: 900;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease;
}

.tag-choice:hover {
  box-shadow: var(--shadow-small);
  transform: translateY(-2px);
}

.tag-choice small {
  font-size: 10px;
  font-weight: 800;
  opacity: 0.64;
}

.category-material {
  color: #175c55;
  background: var(--mint);
}

.category-shape {
  color: #8e4b24;
  background: var(--orange-soft);
}

.category-craft {
  color: #5f4c91;
  background: var(--violet-soft);
}

.category-use {
  color: #315f91;
  background: var(--blue-soft);
}

.insight-card {
  position: relative;
  display: grid;
  overflow: hidden;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 13px;
  color: var(--paper);
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 255, 255, 0.13), transparent 36%),
    var(--ink);
}

.insight-card::after {
  position: absolute;
  right: -46px;
  bottom: -68px;
  width: 150px;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  content: "";
}

.insight-mark {
  display: grid;
  width: 42px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  color: var(--ink);
  background: var(--mint-bright);
  font-size: 19px;
  font-weight: 950;
}

.insight-card .panel-kicker {
  color: #8fd2c6;
}

.insight-card h2 {
  font-size: 17px;
}

.insight-card p:not(.panel-kicker) {
  margin: 7px 0 0;
  color: #c9d9d6;
  font-size: 12px;
  line-height: 1.65;
}

.discovery-count {
  display: flex;
  grid-column: 1 / -1;
  margin-top: 2px;
  padding-top: 12px;
  align-items: baseline;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, 0.13);
}

.discovery-count span {
  color: #a9c0bc;
  font-size: 11px;
}

.discovery-count strong {
  font-size: 27px;
}

.discovery-count strong b {
  font-weight: 950;
}

.rule-steps {
  display: grid;
  margin: 14px 0 0;
  padding: 0;
  gap: 8px;
  list-style: none;
}

.rule-steps li {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.rule-steps li span {
  display: grid;
  width: 22px;
  aspect-ratio: 1;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 7px;
  color: var(--teal-dark);
  background: var(--mint);
  font-size: 11px;
  font-weight: 900;
}

.rule-note {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.score-pop {
  position: absolute;
  z-index: 20;
  color: var(--coral);
  font-size: clamp(18px, 2.2vw, 30px);
  font-weight: 950;
  text-shadow: 0 2px 0 #ffffff;
  pointer-events: none;
  animation: scoreFloat 850ms ease-out forwards;
}

.toast {
  position: fixed;
  z-index: 80;
  right: 24px;
  bottom: 24px;
  max-width: min(420px, calc(100% - 48px));
  padding: 13px 17px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 15px;
  color: var(--paper);
  background: rgba(23, 55, 53, 0.93);
  box-shadow: 0 14px 36px rgba(23, 55, 53, 0.25);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

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

.game-dialog {
  max-width: min(1060px, calc(100% - 30px));
  max-height: min(88vh, 900px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 28px;
  background: var(--paper);
  box-shadow: 0 34px 100px rgba(20, 52, 49, 0.33);
}

.game-dialog::backdrop {
  background: rgba(14, 36, 34, 0.55);
  backdrop-filter: blur(6px);
}

.dialog-shell {
  display: grid;
  max-height: min(88vh, 900px);
  padding: 25px;
  overflow: auto;
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.dialog-header h2 {
  margin: 5px 0 0;
  font-size: clamp(24px, 4vw, 36px);
  letter-spacing: -0.04em;
}

.dialog-header p:last-child {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.icon-button {
  display: grid;
  width: 42px;
  aspect-ratio: 1;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 14px;
  color: var(--ink);
  background: #eaf0ee;
  font-size: 24px;
}

.icon-button:hover {
  background: #dfe8e5;
}

.search-field {
  display: block;
  margin: 20px 0 18px;
}

.search-field input {
  width: 100%;
  min-height: 48px;
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  color: var(--ink);
  background: #f5f8f7;
  font-size: 14px;
}

.search-field input::placeholder {
  color: #8a9b98;
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.collection-card {
  display: grid;
  min-width: 0;
  grid-template-columns: 105px minmax(0, 1fr);
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
}

.collection-image {
  display: grid;
  padding: 8px;
  place-items: center;
  background:
    radial-gradient(circle at 50% 35%, #f6faf8, #e5efec);
}

.collection-image img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
}

.collection-copy {
  min-width: 0;
  padding: 12px 12px 11px;
}

.collection-copy h3 {
  margin: 0;
  font-size: 17px;
}

.collection-copy p {
  margin: 5px 0 9px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.collection-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.gallery-tag {
  padding: 3px 6px;
  border-radius: 7px;
  font-size: 9px;
  font-weight: 850;
}

.collection-empty {
  grid-column: 1 / -1;
  margin: 16px 0;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 17px;
}

.item-table {
  width: 100%;
  min-width: 1050px;
  border-collapse: collapse;
  background: #ffffff;
  font-size: 12px;
  line-height: 1.6;
}

.item-table th,
.item-table td {
  padding: 10px 11px;
  border-right: 1px solid #e6ecea;
  border-bottom: 1px solid #e6ecea;
  text-align: left;
  vertical-align: top;
}

.item-table th:last-child,
.item-table td:last-child {
  border-right: 0;
}

.item-table tr:last-child td {
  border-bottom: 0;
}

.item-table thead th {
  position: sticky;
  z-index: 2;
  top: 0;
  color: var(--paper);
  background: var(--ink);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.06em;
}

.item-table tbody tr:nth-child(even) {
  background: #f6f9f8;
}

.item-table tbody tr:hover {
  background: #eaf3f0;
}

.table-item-cell {
  display: flex;
  min-width: 125px;
  align-items: center;
  gap: 8px;
}

.table-thumb {
  display: grid;
  width: 38px;
  aspect-ratio: 1;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border-radius: 10px;
  background: #edf4f1;
}

.table-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.table-thumb .tile-fallback {
  width: 100%;
  font-size: 15px;
}

.result-dialog {
  max-width: min(540px, calc(100% - 30px));
}

.result-shell {
  padding: 34px;
  text-align: center;
}

.result-shell h2 {
  margin: 8px 0 0;
  font-size: clamp(27px, 5vw, 40px);
  letter-spacing: -0.045em;
}

.result-shell > p:not(.panel-kicker) {
  margin: 13px auto 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.8;
}

.result-actions {
  display: flex;
  margin-top: 24px;
  justify-content: center;
  gap: 9px;
}

.primary-button {
  min-height: 46px;
  padding: 10px 18px;
  border-radius: 14px;
  color: var(--paper);
  background: var(--ink);
  box-shadow: 0 8px 18px rgba(23, 55, 53, 0.2);
  font-weight: 850;
}

.primary-button:hover {
  background: var(--teal-dark);
  transform: translateY(-1px);
}

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

@keyframes lift {
  to {
    transform: translateY(-3px);
  }
}

@keyframes hintPulse {
  from {
    box-shadow:
      0 3px 0 #4f7da6,
      0 0 0 2px rgba(70, 127, 186, 0.16);
  }
  to {
    box-shadow:
      0 3px 0 #4f7da6,
      0 0 0 6px rgba(70, 127, 186, 0.1),
      0 8px 20px rgba(55, 108, 159, 0.22);
    transform: translateY(-2px);
  }
}

@keyframes clearTile {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  45% {
    transform: scale(1.12) rotate(2deg);
  }
  100% {
    opacity: 0;
    transform: scale(0.3) rotate(-8deg);
  }
}

@keyframes scoreFloat {
  0% {
    opacity: 0;
    transform: translate(-50%, 8px) scale(0.75);
  }
  25% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -58px) scale(1.18);
  }
}

@media (max-width: 1180px) {
  .hero,
  .game-layout {
    width: min(100% - 30px, 1100px);
  }

  .game-layout {
    grid-template-columns: minmax(0, 1fr) 324px;
  }

  .mission-strip {
    grid-template-columns: auto minmax(220px, 1fr) minmax(140px, 210px) auto;
    gap: 12px;
  }

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

@media (max-width: 920px) {
  .hero {
    align-items: flex-start;
  }

  .hero-actions {
    max-width: 220px;
  }

  .game-layout {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .board-shell {
    max-width: 780px;
  }
}

@media (max-width: 660px) {
  .hero,
  .game-layout {
    width: min(100% - 20px, 640px);
  }

  .hero {
    display: grid;
    padding-top: 15px;
    gap: 16px;
  }

  body {
    background-attachment: scroll;
  }

  .brand {
    gap: 13px;
  }

  .brand-mark {
    width: 58px;
    border-radius: 19px;
  }

  .brand-mark span {
    font-size: 19px;
  }

  .brand-mark span:first-child {
    top: 7px;
    left: 9px;
  }

  .brand-mark span:last-child {
    right: 8px;
    bottom: 6px;
  }

  .brand h1 {
    font-size: 36px;
  }

  .hero-copy {
    font-size: 12px;
  }

  .hero-actions {
    width: 100%;
    max-width: none;
    justify-content: flex-start;
  }

  .ghost-button {
    flex: 1;
  }

  .board-panel {
    padding: 12px;
    border-radius: 22px;
  }

  .mission-strip {
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding-bottom: 12px;
    gap: 9px;
  }

  .level-stamp {
    width: 52px;
    border-radius: 15px;
  }

  .level-stamp strong {
    font-size: 20px;
  }

  .mission-copy h2 {
    margin-top: 1px;
    font-size: 19px;
  }

  .mission-copy > p:last-child {
    display: none;
  }

  .mission-kicker {
    font-size: 10px;
  }

  .score-block {
    grid-column: 2 / 3;
    display: grid;
    grid-template-columns: auto minmax(70px, 1fr);
    align-items: center;
    gap: 7px;
  }

  .score-number {
    justify-content: flex-start;
  }

  .score-number > span {
    font-size: 20px;
  }

  .score-track {
    margin-top: 0;
  }

  .moves-block {
    grid-row: 1 / 3;
    grid-column: 3;
    min-width: 50px;
    padding-left: 8px;
  }

  .moves-block strong {
    font-size: 24px;
  }

  .mode-row {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .interaction-strip {
    display: grid;
    padding: 9px;
    gap: 8px;
  }

  .interaction-key {
    justify-content: flex-start;
  }

  .mode-button {
    flex: 1;
    justify-content: center;
  }

  .mode-hint {
    width: 100%;
    margin: 2px 4px 3px;
    text-align: left;
  }

  .board-shell {
    padding: 5px;
    border-radius: 17px;
  }

  .board {
    gap: 2px;
  }

  .tile {
    padding: 1px;
    border-radius: 7px;
    box-shadow:
      0 2px 0 rgba(139, 163, 157, 0.4),
      0 2px 5px rgba(32, 83, 77, 0.06);
  }

  .tile-name {
    display: none;
  }

  #labelsButton {
    display: none;
  }

  .board-actions {
    gap: 5px;
  }

  .board-actions .soft-button {
    min-width: 0;
    min-height: 39px;
    padding: 7px 8px;
    flex: 1;
    font-size: 11px;
  }

  .side-panel {
    grid-template-columns: minmax(0, 1fr);
  }

  .selection-card {
    grid-column: auto;
  }

  .item-detail-layout {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .item-detail-image {
    min-height: 92px;
  }

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

  .dialog-shell {
    padding: 18px;
  }

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

  .table-wrap {
    margin-right: -8px;
    margin-left: -8px;
  }

  .item-table {
    min-width: 920px;
  }

  .collection-card {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .result-shell {
    padding: 26px 20px;
  }

  .result-actions {
    flex-direction: column;
  }
}

@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;
  }
}
