/* === Games Styles === */

/* Game Menu */
.game-menu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  align-items: stretch;
}

.game-menu-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-lg);
  gap: var(--space-sm);
  height: 100%;
}

.game-card-icon {
  font-size: 48px;
  line-height: 1;
  margin-bottom: var(--space-xs);
}

.game-card-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.game-card-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.game-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.game-card-highscore {
  font-size: 12px;
  color: var(--accent);
}

.game-card-save {
  font-size: 12px;
  font-weight: 600;
  color: var(--success);
}

.game-card-version {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}

/* Game Back Bar */
.game-back-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  gap: var(--space-sm);
}

.game-back-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Section label */
.settings-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* Game Area */
.game-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.game-exit-text {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-md);
}

.game-exit-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.game-exit-actions .btn {
  flex: 1 1 132px;
}

/* ===== 2048 ===== */
.game-2048 {
  width: 100%;
  max-width: 440px;
  position: relative;
  user-select: none;
  touch-action: none;
}

.game-2048-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.game-2048-title {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-primary);
}

.game-2048-score {
  background: var(--accent-subtle);
  padding: 8px 16px;
  border-radius: var(--btn-radius);
  text-align: center;
}

.score-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.score-value {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.game-2048-grid {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: var(--game-bg);
  border-radius: var(--card-radius);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 8px;
  padding: 8px;
}

.grid-cell {
  background: var(--game-cell);
  border-radius: 6px;
}

.tile-container {
  position: absolute;
  inset: 8px;
}

.tile {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  border-radius: 6px;
  /* No theme transition for tiles (instant for game feel) */
  transition: left 100ms ease, top 100ms ease !important;
}

/* Game Over Overlay */
.game-over-overlay {
  position: absolute;
  inset: 0;
  background: rgba(238, 228, 218, 0.73);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--card-radius);
  z-index: 20;
}

.game-over-overlay.hidden {
  display: none;
}

.game-over-box {
  text-align: center;
  padding: var(--space-xl);
}

.game-over-title {
  font-size: 32px;
  font-weight: 800;
  color: #776e65;
  margin-bottom: var(--space-md);
}

.game-over-score {
  font-size: 18px;
  color: #776e65;
  margin-bottom: var(--space-lg);
}

/* ===== NookTea ===== */
.game-nooktea {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.nooktea-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
}

.nooktea-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.nooktea-subtitle {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 13px;
}

.nooktea-coins {
  min-width: 92px;
  padding: 8px 14px;
  border-radius: var(--btn-radius);
  background: var(--accent-subtle);
  text-align: center;
}

.nooktea-coins-value {
  display: block;
  font-size: 22px;
  color: var(--text-primary);
  line-height: 1.2;
}

.nooktea-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-sm);
}

.nooktea-stat {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--btn-radius);
  background: var(--bg-secondary);
}

.nooktea-stat-value {
  display: block;
  margin-top: 2px;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 700;
}

.nooktea-resource-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.nooktea-sub-label {
  margin-top: var(--space-md);
}

.nooktea-resource-pill {
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 13px;
}

.nooktea-resource-pill-premium {
  background: var(--accent-subtle);
  color: var(--accent);
}

.nooktea-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 8px;
  border-radius: var(--card-radius);
  background: var(--game-bg);
}

.nooktea-grid-cell {
  aspect-ratio: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 126px;
  padding: 7px;
  border-radius: 6px;
  background: var(--game-cell);
  color: var(--game-text);
  font-size: 14px;
  font-weight: 600;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
  text-align: center;
}

.nooktea-cell-label {
  line-height: 1.3;
}

.nooktea-cell-detail {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
}

.nooktea-cell-decor {
  min-height: 14px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}

.nooktea-cell-decor:empty {
  display: none;
  min-height: 0;
}

.nooktea-cell-time {
  min-height: 16px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
}

.nooktea-cell-label,
.nooktea-cell-detail,
.nooktea-cell-decor,
.nooktea-cell-time {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nooktea-progress {
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.36);
}

.nooktea-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 200ms ease;
}

.nooktea-cell-action {
  width: 100%;
  min-width: 0;
  min-height: 26px;
  padding: 3px 6px;
  font-size: 12px;
}

.nooktea-cell-action:disabled {
  cursor: default;
  opacity: 0.62;
}

.nooktea-grid-cell:has([data-action="remove-decor"]) {
  min-height: 156px;
}

.nooktea-panel {
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--btn-radius);
  background: var(--bg-secondary);
}

.nooktea-facility-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-sm);
}

