/* Shared appearance and mobile-first play surface. Board skins remain independent. */
:root {
  --bg: #f7f3e8;
  --paper: #fffdf6;
  --surface: #eee7d6;
  --ink: #293e35;
  --muted: #646b58;
  --line: #dcdcc9;
  --accent: #a85b19;
  --accent-dark: #824312;
  --sage: #41745a;
  --shadow: 0 8px 24px #293e350a;
  --scene: #dfead2;
  --tile-base: #fffdf6;
}
:root[data-appearance="dark"] {
  color-scheme: dark;
  --bg: #182522;
  --paper: #22352e;
  --surface: #30453a;
  --ink: #f5efd9;
  --muted: #bcc9b5;
  --line: #4a6051;
  --accent: #b66624;
  --accent-dark: #efbc75;
  --sage: #a5cf96;
  --board: #3c5142;
  --cell: #283c32;
  --scene: #314b3c;
  --tile-base: #263b33;
  --shadow: 0 8px 24px #0002;
}
:root[data-appearance="dark"][data-theme="forest"] {
  --board: #365440;
  --cell: #263e2e;
}
:root[data-appearance="dark"][data-theme="berry"] {
  --board: #68474e;
  --cell: #422f37;
}
:root[data-appearance="dark"][data-theme="golden"] {
  --board: #6c5730;
  --cell: #423923;
}
:root[data-appearance="dark"][data-theme="moonlight"] {
  --board: #474e70;
  --cell: #30364e;
}
body {
  background:
    radial-gradient(ellipse at top right, var(--scene), transparent 65%) fixed,
    var(--bg);
}
button {
  touch-action: manipulation;
}
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline-color: var(--accent-dark);
}
.sidebar,
.mobile-nav {
  background: var(--paper);
  border-color: var(--line);
}
.sidebar-note {
  opacity: 0.8;
}
.nav-item.active,
.mobile-nav .nav-item.active {
  background: var(--scene);
  color: var(--ink);
}
.welcome-banner {
  background: var(--scene);
  border-color: var(--line);
  min-height: 178px;
  padding: 22px 30px;
  margin-bottom: 24px;
}
.welcome-banner h1 {
  color: var(--ink);
  font-size: 36px;
}
.welcome-banner p {
  color: var(--muted);
}
.hero-art {
  height: 195px;
}
.hero-art > img {
  width: 185px;
  height: 185px;
}
.hero-circle {
  background: var(--surface);
  width: 165px;
  height: 165px;
  top: 20px;
}
.hero-tag {
  background: var(--paper);
  color: var(--ink);
}
.meadow-goal {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.meadow-goal img {
  width: 48px;
  height: 48px;
}
.meadow-goal > div {
  flex: 1;
  min-width: 0;
}
.meadow-goal strong,
.meadow-goal span {
  display: block;
}
.meadow-goal strong {
  font-size: 14px;
}
.meadow-goal span:not(.eyebrow) {
  font-size: 12px;
  color: var(--muted);
}
.meadow-goal b {
  color: var(--sage);
  font-size: 13px;
}
.board-wrapper {
  border: 2px solid var(--line);
  border-radius: 23px;
  box-shadow:
    inset 0 2px 0 #fff3,
    0 6px 0 var(--surface),
    0 16px 28px #172a2515;
}
.cell {
  border-color: var(--line);
  box-shadow: inset 0 2px 3px #0001;
  border-radius: 14px;
}
.cell.occupied {
  background: color-mix(in srgb, var(--tile-color) 28%, var(--tile-base));
  border-color: var(--line);
  box-shadow: 0 3px 0 #0002;
}
.cell.selected {
  outline: 3px solid var(--accent-dark);
  background: color-mix(in srgb, var(--accent) 35%, var(--tile-base));
}
.cell.match {
  outline: 2px dashed var(--sage);
  outline-offset: -3px;
}
.tile-level {
  color: #49382b;
  background: #fff2c9;
  font-size: 10px;
}
.empty-dot {
  background: var(--line);
}
.create-button {
  background: linear-gradient(135deg, #b56821, #985019);
  box-shadow:
    0 4px 0 #6d3914,
    0 8px 20px #a85b1920;
  border-radius: 16px;
  min-height: 64px;
}
.create-button small {
  font-size: 11px;
  color: #fff0d3;
}
.board-hint {
  font-size: 12px;
  line-height: 1.45;
}
.energy-footer,
.energy-footer button {
  font-size: 11px;
}
.button,
.icon-button,
.avatar,
.balance,
.request-send,
.request-refresh,
.reward-claim,
.theme-swatch,
.text-link,
.inline-link {
  min-height: 44px;
}
.icon-button,
.avatar,
.request-send,
.request-refresh,
.reward-claim {
  min-width: 44px;
}
.board-hint .icon-button {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}
.request {
  padding-right: 48px;
  min-height: 106px;
}
.request-send {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}
.request-refresh {
  right: 0;
  bottom: 30px;
  width: 44px;
  height: 44px;
}
.request-send.ready {
  background: var(--scene);
  color: var(--sage);
}
.request-description strong,
.request-description > span {
  font-size: 12px;
}
.daily-gift p,
.daily-gift .button {
  font-size: 12px;
}
.appearance-picker {
  border: 0;
  padding: 0;
  margin: 22px 0;
  text-align: left;
}
.appearance-picker legend {
  font-weight: 700;
  margin-bottom: 8px;
}
.appearance-picker > div {
  display: flex;
  gap: 6px;
  padding: 5px;
  background: var(--surface);
  border-radius: 14px;
}
.appearance-picker button {
  flex: 1;
  min-height: 44px;
  border-radius: 10px;
}
.appearance-picker button[aria-pressed="true"] {
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
  outline: 2px solid var(--sage);
}
.appearance-picker p {
  margin-top: 8px;
  font-size: 12px;
}
.collection-card,
.product-card {
  box-shadow: var(--shadow);
}
[data-appearance="dark"] .collection-art {
  background: radial-gradient(ellipse, var(--surface), transparent 70%);
}
[data-appearance="dark"] .reward-cell,
[data-appearance="dark"] .locked-badge {
  background: var(--surface);
}
[data-appearance="dark"] .balance,
[data-appearance="dark"] .balance.energy {
  background: var(--surface);
  border-color: var(--line);
}
[data-appearance="dark"] .tile-level {
  color: #49382b;
}
@media (max-width: 640px) {
  .main-wrap {
    padding: 0 max(14px, env(safe-area-inset-left)) 0
      max(14px, env(safe-area-inset-right));
  }
  .topbar {
    height: auto;
    min-height: 64px;
    padding-top: env(safe-area-inset-top, 0px);
  }
  .mobile-brand {
    font-size: 16px;
    gap: 0;
  }
  .mobile-brand img {
    width: 29px;
  }
  .balance {
    padding: 6px 8px;
    font-size: 12px;
  }
  .balance span {
    display: none;
  }
  .avatar {
    width: 44px;
    height: 44px;
  }
  main {
    margin-top: 12px;
  }
  .welcome-banner {
    min-height: 92px;
    padding: 12px 16px;
    margin-bottom: 14px;
    border-radius: 18px;
  }
  .welcome-banner h1 {
    font-size: 24px;
    margin: 3px 0;
  }
  .welcome-banner h1 br {
    display: none;
  }
  .welcome-banner .eyebrow {
    font-size: 8px;
    letter-spacing: 1px;
  }
  .welcome-banner p,
  .welcome-banner .text-link,
  .hero-tag,
  .hero-flower {
    display: none;
  }
  .welcome-banner > div:first-child {
    max-width: calc(100% - 70px);
  }
  .hero-art {
    width: 92px;
    height: 92px;
    right: 0;
  }
  .hero-art > img {
    width: 90px;
    height: 90px;
  }
  .hero-circle {
    width: 70px;
    height: 70px;
    right: 10px;
    top: 15px;
  }
  .section-heading {
    margin-bottom: 8px;
  }
  .section-heading h2 {
    font-size: 23px;
    margin: 0;
  }
  .meadow-panel > .section-heading .eyebrow {
    display: none;
  }
  .meadow-goal {
    padding: 7px 10px;
    gap: 8px;
    margin-bottom: 10px;
  }
  .meadow-goal img {
    width: 38px;
    height: 38px;
  }
  .meadow-goal .eyebrow {
    font-size: 8px;
  }
  .meadow-goal strong {
    font-size: 13px;
  }
  .meadow-goal span:not(.eyebrow) {
    font-size: 11px;
  }
  .board-wrapper {
    padding: 9px;
  }
  .board {
    gap: 6px;
  }
  .cell {
    border-radius: 11px;
  }
  .board-hint {
    min-height: 42px;
    font-size: 11px;
    padding: 7px 0;
  }
  .create-button {
    padding: 10px 16px;
    min-height: 58px;
  }
  .create-button small {
    font-size: 10px;
  }
  .energy-footer {
    margin-top: 9px;
    flex-wrap: wrap;
  }
  .energy-footer button {
    min-height: 44px;
  }
  .meadow-side {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .requests {
    grid-row: auto;
    padding: 18px;
  }
  .requests > .small {
    font-size: 12px;
  }
  .request {
    flex-wrap: nowrap;
    padding: 12px 48px 12px 0;
    min-height: 88px;
    gap: 10px;
  }
  .request-art {
    width: 42px;
    height: 42px;
  }
  .request-send {
    position: static;
  }
  .request-refresh {
    left: auto;
    right: 0;
    bottom: 22px;
  }
  .request-description > span {
    font-size: 11px;
  }
  .daily-gift {
    display: grid;
    grid-template-columns: 40px 1fr;
    padding: 18px;
  }
  .daily-gift .eyebrow,
  .requests .eyebrow,
  .season-teaser small {
    font-size: 9px;
  }
  .daily-gift .button {
    grid-column: 1 / -1;
  }
  .season-teaser {
    grid-column: auto;
    padding: 18px;
  }
  .season-teaser > span > span {
    font-size: 12px;
  }
  .mobile-nav {
    padding-bottom: calc(7px + env(safe-area-inset-bottom, 0px));
    backdrop-filter: none;
  }
  .mobile-nav .nav-item {
    font-size: 10px;
    min-height: 52px;
    max-width: 90px;
  }
  .collection-card p,
  .collection-bottom,
  .task-content p,
  .task-content small,
  .achievement p,
  .product-card p,
  .product-card > .button,
  .reward-cell,
  .season-hero p {
    font-size: 12px;
  }
  .task-card .button,
  .achievement .button {
    font-size: 11px;
  }
  .reward-row {
    grid-template-columns: 42px 1fr 1fr;
  }
  .reward-cell > span:nth-child(2) {
    max-width: 100%;
  }
  .reward-cell {
    overflow-wrap: anywhere;
  }
  .modal-backdrop {
    padding: max(12px, env(safe-area-inset-top)) 12px
      max(12px, env(safe-area-inset-bottom));
  }
  .modal {
    padding: 30px 20px;
  }
  .page-footer {
    padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
    font-size: 10px;
  }
  #toast {
    bottom: calc(85px + env(safe-area-inset-bottom, 0px));
  }
}
@media (max-width: 359px) {
  .mobile-brand b {
    display: none;
  }
  .meadow-goal strong {
    font-size: 12px;
  }
  .board {
    gap: 4px;
  }
}
