﻿/* All @imports moved to <link> tags in index.html for parallel loading */

:root {
  --bg: #211c14;
  --panel: rgba(56, 47, 34, 0.86);
  --card: #4b402e;
  --text: var(--palette-text);
  --muted: var(--palette-text-muted);
  --accent: var(--palette-accent);
  --danger: var(--palette-danger);
  --warn: var(--palette-warn);
  --glow: rgba(231, 192, 111, 0.22);
  --border: var(--palette-border);
  --border-light: rgba(205, 176, 112, 0.52);
  --card-inset: #342b1f;
  --surface-soft: rgba(88, 72, 45, 0.56);
  --surface-deep: rgba(28, 24, 19, 0.9);
  /* --mist, --shadow-card, --shadow-panel removed — unused */

  /* Surface hierarchy (deep to elevated = darker to lighter) */
  --surface-1: #1a1610;
  --surface-2: rgba(52, 44, 30, 0.88);
  --surface-3: #423a28;
  /* --surface-4 removed — unused */

  /* Currency colors */
  --currency-seeds: #e8c55a;
  --currency-stars: #c8a8d8;

  /* Active/highlight states */
  --text-active: #d8f0d0;
  --text-dim: #ddd4c4;
  --text-warm: #d4b88a;

  /* Progress gradient */
  --gradient-progress-start: #d4a96a;
  --gradient-progress-end: #8cc67a;

  /* Typography */
  --font-display: "Nunito", Georgia, "Times New Roman", serif;
  --font-body: "Trebuchet MS", "Segoe UI", Tahoma, sans-serif;
  --text-hero: 24px;
  --text-display: 20px;
  --text-body: 15px;
  --text-small: 13px;
  --text-micro: 11px;

  /* Motion tokens */
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-soft: cubic-bezier(0.25, 0.1, 0.25, 1);
  --dur-instant: 0.08s;
  --dur-fast: 0.15s;
  --dur-normal: 0.25s;
}

.sr-skip-link:focus {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 9999;
  width: auto;
  height: auto;
  padding: 8px 16px;
  margin: 0;
  clip: auto;
  white-space: normal;
  overflow: visible;
  background: var(--bg);
  color: var(--text);
  border: 2px solid var(--accent);
  border-radius: var(--radius-1);
  font-size: 14px;
}

#tab-content:focus { outline: none; }
#tab-content:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--font-body);
  overscroll-behavior-y: contain;
  -webkit-tap-highlight-color: transparent;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: var(--texture-grain);
  opacity: 0.5;
  mix-blend-mode: soft-light;
}

.app-shell {
  width: min(1040px, 100vw);
  min-height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr auto;
  position: relative;
  z-index: var(--z-base);
}

/* Hide site-mode-nav in companion — bottom tabs handle navigation */
.site-mode-nav { display: none; }

.top-bar {
  display: grid;
  grid-template-columns: 1fr;
  padding: 12px 16px;
  min-height: 52px;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(43, 36, 24, 0.92), rgba(33, 29, 22, 0.88));
}

.top-bar__main {
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.top-bar__main::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(231, 192, 111, 0.6), transparent);
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
}

.app-shell--refreshing .top-bar__main::after {
  opacity: 1;
  animation: refresh-shimmer 1.2s ease-in-out infinite;
}

@keyframes refresh-shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 0.01em;
}


.balances {
  display: flex;
  gap: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

#seed-balance { color: var(--currency-seeds); }
#star-balance { color: var(--currency-stars); }

.tab-content {
  padding: 16px;
  display: grid;
  gap: 16px;
}

.tab-content--entering {
  animation: tab-enter 0.25s ease-out;
}

/* Game section + cards (base styles for all viewports) */
.game-section { display: grid; gap: 12px; }
.section-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 4px;
}
.idle-game-list {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
}
.idle-game-card {
  display: grid; gap: 4px; padding: 14px; min-height: 80px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--game-accent, var(--accent));
  border-radius: 12px;
  background: var(--surface-2);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.idle-game-emoji { font-size: 24px; flex-shrink: 0; }