.nooktea-facility-slot {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm);
  border: 1px dashed var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  text-align: center;
}

.nooktea-mix-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.nooktea-mix-label {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
}

.nooktea-choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.nooktea-choice {
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 13px;
  transition: border-color var(--transition-hover),
              background-color var(--transition-hover),
              color var(--transition-hover),
              transform 120ms ease,
              box-shadow var(--transition-hover);
}

.nooktea-choice.selected {
  border-color: var(--accent);
  background: var(--accent-subtle);
  color: var(--accent);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
}

.nooktea-choice:not(:disabled):hover {
  transform: translateY(-1px);
}

.nooktea-mix-preview {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-sm);
  border-radius: 6px;
  background: var(--bg-tertiary);
}

.nooktea-mix-name {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
}

.nooktea-mix-status {
  color: var(--text-secondary);
  font-size: 12px;
}

.nooktea-mix-hint {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.35;
}

.nooktea-decor-inventory {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-sm);
}

.nooktea-inventory-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  min-height: 40px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 13px;
  transition: border-color var(--transition-hover),
              background-color var(--transition-hover),
              color var(--transition-hover),
              transform 120ms ease,
              box-shadow var(--transition-hover);
}

.nooktea-inventory-item.selected {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.nooktea-inventory-item:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.nooktea-inventory-item:disabled {
  color: var(--text-muted);
  cursor: default;
  opacity: 0.6;
}

.nooktea-inventory-name,
.nooktea-inventory-count {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nooktea-inventory-count {
  flex: 0 0 auto;
  color: var(--text-secondary);
}

.nooktea-log-text {
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--text-secondary);
  line-height: 1.6;
}

.nooktea-level-panel,
.nooktea-story-book {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.nooktea-level-row,
.nooktea-level-condition,
.nooktea-story-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.nooktea-level-title {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
}

.nooktea-level-meta,
.nooktea-level-reward,
.nooktea-level-condition {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.35;
}

.nooktea-level-condition strong {
  color: var(--text-primary);
  font-size: 12px;
}

.nooktea-level-progress {
  height: 8px;
}

.nooktea-panel.nooktea-growth-panel {
  width: fit-content;
  max-width: 100%;
  min-height: 32px;
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--bg-secondary);
}

.nooktea-growth-panel .settings-label {
  display: inline;
  flex: 0 0 auto;
  margin-bottom: 0;
  font-size: 10px;
  line-height: 1;
}

.nooktea-growth-panel .nooktea-level-panel {
  min-width: 0;
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px;
}

.nooktea-growth-panel .nooktea-level-row,
.nooktea-growth-panel .nooktea-level-condition {
  min-width: 0;
  justify-content: flex-start;
  gap: 5px;
}

.nooktea-growth-panel .nooktea-level-title,
.nooktea-growth-panel .nooktea-level-meta,
.nooktea-growth-panel .nooktea-level-condition,
.nooktea-growth-panel .nooktea-level-condition strong {
  overflow: hidden;
  font-size: 12px;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nooktea-growth-panel .nooktea-level-progress {
  width: 44px;
  height: 4px;
  flex: 0 0 44px;
}

.nooktea-growth-panel .nooktea-level-reward {
  display: none;
}

.nooktea-growth-panel .btn {
  min-height: 28px;
  padding: 3px 10px;
  border-radius: 999px;
}

.nooktea-recipe-list,
.nooktea-customer-list,
.nooktea-calendar,
.nooktea-calendar-book,
.nooktea-combo-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.nooktea-recipe-badge {
  border-radius: 6px;
}

.nooktea-recipe-panel-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.nooktea-recipe-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.nooktea-recipe-mode-tabs {
  min-width: 0;
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-secondary);
}

.nooktea-recipe-mode-tab {
  min-height: 26px;
  padding: 4px 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  transition: background-color var(--transition-hover),
              color var(--transition-hover),
              transform 120ms ease;
}

.nooktea-recipe-mode-tab.selected {
  background: var(--accent-subtle);
  color: var(--accent);
}

.nooktea-recipe-mode-tab:active {
  transform: scale(0.97);
}

.nooktea-recipe-summary {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.nooktea-recipe-card {
  display: flex;
  min-width: 0;
  flex: 1 1 150px;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-sm);
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-tertiary);
}

.nooktea-recipe-card,
.nooktea-customer-card,
.nooktea-story-card,
.nooktea-review-card,
.nooktea-calendar-section,
.nooktea-calendar-day-card,
.nooktea-calendar-forecast-card,
.nooktea-shop-item,
.nooktea-statistics-card,
.nooktea-offline-summary,
.nooktea-log-entry,
.nooktea-inventory-item,
.nooktea-facility-slot {
  transition: border-color var(--transition-hover),
              background-color var(--transition-hover),
              box-shadow var(--transition-hover),
              transform 120ms ease;
}

.nooktea-recipe-card:hover,
.nooktea-story-card:not(.locked):hover,
.nooktea-review-card:hover,
.nooktea-calendar-day-card:hover,
.nooktea-calendar-forecast-card:hover,
.nooktea-shop-item:hover,
.nooktea-statistics-card:hover,
.nooktea-log-entry:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.nooktea-recipe-name {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nooktea-recipe-meta {
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.35;
}

.nooktea-recipe-next {
  color: var(--text-muted);
}

.nooktea-customer-list {
  flex-direction: column;
}

.nooktea-attract-pill {
  width: fit-content;
  max-width: 100%;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-secondary);
}

.nooktea-attract-row {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.nooktea-attract-button {
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 999px;
}

.nooktea-attract-meta {
  min-width: 0;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nooktea-attract-value {
  color: var(--text-primary);
}

.nooktea-attract-meta.is-extended,
.nooktea-attract-meta.is-extended .nooktea-attract-value {
  color: #b7791f;
}

.nooktea-attract-progress {
  width: 46px;
  height: 4px;
  background: var(--bg-tertiary);
}

.nooktea-attract-progress.is-extended {
  background: color-mix(in srgb, #d69e2e 22%, var(--bg-tertiary));
}

.nooktea-attract-progress.is-extended .nooktea-progress-fill {
  background: #d69e2e;
}

.nooktea-customer-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-sm);
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-tertiary);
}

.nooktea-customer-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.nooktea-customer-head,
.nooktea-customer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.nooktea-customer-copy,
.nooktea-customer-order {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nooktea-customer-name,
.nooktea-customer-recipe {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nooktea-customer-greeting,
.nooktea-customer-meta,
.nooktea-customer-reward-breakdown,
.nooktea-customer-timer {
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.35;
}

.nooktea-customer-timer {
  flex: 0 0 auto;
  font-weight: 700;
}

.nooktea-customer-progress {
  height: 6px;
}

.nooktea-premium-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 12px;
}

.nooktea-premium-toggle input {
  width: 14px;
  height: 14px;
}

.nooktea-customer-card.regular {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.nooktea-story-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.nooktea-collection-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.nooktea-collection-summary span,
.nooktea-combo-progress {
  min-width: 0;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.2;
}

.nooktea-combo-progress {
  flex: 1 1 100%;
}

.nooktea-combo-badge {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.nooktea-combo-badge.activated {
  border-color: var(--accent);
}

.nooktea-combo-badge.active {
  background: var(--accent-subtle);
  color: var(--text-primary);
}

.nooktea-story-heading {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.nooktea-story-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-sm);
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-tertiary);
}

.nooktea-story-card.locked {
  opacity: 0.68;
}

.nooktea-story-title {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
}

.nooktea-story-body {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.nooktea-story-read {
  align-self: flex-start;
  margin-top: 4px;
}

.nooktea-story-read-state {
  align-self: flex-start;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.nooktea-statistics {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-sm);
}

.nooktea-statistics-card {
  min-width: 0;
  padding: var(--space-sm);
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-tertiary);
}

.nooktea-statistics-heading {
  margin-bottom: 6px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 800;
}

.nooktea-statistics-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 10px;
  margin: 0;
}

.nooktea-statistics-list dt,
.nooktea-statistics-list dd {
  min-width: 0;
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
}

.nooktea-statistics-list dt {
  overflow: hidden;
  color: var(--text-secondary);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nooktea-statistics-list dd {
  color: var(--text-primary);
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.nooktea-review-wall,
.nooktea-review-section,
.nooktea-review-list,
.nooktea-daily-review-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.nooktea-review-section {
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
}

.nooktea-review-section:last-child {
  border-bottom: 0;
}

.nooktea-review-heading,
.nooktea-review-card-head,
.nooktea-review-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.nooktea-review-heading {
  justify-content: space-between;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 800;
}

.nooktea-review-heading strong,
.nooktea-review-card-head span {
  color: var(--text-muted);
  font-size: 11px;
}

.nooktea-review-tag {
  min-width: 0;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--accent-subtle);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.nooktea-review-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--space-sm);
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-tertiary);
}

.nooktea-review-card-head {
  justify-content: space-between;
}