.idle-game-card strong { font-size: 14px; font-weight: 700; }
.idle-game-card .mobile-meta { font-size: 12px; color: var(--muted); margin: 0; }
.idle-game-card[data-game="chain"] { --game-accent: #9cc07c; }
.idle-game-card[data-game="survival"] { --game-accent: #dc7f5c; }
.idle-game-card[data-game="poll"] { --game-accent: #62d4ff; }
.idle-game-card[data-game="wavedefender"] { --game-accent: #e8a838; }
.idle-game-card[data-game="tug"] { --game-accent: #c47a5a; }
.idle-game-card[data-game="emojitrain"] { --game-accent: #d8b060; }

@keyframes tab-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes tab-exit {
  from { opacity: 1; }
  to { opacity: 0; }
}

.tab-content--exiting {
  animation: tab-exit 0.1s ease-in forwards;
  pointer-events: none;
}

.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-2);
  padding: var(--space-2);
  box-shadow:
    inset 0 1px 0 rgba(255, 247, 226, 0.06),
    0 8px 24px rgba(0, 0, 0, 0.12);
}

.panel--secondary {
  background: var(--surface-soft);
  border-color: var(--border-light);
}

.panel--flush {
  background: transparent;
  border: none;
  padding: 0;
}

.row {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
  align-items: center;
}

.label {
  color: var(--muted);
  font-size: 12px;
}

.stat-line {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 8px;
}

.bar {
  position: relative;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--card-inset);
  overflow: hidden;
}

.bar > span {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, var(--gradient-progress-start), var(--gradient-progress-end));
}

button {
  border: 1px solid var(--border-light);
  background: linear-gradient(180deg, rgba(76, 66, 45, 0.96), rgba(56, 48, 34, 0.96));
  color: var(--text);
  padding: var(--space-1) 12px;
  border-radius: var(--radius-1);
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, opacity 0.1s, transform 0.1s;
}

button:hover { border-color: var(--accent); box-shadow: 0 4px 14px var(--glow); transform: translateY(-1px); }
button:active { transform: scale(0.94) translateY(2px); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); transition-duration: var(--dur-instant); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
button.warn { border-color: var(--warn); }
button.danger { border-color: var(--danger); }
button.button--primary,
button.chat-action--primary {
  border-radius: var(--radius-pill);
  padding-inline: var(--space-2);
}

.action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--border-light);
  background: linear-gradient(180deg, rgba(76, 66, 45, 0.96), rgba(56, 48, 34, 0.96));
  color: var(--text);
  padding: var(--space-1) 12px;
  border-radius: var(--radius-1);
  cursor: pointer;
  text-decoration: none;
  font: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.action-link:hover {
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--glow);
}

.action-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.action-link:active { opacity: 0.8; transform: scale(0.97); }

.action-link--primary {
  border-color: var(--accent);
  color: var(--text-active);
  border-radius: var(--radius-pill);
  padding-inline: var(--space-2);
}

.tab-bar {
  display: grid;
  grid-template-columns: repeat(var(--tab-count, 4), minmax(0, 1fr));
  gap: 5px;
  padding: 8px 10px;
  border-top: 1px solid rgba(180, 140, 80, 0.28);
  background:
    linear-gradient(180deg, rgba(62, 46, 26, 0.96), rgba(42, 31, 16, 0.98));
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.25);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 4px;
  border-radius: 10px;
  border: 1px solid rgba(171, 147, 100, 0.12);
  background: rgba(255, 250, 240, 0.03);
  color: var(--muted);
  transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
  min-height: 52px;
}

.tab:hover:not(.active) {
  border-color: rgba(205, 176, 112, 0.3);
  color: var(--text);
  background: rgba(255, 250, 240, 0.06);
}
.tab:active { transform: scale(0.97); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tab-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  transition: filter 0.2s;
}

.tab-emoji {
  font-size: 20px;
  line-height: 1;
}

.tab.active {
  color: var(--text-active);
  background: linear-gradient(180deg, rgba(164, 207, 127, 0.14), rgba(140, 198, 122, 0.06));
  border-color: rgba(164, 207, 127, 0.3);
  box-shadow:
    inset 0 1px 0 rgba(200, 230, 170, 0.1),
    0 0 14px rgba(140, 198, 122, 0.12);
}

.tab.active .tab-icon {
  filter: drop-shadow(0 0 5px rgba(140, 198, 122, 0.45));
}

.tab.active .tab-emoji {
  filter: drop-shadow(0 0 6px rgba(140, 198, 122, 0.4));
}