.nooktea-review-card-head strong {
  color: var(--text-primary);
  font-size: 13px;
}

.nooktea-review-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.nooktea-calendar-item {
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 13px;
}

.nooktea-info-pill,
.nooktea-calendar-item[data-info-pill] {
  cursor: pointer;
}

.nooktea-info-pill:focus-visible,
.nooktea-calendar-item[data-info-pill]:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent);
  outline-offset: 2px;
}

.nooktea-calendar-item[data-info-pill]:hover {
  color: var(--text-primary);
  border-color: color-mix(in srgb, var(--accent) 24%, var(--border));
  background: color-mix(in srgb, var(--accent-subtle) 62%, var(--bg-tertiary));
}

.nooktea-calendar-advice {
  flex-basis: 100%;
  line-height: 1.35;
}

.nooktea-calendar-item.is-marquee {
  overflow: hidden;
  white-space: nowrap;
}

.nooktea-calendar-item.is-marquee .nooktea-marquee-track {
  display: inline-flex;
  width: max-content;
  min-width: max-content;
  animation: nooktea-calendar-marquee 24s linear infinite;
  will-change: transform;
}

.nooktea-calendar-item.is-marquee .nooktea-marquee-copy {
  flex: 0 0 auto;
  padding-right: 32px;
}

@keyframes nooktea-calendar-marquee {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(-50%);
  }
}

.nooktea-calendar-action {
  align-self: flex-start;
}

.nooktea-calendar-book {
  flex-direction: column;
  flex-wrap: nowrap;
}

.nooktea-calendar-section {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: var(--space-sm);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-secondary);
}

.nooktea-calendar-section-title {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.35;
}

.nooktea-calendar-section-title strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-primary);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nooktea-calendar-section-title span {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nooktea-calendar-metrics,
.nooktea-calendar-summary-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.nooktea-calendar-metrics span,
.nooktea-calendar-summary-list span {
  min-width: 0;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.nooktea-calendar-goal-card p,
.nooktea-calendar-forecast-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.nooktea-calendar-week,
.nooktea-calendar-forecast-list {
  display: grid;
  gap: 6px;
}

.nooktea-calendar-week {
  grid-template-columns: repeat(auto-fit, minmax(68px, 1fr));
}

.nooktea-calendar-day-card,
.nooktea-calendar-forecast-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.nooktea-calendar-day-card strong {
  color: var(--text-primary);
  font-size: 12px;
}

.nooktea-calendar-day-card.today {
  border-color: var(--accent);
  background: var(--accent-subtle);
  color: var(--text-primary);
}

.nooktea-calendar-day-label {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

.nooktea-calendar-forecast-list {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.nooktea-offline-summary {
  flex: 1 1 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-secondary);
}

.nooktea-offline-summary[hidden] {
  display: none;
}

.nooktea-offline-head,
.nooktea-offline-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.nooktea-offline-title {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
}

.nooktea-offline-close {
  flex: 0 0 auto;
}

.nooktea-offline-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.nooktea-offline-grid span,
.nooktea-offline-note {
  min-width: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.nooktea-offline-note {
  display: block;
}

.nooktea-muted {
  color: var(--text-muted);
  font-size: 13px;
}

.nooktea-shop {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.nooktea-shop-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.nooktea-shop-title {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
}

.nooktea-shop-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-sm);
}

.nooktea-shop-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-sm);
  align-items: center;
  padding: var(--space-sm);
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-tertiary);
}

.nooktea-shop-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nooktea-shop-name {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nooktea-shop-meta {
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nooktea-shop-buy {
  min-width: 72px;
  padding: 5px 8px;
  font-size: 12px;
}

.nooktea-shop-buy:disabled {
  cursor: default;
  opacity: 0.55;
}

.nooktea-save-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.nooktea-save-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nooktea-save-textarea {
  width: 100%;
  resize: vertical;
  min-height: 144px;
  padding: var(--space-sm);
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
}

.nooktea-save-textarea:focus {
  border-color: var(--accent);
  outline: none;
}

.nooktea-status {
  min-height: 20px;
  margin-top: var(--space-sm);
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.nooktea-status[data-tone="ok"] {
  color: var(--success);
}

.nooktea-status[data-tone="error"] {
  color: var(--danger);
}

.nooktea-toast-region {
  position: fixed;
  top: 14px;
  left: 50%;
  z-index: 40;
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
  transform: translateX(-50%);
}

.nooktea-toast {
  min-width: 0;
  padding: 9px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 36%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-primary) 92%, var(--accent-subtle));
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  animation: nooktea-toast-in 180ms ease-out both;
}

.nooktea-toast[data-tone="error"] {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
}

.nooktea-toast.is-leaving {
  animation: nooktea-toast-out 200ms ease-in both;
}

@keyframes nooktea-toast-in {
  from {
    opacity: 0;
    transform: translateY(-14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes nooktea-toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

@keyframes nooktea-panel-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* NookTea step 8 layout */
#page-games:has(.game-nooktea) {
  max-width: 1280px;
  padding-top: var(--space-md);
}

#page-games:has(.game-nooktea) .page-header {
  display: none;
}

#page-games:has(.game-nooktea) .game-back-bar {
  justify-content: flex-start;
  margin-bottom: var(--space-sm);
}

#page-games:has(.game-nooktea) .game-back-title {
  display: none;
}

#page-games:has(.game-nooktea) .game-area {
  align-items: stretch;
}

.game-nooktea {
  width: 100%;
  max-width: 1220px;
  margin: 0 auto;
  animation: nooktea-panel-in 260ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.nooktea-header {
  position: sticky;
  top: 0;
  z-index: 2;
  align-items: center;
  padding: 6px 0;
  background: var(--bg-primary);
}

.nooktea-title {
  font-size: 22px;
  line-height: 1.1;
}

.nooktea-subtitle {
  margin-top: 2px;
  font-size: 12px;
}

.nooktea-version-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-left: 8px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}

.nooktea-coins {
  min-width: 0;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-subtle) 72%, var(--bg-secondary));
  white-space: nowrap;
}

.nooktea-coins .score-label,
.nooktea-stat .score-label {
  display: inline;
  margin-bottom: 0;
  font-size: 10px;
  line-height: 1;
}

.nooktea-coins-value {
  display: inline;
  font-size: 16px;
  line-height: 1;
}

.nooktea-stats {
  position: sticky;
  top: 58px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  border: 0;
  border-radius: 0;
  background: var(--bg-primary);
}

.nooktea-coins,
.nooktea-stat,
.nooktea-panel.nooktea-growth-panel {
  transition: border-color var(--transition-hover),
              background-color var(--transition-hover),
              box-shadow var(--transition-hover),
              transform 120ms ease;
}

.nooktea-stat:hover,
.nooktea-coins:hover,
.nooktea-panel.nooktea-growth-panel:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.nooktea-stat {
  min-width: 0;
  min-height: 30px;
  display: inline-flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-secondary);
}

.nooktea-stat-wide {
  flex: 0 1 auto;
}