/* "Coming soon" teaser panels — intentional, not placeholder */
.teaser-panel {
  text-align: center;
  padding: 20px 16px;
  margin-top: 8px;
  border-style: dashed;
  border-color: rgba(164, 207, 127, 0.18);
  background:
    radial-gradient(ellipse 60% 80% at 50% 100%, rgba(164, 207, 127, 0.04), transparent),
    var(--surface-soft);
  color: var(--muted);
  font-size: 14px;
}

.teaser-panel p { margin: 0; }

/* Empty state — softer than log-item, with centered layout */
.empty-hint {
  text-align: center;
  padding: 20px 14px;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.6;
  border-radius: var(--radius-1);
  background: rgba(255, 255, 255, 0.015);
}

.mote-avatar {
  width: 180px;
  height: 180px;
  margin: 0 auto;
  display: grid;
  place-items: center;
}

.mote-avatar svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 8px rgba(200, 180, 100, 0.35));
  animation: idle-bob 3s ease-in-out infinite;
}

@keyframes idle-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.grid-2 {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.timer {
  font-variant-numeric: tabular-nums;
  color: var(--text-warm);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-light);
  background: var(--card);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.log {
  display: grid;
  gap: 0;
  border: 1px solid var(--border);
  background: var(--card-inset);
  border-radius: 10px;
  overflow: hidden;
}

.log-item {
  border: none;
  background: transparent;
  border-radius: 0;
  padding: 10px;
  color: var(--text-dim);
}

.log-item + .log-item {
  border-top: 1px solid rgba(162, 133, 84, 0.12);
}

.resource-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.resource-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: var(--card-inset);
  border-radius: 10px;
  transition: border-color 0.2s;
}

.resource-chip:hover {
  border-color: var(--border-light);
}

.resource-chip strong {
  display: block;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.item-grid {
  display: grid;
  gap: 8px;
}

.item-card {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  background: var(--card-inset);
  border-radius: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.item-card:hover { border-color: var(--border-light); }
.item-card:active:not(.player-card) { transform: scale(0.96); transition-duration: var(--dur-instant); }

.item-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.item-card--selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(126, 203, 110, 0.35);
}

.item-card.stashed {
  border-style: dashed;
}

.item-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.item-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.item-card-stats {
  color: var(--text-dim);
  font-size: 12px;
}

.item-card-note {
  color: var(--muted);
  font-size: 12px;
}

.community-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  margin-top: 12px;
}

.community-input {
  min-width: 0;
  border: 1px solid var(--border-light);
  background: #1a1510;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  font: inherit;
}

.community-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(140, 198, 122, 0.15);
}

.community-input:focus:not(:focus-visible) {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(140, 198, 122, 0.15);
}

.community-warning {
  margin-top: 12px;
  border-color: #8a7040;
  color: #f0d080;
}

/* Community haven name — serif display treatment */
.community-haven-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-warm);
  letter-spacing: 0.02em;
  flex: 1 1 100%;
}

/* Player card left accent borders */
.player-card {
  border-left: 3px solid var(--border);
}
.player-card--active {
  border-left-color: #8cc67a;
}
.player-card--self {
  border-left-color: var(--text-warm);
}
.friend-card {
  border-left-color: #c8a8d8;
}
.friend-card.player-card--active {
  border-left-color: #8cc67a;
}

.community-shop-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.community-preview-svg {
  display: grid;
  place-items: center;
  min-height: 160px;
  max-height: 200px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at 30% 20%, rgba(200, 180, 100, 0.1), transparent 40%),
    linear-gradient(180deg, rgba(30, 25, 18, 0.95), rgba(24, 20, 14, 0.95));
}

.community-preview-svg svg {
  width: min(180px, 100%);
  height: auto;
}

.trade-desk {
  display: grid;
  gap: 12px;
}

.trade-desk-note {
  margin-top: 0;
}

.trade-empty-state,
.trade-request-card,
.trade-room-main,
.trade-room-sidebar,
.trade-preview-card {
  display: grid;
  gap: 12px;
}

.trade-target-grid,
.trade-item-select-grid,
.trade-offer-grid {
  display: grid;
  gap: 10px;
}

.trade-target-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.trade-room-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  align-items: start;
}