.nooktea-stat-value {
  margin-top: 0;
  overflow: hidden;
  font-size: 13px;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nooktea-stat-progress {
  width: 44px;
  height: 4px;
  margin-top: 0;
  background: var(--bg-tertiary);
}

.nooktea-main-layout {
  display: grid;
  grid-template-columns: minmax(280px, 320px) minmax(360px, 1fr) minmax(292px, 336px);
  gap: var(--space-md);
  align-items: start;
}

.nooktea-column {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  animation: nooktea-panel-in 280ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.nooktea-column:nth-child(2) {
  animation-delay: 55ms;
}

.nooktea-column:nth-child(3) {
  animation-delay: 110ms;
}

.nooktea-grid-cell.harvestable {
  border: 1px solid color-mix(in srgb, var(--accent) 58%, transparent);
  background: color-mix(in srgb, var(--accent-subtle) 62%, var(--game-cell));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 28%, transparent);
}

.nooktea-grid-cell {
  transition: border-color var(--transition-hover),
              background-color var(--transition-hover),
              box-shadow var(--transition-hover),
              opacity var(--transition-hover),
              transform 120ms ease;
}

.nooktea-grid-cell:not(.locked):hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.nooktea-progress-fill {
  transition: width 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.nooktea-grid-cell.empty {
  opacity: 0.78;
}

.nooktea-grid-cell.empty .nooktea-cell-action {
  background: transparent;
}

.nooktea-grid-cell.locked {
  border: 1px dashed var(--border);
  background: color-mix(in srgb, var(--game-cell) 62%, var(--bg-secondary));
  color: var(--text-muted);
}

.nooktea-grid-cell.locked .nooktea-progress {
  opacity: 0.45;
}

.nooktea-panel {
  min-width: 0;
  border-radius: 8px;
  transition: border-color var(--transition-hover),
              background-color var(--transition-hover),
              box-shadow var(--transition-hover);
}

.nooktea-calendar-panel {
  padding: var(--space-sm) var(--space-md);
}

.nooktea-calendar-panel .settings-label {
  margin-bottom: 4px;
}

.nooktea-calendar-panel .nooktea-calendar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.nooktea-calendar-panel .nooktea-calendar-item {
  min-width: 0;
  max-width: 100%;
  padding: 4px 7px;
  overflow: hidden;
  overflow-wrap: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nooktea-calendar-panel .nooktea-calendar-advice {
  grid-column: 1 / -1;
  white-space: nowrap;
}

.nooktea-calendar-panel .nooktea-calendar-action {
  grid-column: 1 / -1;
  justify-self: start;
}

.nooktea-column-left {
  position: sticky;
  top: 140px;
  gap: var(--space-sm);
}

.nooktea-column-right {
  position: sticky;
  top: 140px;
}

.nooktea-customers-panel {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
  background: linear-gradient(180deg, var(--accent-subtle), var(--bg-secondary) 42%);
}

.nooktea-panel-label-with-badge {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nooktea-customer-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #d64545;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.nooktea-customer-count-badge[hidden] {
  display: none;
}

.nooktea-customers-panel,
.nooktea-management-panel {
  max-height: 560px;
  overflow: auto;
}

.nooktea-recipes-panel,
.nooktea-resources-panel,
.nooktea-bag-panel {
  max-height: 420px;
  overflow: auto;
}

@media (min-width: 901px) and (max-height: 820px) {
  .nooktea-grid-cell {
    min-height: 96px;
  }

  .nooktea-grid-cell:has([data-action="remove-decor"]) {
    min-height: 126px;
  }

  .nooktea-main-layout {
    gap: var(--space-sm);
  }
}

.nooktea-status-strip-feedback {
  background: var(--accent-subtle);
}

.nooktea-status-strip-feedback .nooktea-status {
  min-height: 18px;
  margin-top: 1px;
  overflow: hidden;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nooktea-missing-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.nooktea-missing-pill,
.nooktea-ready-pill {
  min-height: 26px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.nooktea-missing-pill {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
  color: var(--danger);
}

.nooktea-ready-pill {
  border-color: color-mix(in srgb, var(--success) 32%, var(--border));
  color: var(--success);
}

.nooktea-choice.muted,
.nooktea-choice:disabled {
  cursor: default;
  opacity: 0.45;
}

.nooktea-mix-status {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.nooktea-mix-status-badge {
  border-radius: 6px;
}

.nooktea-mobile-tabs {
  display: none;
}

.nooktea-resource-stack,
.nooktea-bag-stack,
.nooktea-bag-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.nooktea-inline-label {
  margin-bottom: 0;
}

.nooktea-decor-inventory {
  grid-template-columns: 1fr;
}

.nooktea-decor-grid,
.nooktea-cat-list,
.nooktea-placed-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.nooktea-decor-grid .nooktea-inventory-item {
  flex: 1 1 132px;
}

.nooktea-management-panel {
  display: flex;
  min-height: 560px;
  flex-direction: column;
  gap: var(--space-sm);
}

.nooktea-management-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(54px, 1fr));
  gap: 4px;
}

.nooktea-management-tab {
  min-width: 0;
  min-height: 32px;
  padding: 5px 4px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  transition: border-color var(--transition-hover),
              background-color var(--transition-hover),
              color var(--transition-hover),
              transform 120ms ease;
}

.nooktea-management-tab.selected {
  border-color: var(--accent);
  background: var(--accent-subtle);
  color: var(--accent);
  transform: translateY(-1px);
}

.nooktea-management-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.nooktea-management-pane {
  min-width: 0;
}

.nooktea-management-pane .nooktea-shop,
.nooktea-management-pane .nooktea-story-book,
.nooktea-management-pane .nooktea-calendar-book,
.nooktea-management-pane .nooktea-log-text {
  max-height: none;
}

.nooktea-shop-group {
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
}

.nooktea-shop-group:last-child {
  border-bottom: 0;
}

.nooktea-shop-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: 4px 0;
  cursor: pointer;
  list-style: none;
}

.nooktea-shop-title::-webkit-details-marker {
  display: none;
}

.nooktea-shop-title::after {
  content: "+";
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 800;
}

.nooktea-shop-group[open] .nooktea-shop-title::after {
  content: "-";
}

.nooktea-shop-count {
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

.nooktea-shop-item.focused {
  border-color: var(--accent);
  background: var(--accent-subtle);
  box-shadow: inset 3px 0 0 var(--accent);
}

.nooktea-facility-slot {
  flex-direction: column;
  gap: 2px;
}

.nooktea-facility-slot.placed {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.nooktea-facility-name {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
}

.nooktea-facility-meta {
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.35;
}

.nooktea-log-panel {
  max-height: none;
}

.nooktea-log-text {
  max-height: 212px;
  min-height: 132px;
  display: flex;
  align-items: stretch;
  flex-direction: column;
  gap: 6px;
  overflow: auto;
}

.nooktea-log-entry {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: var(--space-sm);
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--bg-tertiary);
}

.nooktea-log-time {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.45;
  white-space: nowrap;
}

.nooktea-log-message {
  min-width: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.nooktea-version-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  margin-bottom: var(--space-sm);
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.2;
}

.nooktea-version-row .score-label {
  margin-bottom: 0;
}

.nooktea-version-row strong {
  color: var(--text-primary);
  font-size: 13px;
}

.nooktea-time-scale-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  margin-bottom: var(--space-sm);
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 12px;
}

.nooktea-time-scale-field .score-label {
  margin-bottom: 0;
}

.nooktea-time-scale-select {
  min-width: 86px;
  margin-left: auto;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 12px;
}

.nooktea-save-details {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.nooktea-save-summary {
  min-height: 32px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.nooktea-settings-panel .nooktea-save-textarea {
  max-height: 220px;
}

.nooktea-choice,
.nooktea-cell-action,
.nooktea-shop-buy,
.nooktea-mobile-tab {
  overflow-wrap: anywhere;
}

.nooktea-cell-action,
.nooktea-shop-buy,
.nooktea-story-read,
.nooktea-calendar-action,
.nooktea-offline-close,
.nooktea-save-summary {
  transition: border-color var(--transition-hover),
              background-color var(--transition-hover),
              color var(--transition-hover),
              transform 120ms ease,
              box-shadow var(--transition-hover);
}

.nooktea-cell-action:not(:disabled):active,
.nooktea-shop-buy:not(:disabled):active,
.nooktea-story-read:not(:disabled):active,
.nooktea-calendar-action:not(:disabled):active,
.nooktea-offline-close:not(:disabled):active,
.nooktea-save-summary:active,
.nooktea-management-tab:active,
.nooktea-mobile-tab:active,
.nooktea-choice:not(:disabled):active,
.nooktea-inventory-item:not(:disabled):active {
  transform: scale(0.97);
}

.nooktea-customer-card:has(.nooktea-customer-meta) {
  min-width: 0;
}

.nooktea-calendar-item {
  max-width: 100%;
  overflow-wrap: anywhere;
}

@media (max-width: 1100px) {
  .nooktea-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .nooktea-main-layout {
    grid-template-columns: minmax(280px, 320px) minmax(360px, 1fr);
  }

  .nooktea-column-right {
    position: static;
    grid-column: 1 / -1;
  }

  .nooktea-management-panel {
    min-height: 0;
    max-height: 420px;
  }
}

@media (max-width: 900px) {
  #page-games:has(.game-nooktea),
  #page-games:has(.game-nooktea) .game-area {
    overflow: visible;
    animation: none;
    transform: none;
  }

  .game-nooktea {
    max-width: 760px;
    padding-bottom: 68px;
  }

  .nooktea-stats {
    top: 64px;
  }

  .nooktea-panel.nooktea-growth-panel {
    width: 100%;
    border-radius: 8px;
  }

  .nooktea-main-layout {
    grid-template-columns: 1fr;
  }

  .game-nooktea[data-active-mobile-view="tea"] [data-mobile-panel]:not([data-mobile-panel~="tea"]),
  .game-nooktea[data-active-mobile-view="customers"] [data-mobile-panel]:not([data-mobile-panel~="customers"]),
  .game-nooktea[data-active-mobile-view="mix"] [data-mobile-panel]:not([data-mobile-panel~="mix"]),
  .game-nooktea[data-active-mobile-view="manage"] [data-mobile-panel]:not([data-mobile-panel~="manage"]) {
    display: none;
  }

  .nooktea-column-left,
  .nooktea-column-right {
    position: static;
  }

  .nooktea-mobile-tabs {
    position: fixed;
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    left: max(12px, env(safe-area-inset-left));
    z-index: 8;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-primary);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  }

  .nooktea-mobile-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    min-height: 38px;
    padding: 7px 4px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
  }

  .nooktea-mobile-tab .nooktea-customer-count-badge {
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 10px;
  }

  .nooktea-mobile-tab.selected {
    border-color: var(--accent);
    background: var(--accent-subtle);
    color: var(--accent);
  }

  .nooktea-customers-panel,
  .nooktea-recipes-panel,
  .nooktea-resources-panel,
  .nooktea-bag-panel,
  .nooktea-management-panel {
    max-height: none;
  }

  .nooktea-calendar-panel .nooktea-calendar-advice:not(.is-marquee) {
    white-space: normal;
  }

  .nooktea-management-panel {
    min-height: 0;
  }
}

@media (max-width: 480px) {
  .game-nooktea {
    gap: var(--space-sm);
  }

  .nooktea-header {
    position: static;
  }

  .nooktea-stats {
    position: static;
    padding: 2px 0;
  }

  .nooktea-mobile-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
  }

  .nooktea-mobile-tab {
    min-height: 36px;
    padding: 6px 2px;
    font-size: 11px;
  }

  .nooktea-management-tabs {
    grid-template-columns: repeat(auto-fit, minmax(48px, 1fr));
    gap: 3px;
  }

  .nooktea-management-tab {
    min-height: 34px;
    padding: 5px 2px;
    font-size: 11px;
  }

  .nooktea-grid {
    gap: 6px;
    padding: 6px;
  }

  .nooktea-grid-cell {
    gap: 3px;
    padding: 5px;
  }

  .nooktea-cell-label,
  .nooktea-cell-detail,
  .nooktea-cell-decor,
  .nooktea-cell-time {
    max-width: 100%;
  }

  .nooktea-cell-label {
    font-size: 12px;
  }

  .nooktea-cell-detail,
  .nooktea-cell-decor,
  .nooktea-cell-time {
    font-size: 10px;
  }

  .nooktea-cell-action {
    min-height: 24px;
    padding: 3px 6px;
    font-size: 11px;
  }

  .nooktea-customer-head,
  .nooktea-customer-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .nooktea-customer-actions .btn {
    width: 100%;
    min-height: 34px;
  }

  .nooktea-shop-item {
    grid-template-columns: 1fr;
  }

  .nooktea-shop-buy {
    width: 100%;
  }
}

/* ===== Snake ===== */
.game-snake {
  width: 100%;
  max-width: 440px;
  position: relative;
}

.game-snake-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  gap: var(--space-sm);
}