.trade-room-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.trade-room-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.trade-window {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.trade-window__side {
  display: grid;
  gap: 12px;
  border: 1px solid var(--border);
  background: var(--card-inset);
  border-radius: 12px;
  padding: 12px;
}

.trade-material-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.trade-material-card {
  gap: 10px;
}

.trade-stepper-row {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.trade-item-select-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.trade-item-card--selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(126, 203, 110, 0.35);
}

.trade-preview-card {
  border: 1px solid var(--border);
  background: var(--card-inset);
  border-radius: 12px;
  padding: 12px;
}

.trade-preview-block {
  display: grid;
  gap: 8px;
}

.trade-tax-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.trade-offer-summary {
  display: grid;
  gap: 10px;
}

.trade-offer-materials {
  display: grid;
  gap: 8px;
}

.badge.mastercraft {
  border-color: var(--warn);
  color: #ffd88a;
}

.status-chip-row,
.chat-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-light);
  background: var(--card);
  font-size: 12px;
}

.status-chip--ok {
  border-color: #4a6040;
  color: var(--text-active);
}

.status-chip--warn {
  border-color: #8a7040;
  color: #f0d080;
}

.chat-action {
  min-height: 38px;
}

.chat-action:active { opacity: 0.8; transform: scale(0.97); }

.chat-action--primary {
  border-color: var(--accent);
  color: var(--text-active);
  border-radius: var(--radius-pill);
  padding-inline: var(--space-2);
}

.hero-panel strong {
  color: #f1f6fb;
}

.action-card-list {
  display: grid;
  gap: 0;
  border: 1px solid var(--border);
  background: var(--card-inset);
  border-radius: 12px;
  overflow: hidden;
}

.action-card {
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  background: transparent;
  border-radius: 0;
  padding: 8px 12px;
}

.action-card strong {
  flex-shrink: 0;
}

.action-card .label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-card .badge {
  flex-shrink: 0;
  margin-left: auto;
}

.action-card + .action-card {
  border-top: 1px solid rgba(162, 133, 84, 0.12);
}

.companion-hub-summary {
  gap: 14px;
}

.companion-hub-summary__note {
  margin: 0;
  color: var(--muted);
}

.companion-hub-summary__grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.companion-hub-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 2px 6px;
  color: var(--text-warm);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
  font-weight: normal;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Hub sub-nav */
.hub-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hub-nav__link {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  background: var(--card);
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}

.hub-nav__link:hover {
  border-color: var(--accent);
  color: var(--text);
}

.hub-nav__link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Chain number display */
.chain-display {
  text-align: center;
  padding: 12px 0;
}

.chain-number {
  font-size: 48px;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.chain-number--saving {
  color: var(--warn);
}

/* Chain chat/event feed */
.chain-chat-log {
  max-height: 280px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.chain-msg {
  font-size: 13px;
  padding: 6px 10px;
}

.chain-msg--wreck {
  color: var(--danger);
  font-weight: 600;
}

.chain-msg--milestone {
  color: var(--warn);
  font-weight: 700;
}

.chain-msg--record {
  color: var(--warn);
  font-weight: 700;
  text-shadow: 0 0 8px rgba(223, 182, 104, 0.5);
}

.chain-msg__user {
  color: var(--accent);
}

.companion-hub-divider::before,
.companion-hub-divider::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(223, 201, 160, 0.28), transparent);
}

.log-item--haven {
  border-left: 3px solid rgba(200, 170, 80, 0.6);
}

.log-item--ready {
  border-left: 3px solid var(--accent);
  color: var(--text);
}

.log-item--growing {
  border-left: 3px solid var(--warn);
}

/* --- Top bar extras --- */

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.site-nav-slot {
  width: 100%;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.user-name {
  color: var(--accent);
  font-weight: 600;
}

.logout-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
}

.logout-link:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.logout-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.logout-link:active { opacity: 0.7; }

.lang-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font: 10px/1 "Segoe UI", Tahoma, sans-serif;
  color: var(--muted);
}
.lang-toggle span {
  padding: 2px 5px;
  border-radius: 4px;
}
.lang-toggle span.is-active {
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
}
.lang-toggle:hover { border-color: var(--accent); }

/* --- Inline icons --- */

.inline-icon {
  vertical-align: middle;
  image-rendering: auto;
  margin-right: 2px;
}

.balances .inline-icon {
  margin-right: 4px;
}

/* --- Loading state --- */

/* --- Brand loading moment (replaces ugly skeleton) --- */

.loading-brand {
  display: grid;
  place-items: center;
  place-content: center;
  min-height: 80vh;
  gap: 20px;
  animation: loading-brand-in 0.4s ease-out;
}

.loading-mote {
  filter: drop-shadow(0 0 24px rgba(125, 216, 125, 0.35));
  animation: loading-mote-pulse 2.5s ease-in-out infinite;
}

@keyframes loading-mote-pulse {
  0%, 100% { transform: scale(1); opacity: 0.92; }
  50% { transform: scale(1.06); opacity: 1; }
}

@keyframes loading-brand-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.loading-brand__text {
  margin: 0;
  color: var(--muted, #c6b59a);
  text-align: center;
  font-size: 14px;
  letter-spacing: 0.03em;
}

/* Fade-out when app replaces loading brand */
.app-shell--fade-out > .loading-brand {
  transition: opacity 0.2s ease;
  opacity: 0;
}

.landing-shell {
  display: grid;
  gap: var(--space-2);
  padding: 20px 16px 40px;
}

/* --- Empty state illustrations --- */

.empty-state-art {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: 14px;
  margin-bottom: 12px;
}

.hero-panel--empty {
  text-align: center;
}

/* --- Festival banner art --- */

.festival-banner-art {
  width: 100%;
  height: auto;
  border-radius: 12px;
  margin-bottom: 8px;
}

/* --- Toast notifications --- */

.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  max-width: 400px;
  width: max-content;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13px;
  z-index: var(--z-toast);
  opacity: 0;
  pointer-events: none;
}

.toast--in {
  animation: toast-in 0.35s var(--ease-bounce) forwards;
}

.toast--out {
  animation: toast-out 0.3s ease-in forwards;
}

@keyframes toast-in {
  0% { opacity: 0; transform: translateX(-50%) translateY(-24px) scale(0.95); }
  70% { opacity: 1; transform: translateX(-50%) translateY(4px) scale(1.01); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

@keyframes toast-out {
  0% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-16px) scale(0.97); }
}

.toast--success {
  background: rgba(139, 198, 122, 0.15);
  border: 1px solid var(--accent);
  color: var(--text-active);
}

.toast--error {
  background: rgba(224, 122, 82, 0.15);
  border: 1px solid var(--danger);
  color: #f0d0c0;
}

.toast--info {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
}

@media (max-width: 500px) {
  .toast { max-width: 90vw; font-size: 12px; }
}

/* --- Connection state dot --- */

.connection-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.3s, box-shadow 0.3s;
}

.connection-dot--connected { background: var(--accent); animation: dot-connect 0.5s var(--ease-bounce); }
.connection-dot--reconnecting { background: var(--warn); animation: pulse-dot 1.2s infinite; box-shadow: 0 0 0 2px var(--warn); }
.connection-dot--offline { background: transparent; border: 2px solid var(--muted); width: 6px; height: 6px; }

@keyframes dot-connect {
  0% { transform: scale(0); box-shadow: 0 0 0 4px rgba(140,198,122,0.4); }
  60% { transform: scale(1.3); box-shadow: 0 0 0 0 rgba(140,198,122,0); }
  100% { transform: scale(1); }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* --- Error shake --- */

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

.is-shaking { animation: shake 0.4s ease; }

/* --- Reduced motion --- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Skeleton width variants --- */

.cozy-skeleton--w-narrow { width: min(360px, 72%); }
.cozy-skeleton--w-mid { width: min(400px, 82%); }
.cozy-skeleton--w-wide { width: min(440px, 88%); }
.cozy-skeleton--w-72 { width: 72%; }

/* --- Responsive --- */

@media (max-width: 840px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {

  .top-bar__main {
    flex-direction: column;
    align-items: flex-start;
  }
  .top-bar-right {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .mote-avatar {
    width: 140px;
    height: 140px;
  }
  .action-link,
  .chat-action {
    flex: 1 1 160px;
  }
  .community-search {
    grid-template-columns: 1fr;
  }
  .trade-room-grid,
  .trade-window,
  .trade-tax-grid {
    grid-template-columns: 1fr;
  }
  .trade-room-header {
    flex-direction: column;
  }
  .trade-room-status {
    justify-content: flex-start;
  }
  .trade-stepper-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tab-bar {
    position: sticky;
    bottom: 0;
    z-index: var(--z-overlay);
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  .tab {
    min-height: 48px;
  }
  .trade-stepper-row button {
    min-height: 44px;
    font-size: 14px;
  }
  .companion-hub-summary__grid {
    grid-template-columns: 1fr;
  }

}