.game-snake-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
}

.game-snake-score {
  background: var(--accent-subtle);
  padding: 8px 16px;
  border-radius: var(--btn-radius);
  text-align: center;
}

.game-snake-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.snake-pause-btn {
  min-width: 56px;
}

.snake-canvas-area {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--card-radius);
  overflow: hidden;
  border: 2px solid var(--border);
  background: var(--bg-secondary);
  position: relative;
}

.snake-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.snake-pause-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.28);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  pointer-events: none;
}

.snake-pause-overlay.hidden {
  display: none;
}

/* D-Pad for mobile */
.dpad {
  display: grid;
  grid-template-columns: repeat(3, 60px);
  grid-template-rows: repeat(3, 60px);
  gap: 4px;
  justify-content: center;
  margin-top: var(--space-lg);
}

.dpad-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--btn-radius);
  font-size: 18px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.dpad-btn:active {
  background: var(--accent-subtle);
}

.dpad-btn[data-dir="up"]    { grid-column: 2; grid-row: 1; }
.dpad-btn[data-dir="left"]  { grid-column: 1; grid-row: 2; }
.dpad-btn[data-dir="right"] { grid-column: 3; grid-row: 2; }
.dpad-btn[data-dir="down"]  { grid-column: 2; grid-row: 3; }

/* ===== Dark mode overrides for games ===== */
[data-theme="dark"] .game-over-overlay {
  background: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .game-over-title,
[data-theme="dark"] .game-over-score {
  color: var(--text-primary);
}

/* Responsive */
@media (min-width: 640px) {
  .game-menu-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .dpad {
    display: none; /* Hide d-pad on desktop */
  }
}

@media (max-width: 480px) {
  .nooktea-header {
    align-items: center;
    flex-direction: column;
    text-align: center;
  }

  .nooktea-subtitle {
    text-align: center;
  }

  .nooktea-facility-list {
    grid-template-columns: 1fr;
  }

  .nooktea-save-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .nooktea-save-actions {
    width: 100%;
    justify-content: stretch;
  }

  .nooktea-save-actions .btn {
    flex: 1 1 0;
  }
}

@media (min-width: 1024px) {
  .game-menu-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Safe area for mobile notched devices */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .dpad {
    padding-bottom: env(safe-area-inset-bottom);
  }
}
