:root {
  color-scheme: only light; /* no forced dark mode */
  --bg-1: #6a5cf0;
  --bg-2: #3fb3e8;
  --bg-3: #4fd1b0;
  --ink: #2b2230;
  --muted: #6b5f7a;
  --card: #fffaf0;
  --tile: #f2ecff;
  --line: #e4d9f5;
  --primary: #5b5fe6;
  --primary-soft: #e8e5ff;
  --ok: #22b573;
  --ok-dark: #189a5f;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 6px 22px rgba(40, 20, 90, 0.18);
  --font: 'Baloo Bhaijaan 2', 'Tajawal', system-ui, -apple-system, 'Segoe UI', sans-serif;
  /* In-game wood and parchment. */
  --wood: #9a6234;
  --wood-light: #c08048;
  --wood-dark: #6b3f1f;
  --parchment: #f7e6c2;
  /* Playful background: a colourful sweep with faint maths symbols. */
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='0.13' stroke-width='4' stroke-linecap='round'%3E%3Cpath d='M18 10v20M8 20h20'/%3E%3Cpath d='M74 22h20'/%3E%3Cpath d='M42 70l14 14M56 70L42 84'/%3E%3Cpath d='M92 76h20M102 66v0M102 86v0'/%3E%3Ccircle cx='102' cy='67' r='1.5'/%3E%3Ccircle cx='102' cy='85' r='1.5'/%3E%3Cpath d='M10 100h16M10 108h16'/%3E%3C/g%3E%3C/svg%3E");
  --app-bg: var(--pattern), linear-gradient(150deg, var(--bg-1) 0%, var(--bg-2) 55%, var(--bg-3) 100%);
}

/* Samsung Internet darkens every page unless the page has its own dark style; this is ours: the game keeps its own colours. */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: only light;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--app-bg);
  background-attachment: fixed;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

#app {
  height: 100dvh;
}

/* ---- layout ------------------------------------------------------------ */

.app {
  height: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.screen {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

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

.topbar-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: clamp(22px, 5.5vw, 32px);
  font-weight: 800;
  line-height: 1.25;
  white-space: nowrap;
  text-overflow: ellipsis;
  /* Sits on the colourful background. */
  color: #fff;
  text-shadow: 0 3px 0 rgba(40, 20, 90, 0.28);
}

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

.icon-btn {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--card);
  box-shadow: var(--shadow);
}

.icon-btn svg {
  width: 26px;
  height: 26px;
}

.top-friends,
.hud-btn--people {
  position: relative;
}

.top-badge {
  position: absolute;
  top: -5px;
  inset-inline-end: -5px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #e04848;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  line-height: 22px;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
}

.top-badge[hidden] {
  display: none;
}

/* Friends blue, family yellow: the same colours as their names in the world. */
.person-text small.friend-tag {
  color: #2f7fe0;
}

.friend-tag svg {
  color: #2f7fe0 !important;
}

.person-text small.family-tag {
  color: #b07a00;
}

.family-tag svg {
  color: #e0a800 !important;
}

.people--one .person {
  padding: 12px;
}

.people-all {
  display: flex;
  margin: 12px auto 0;
}

.people-hint {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
  color: #5a3c26;
  font-weight: 700;
  line-height: 1.5;
}

.icon-btn[hidden] {
  display: none;
}

[dir='rtl'] .flip-rtl svg {
  transform: scaleX(-1);
}

.avatar-btn {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
  overflow: hidden;
  border: 3px solid var(--card);
  border-radius: 50%;
  background: linear-gradient(180deg, #bfe2ff, #eaf6ff);
  box-shadow: var(--shadow);
  color: var(--muted);
}

.avatar-btn svg {
  width: 100%;
  height: 100%;
}

.avatar-btn.is-current {
  border-color: var(--primary);
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 999px;
  padding: 6px 14px;
  background: var(--card);
  box-shadow: var(--shadow);
  font-weight: 700;
}

.lang-btn svg {
  width: 20px;
  height: 20px;
}

/* Narrow phones: the top bar has a few buttons, so the language button shows just the globe. */
@media (max-width: 440px) {
  .lang-btn {
    width: 44px;
    height: 44px;
    justify-content: center;
    padding: 0;
  }

  .lang-btn span {
    display: none;
  }

  .topbar-actions {
    gap: 6px;
  }
}

.creator {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---- stage ------------------------------------------------------------- */

.stage {
  position: relative;
  flex: 0 0 32%;
  min-height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.95) 0 28%, rgba(255, 255, 255, 0) 62%),
    linear-gradient(180deg, #bfe2ff, #eaf6ff);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.stage::after {
  content: '';
  position: absolute;
  bottom: 5%;
  left: 50%;
  width: min(34%, 170px);
  height: 14px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(43, 34, 48, 0.14);
}

.stage-char {
  position: relative;
  z-index: 1;
  height: 94%;
  aspect-ratio: 2 / 3;
}

.stage-char svg {
  display: block;
  width: 100%;
  height: 100%;
}

.stage-char.is-pop {
  animation: pop 0.32s ease;
}

.stage-actions {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.round-btn {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--primary);
}

.round-btn svg {
  width: 28px;
  height: 28px;
}

.round-btn:active {
  transform: scale(0.92) rotate(-12deg);
}

.round-btn:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
}

/* ---- panel ------------------------------------------------------------- */

.panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line);
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: 1 1 0;
  min-width: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.tab svg {
  width: 26px;
  height: 26px;
}

.tab.is-active {
  background: var(--primary-soft);
  color: var(--primary);
}

.tab-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 14px 18px;
}

.section {
  padding-top: 14px;
}

.section h2 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 800;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 8px;
}

.grid--wide {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 380px;
}

.tile {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 4px;
  border: 2.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--tile);
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.tile > svg {
  width: 100%;
  height: 100%;
}

.tile:active {
  transform: scale(0.95);
}

.tile.is-selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px rgba(91, 95, 230, 0.18);
}

.tile--tall {
  aspect-ratio: 3 / 4;
  padding-bottom: 26px;
}

.tile--portrait {
  aspect-ratio: 168 / 292;
}

.tile--none > svg:first-child {
  opacity: 0.3;
}

.tile-none {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.tile-none svg {
  width: 42%;
  height: 42%;
}

.tile-flag {
  position: absolute;
  top: 4px;
  inset-inline-start: 4px;
  width: 20px;
  height: 15px;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(43, 34, 48, 0.25);
  object-fit: cover;
}

.tile-label {
  position: absolute;
  bottom: 4px;
  inset-inline: 0;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
}

/* Colour rows head their section, above the option tiles. */
.colors {
  margin-bottom: 12px;
}

.colors-label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.swatch {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 2px solid rgba(43, 34, 48, 0.18);
  border-radius: 50%;
  background: var(--sw);
}

.swatch.is-selected {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.panel-footer {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
}

.name-input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  background: #fff;
  /* Follow the typed text's direction; the placeholder follows the page language. */
  unicode-bidi: plaintext;
  text-align: start;
}

.name-input:focus {
  outline: none;
  border-color: var(--primary);
}

.save-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 22px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--ok);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  box-shadow: 0 4px 0 var(--ok-dark);
}

.save-btn svg {
  width: 22px;
  height: 22px;
}

.save-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--ok-dark);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 10;
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 16px);
  transition: transform 0.25s ease, opacity 0.25s ease, visibility 0.25s;
  pointer-events: none;
}

.toast.is-on {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

/* ---- buttons & dialog --------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 800;
}

.btn svg {
  width: 22px;
  height: 22px;
}

.btn--primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 0 #4144b8;
}

.btn--primary:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #4144b8;
}

.btn--ghost {
  background: var(--tile);
  color: var(--ink);
}

.btn--big {
  min-height: 54px;
  padding: 0 28px;
  font-size: 18px;
}

.dialog {
  width: min(92vw, 400px);
  padding: 22px;
  border: 0;
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  font-family: var(--font);
  box-shadow: 0 20px 60px rgba(43, 34, 48, 0.3);
}

.dialog::backdrop {
  background: rgba(43, 34, 48, 0.45);
}

.dialog-msg {
  margin: 0 0 18px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.5;
}

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

.dialog-input {
  width: 100%;
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  unicode-bidi: plaintext;
  text-align: start;
}

.dialog-input:focus {
  outline: none;
  border-color: var(--primary);
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.icon-btn--soft {
  background: var(--tile);
  box-shadow: none;
  color: var(--muted);
}

.badge {
  flex: 0 0 auto;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

/* ---- main menu ---------------------------------------------------------- */

.home,
.worlds {
  flex: 1;
  min-height: 0;
  width: min(100%, 620px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  /* Room for card shadows so the scroll box doesn't clip them into hard edges. */
  padding: 8px 10px 20px;
  margin-top: -8px;
}

.home-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.home-avatar {
  width: 92px;
  height: 92px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 4px solid #fff;
  border-radius: 50%;
  background: linear-gradient(180deg, #bfe2ff, #eaf6ff);
  box-shadow: 0 0 0 2px var(--line);
}

.home-avatar svg {
  width: 100%;
  height: 100%;
}

.home-hello {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  font-weight: 700;
}

.home-name {
  margin: 0;
  font-size: clamp(24px, 6vw, 32px);
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

/* Cards sit side by side only when each gets at least 250px; otherwise they stack. */
.menu {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  gap: 12px;
}

.menu-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 96px;
  padding: 16px;
  border: 0;
  border-radius: var(--radius);
  color: #fff;
  text-align: start;
  box-shadow: var(--shadow), inset 0 -5px 0 rgba(0, 0, 0, 0.14);
  transition: transform 0.12s ease;
}

.menu-card:active {
  transform: scale(0.98) translateY(2px);
}

.menu-card--world {
  grid-column: 1 / -1;
  min-height: 132px;
  background: linear-gradient(135deg, #22b573, #13906f);
}

.menu-card--game {
  background: linear-gradient(135deg, #ffb020, #f08a3c);
}

.menu-card--teacher,
.menu-card--groups {
  background: linear-gradient(135deg, #8e5cc7, #5b5fe6);
}

.menu-card--online {
  background: linear-gradient(135deg, #3d7be0, #2a5bb8);
}

.menu-icon {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.2);
}

.menu-icon svg {
  width: 34px;
  height: 34px;
}

.menu-card--world .menu-icon {
  width: 72px;
  height: 72px;
}

.menu-card--world .menu-icon svg {
  width: 44px;
  height: 44px;
}

.menu-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.menu-title {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.25;
}

.menu-card--world .menu-title {
  font-size: 26px;
}

.menu-sub {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  opacity: 0.92;
}

.menu-go {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: #13906f;
}

.menu-go svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.menu-text .badge {
  align-self: flex-start;
  margin-top: 6px;
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* ---- worlds ------------------------------------------------------------- */

.online-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 4px 10px;
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  text-shadow: 0 2px 0 rgba(40, 20, 90, 0.28);
}

.online-title svg {
  width: 28px;
  height: 28px;
  color: #fff;
}

.menu-card--friend {
  background: linear-gradient(135deg, #2aa198, #1f7f8c);
}

.worlds-card {
  padding: 16px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.worlds-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.worlds-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
}

.world-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.world-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.world-play {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--tile);
  text-align: start;
}

.world-play:active {
  transform: scale(0.99);
}

.world-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ok);
  color: #fff;
}

.world-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.world-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.world-name {
  overflow: hidden;
  font-size: 18px;
  font-weight: 800;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.world-meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.worlds-empty {
  margin: 8px 0;
  padding: 22px 12px;
  border: 2px dashed var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

/* ---- in-world ----------------------------------------------------------- */

.app--immersive {
  max-width: none;
  padding: 0;
}

.app--immersive .topbar {
  display: none;
}

.game {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #6fb85a;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.game-canvas,
.game-touch {
  position: absolute;
  inset: 0;
}

.game-canvas canvas {
  display: block;
}

.game-hud {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  inset-inline-start: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.game-hud > * {
  pointer-events: auto;
}

.game-hud--end {
  inset-inline-start: auto;
  inset-inline-end: 12px;
}

/* Phones: the top-end buttons go two by two, so they never run into the world name. */
@media (max-width: 520px) {
  .game-hud--end {
    display: grid;
    grid-template-columns: repeat(2, auto);
    gap: 8px;
  }
}

/* The player's own things (character, crafting, bag) sit low on the screen, each with its word.
   They're on the end side; things centred at the bottom move over by --dock-side. */
.game {
  --dock-side: -1;
}

[dir='rtl'] .game {
  --dock-side: 1;
}

.game-dock {
  position: absolute;
  bottom: calc(14px + env(safe-area-inset-bottom));
  inset-inline-end: 12px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.game.is-building .game-dock {
  display: none;
}

.dock-btn {
  width: 72px;
  height: auto;
  gap: 1px;
  padding: 6px 2px 4px;
}

.dock-btn span {
  font-size: 12px;
  font-weight: 800;
  line-height: 1.15;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

/* Wooden game buttons. */
.hud-btn {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 3px solid var(--wood-dark);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--wood-light), var(--wood));
  box-shadow: 0 4px 0 var(--wood-dark), 0 8px 16px rgba(0, 0, 0, 0.2);
  color: #fff8e8;
}

.hud-btn svg {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.35));
}

.hud-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--wood-dark), 0 4px 10px rgba(0, 0, 0, 0.2);
}

.hud-chip {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 14px;
  border: 3px solid var(--wood-dark);
  border-radius: 16px;
  background: var(--parchment);
  box-shadow: 0 4px 0 var(--wood-dark);
  line-height: 1.2;
}

.hud-chip-name {
  font-weight: 800;
}

.hud-clock {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #7a5236;
  font-size: 13px;
  font-weight: 800;
  direction: ltr;
}

.hud-clock svg {
  width: 16px;
  height: 16px;
  color: #f0a020;
}

.hud-clock[data-night='true'] svg {
  color: #5b5fe6;
}

.hud-clock small {
  font-size: 12px;
  font-weight: 700;
  opacity: 0.8;
}

.hud-hour {
  display: none;
}

/* Small screens: no room for the world name next to the buttons, so the day sits over just the hour. */
@media (max-width: 440px) {
  .hud-chip {
    padding: 4px 10px;
  }

  .hud-chip-name,
  .hud-time {
    display: none;
  }

  .hud-clock {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0 5px;
    max-width: 64px;
  }

  .hud-clock small {
    order: -1;
    width: 100%;
    text-align: center;
    direction: rtl;
  }

  :root[dir='ltr'] .hud-clock small {
    direction: ltr;
  }

  .hud-hour {
    display: inline;
    font-size: 17px;
    line-height: 1.1;
  }

  .hud-clock svg {
    width: 20px;
    height: 20px;
  }
}

/* Health, stamina, food and water under the world name. */
.status {
  position: absolute;
  top: calc(76px + env(safe-area-inset-top));
  inset-inline-start: 12px;
  display: grid;
  gap: 5px;
  width: min(42vw, 190px);
  padding: 8px 10px;
  border: 3px solid var(--wood-dark);
  border-radius: 14px;
  background: rgba(247, 230, 194, 0.94);
  box-shadow: 0 4px 0 var(--wood-dark);
  pointer-events: none;
}

.stat {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
}

.stat-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  stroke: none;
}

.stat-bar {
  flex: 1;
  height: 10px;
  overflow: hidden;
  border: 2px solid #7a5236;
  border-radius: 999px;
  background: #e2c690;
}

.stat-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width 0.15s linear;
}

.stat--stamina { color: #e0a020; }
.stat--stamina .stat-bar span { background: linear-gradient(90deg, #ffd54d, #f0a020); }
.stat--hunger { color: #b8642e; }
.stat--hunger .stat-bar span { background: linear-gradient(90deg, #f0a060, #c8743a); }
.stat--thirst { color: #3d8ee0; }
.stat--thirst .stat-bar span { background: linear-gradient(90deg, #7fd0f5, #3d8ee0); }

.stat.is-low .stat-icon {
  animation: pulse-low 0.8s ease-in-out infinite;
}

@keyframes pulse-low {
  50% {
    transform: scale(1.3);
  }
}

/* A bar running low glows softly red. */
.stat.is-low .stat-bar {
  border-color: #c0392b;
  animation: low-glow 1.8s ease-in-out infinite;
}

@keyframes low-glow {
  0%,
  100% {
    box-shadow: 0 0 2px 0 rgba(224, 72, 72, 0.35);
  }
  50% {
    box-shadow: 0 0 9px 2px rgba(224, 72, 72, 0.75);
  }
}

@media (prefers-reduced-motion: reduce) {
  .stat.is-low .stat-bar {
    animation: none;
    box-shadow: 0 0 6px 1px rgba(224, 72, 72, 0.6);
  }
}

/* Red edge flash when hurt. */
.hurt-flash {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  box-shadow: inset 0 0 90px 30px rgba(224, 40, 40, 0.75);
}

.hurt-flash.is-on {
  animation: hurt 0.45s ease-out;
}

@keyframes hurt {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.death {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  background: rgba(30, 20, 50, 0.55);
  pointer-events: none;
  animation: fade-in 0.3s ease;
}

.death[hidden] {
  display: none;
}

.death-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 18px 26px;
  border: 5px solid var(--wood-dark);
  border-radius: 22px;
  background: var(--parchment);
  text-align: center;
  animation: panel-in 0.3s ease;
}

.death-card strong {
  font-size: 28px;
  font-weight: 800;
}

.death-card span {
  color: #7a5236;
  font-weight: 700;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.game-hint {
  position: absolute;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  width: max-content;
  max-width: calc(100% - 180px);
  margin: 0;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(43, 34, 48, 0.8);
  color: #fff;
  font-weight: 700;
  text-align: center;
  transform: translateX(-50%);
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.game-hint.is-hidden {
  opacity: 0;
}

.joystick {
  position: absolute;
  width: 120px;
  height: 120px;
  margin: -60px 0 0 -60px;
  border: 3px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

.joystick[hidden] {
  display: none;
}

.joystick-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.game-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--app-bg);
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
  transition: opacity 0.35s ease;
}

.game-loading.is-done {
  opacity: 0;
  pointer-events: none;
}

/* Picked-up items float in at the top. */
.loot {
  position: absolute;
  top: calc(84px + env(safe-area-inset-top));
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transform: translateX(-50%);
  pointer-events: none;
}

.loot-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px 5px 8px;
  border: 3px solid var(--wood-dark);
  border-radius: 999px;
  background: var(--parchment);
  font-weight: 800;
  animation: loot 1.4s ease forwards;
}

.loot-item svg {
  width: 26px;
  height: 26px;
}

@keyframes loot {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.9);
  }
  15%,
  70% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-16px);
  }
}

/* ---- build mode: the bar at the bottom ---- */

.build-bar {
  position: absolute;
  bottom: calc(16px + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 6;
  width: min(calc(100% - 24px), 480px);
  padding: 10px 12px 12px;
  border: 4px solid rgba(107, 63, 31, 0.9);
  border-radius: 20px;
  background: rgba(247, 230, 194, 0.9);
  box-shadow: 0 6px 0 rgba(107, 63, 31, 0.8), 0 14px 30px rgba(0, 0, 0, 0.3);
  transform: translateX(-50%);
}

.build-bar[hidden] {
  display: none;
}

.build-msg {
  margin: 0 0 8px;
  color: #5a3c26;
  font-weight: 800;
  text-align: center;
}

.build-msg.is-bad {
  color: #c0392b;
}

.build-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.build-cost {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.build-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px 3px 4px;
  border-radius: 999px;
  background: rgba(122, 82, 54, 0.14);
  color: #5a3c26;
  font-weight: 800;
  direction: ltr;
}

.build-chip svg {
  width: 26px;
  height: 26px;
}

.build-chip.is-short {
  background: rgba(224, 72, 72, 0.16);
  color: #c0392b;
}

.build-cancel,
.build-ok {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 12px;
  font: inherit;
  font-weight: 800;
}

.build-cancel {
  border: 3px solid #b59a78;
  background: #efe0c2;
  color: #7a5236;
}

.build-ok {
  border: 3px solid #189a5f;
  background: var(--ok);
  color: #fff;
  box-shadow: 0 3px 0 #127a4b;
}

.build-ok svg,
.craft-btn svg {
  width: 20px;
  height: 20px;
}

.build-ok:disabled {
  border-color: #b59a78;
  background: #d8c39f;
  color: #7a5236;
  box-shadow: none;
}

.game.is-building .game-hint {
  display: none;
}

.game.is-building .alerts {
  bottom: calc(150px + env(safe-area-inset-bottom));
}

/* ---- warnings (hungry, thirsty, low health...) ---- */

.alerts {
  position: absolute;
  bottom: max(calc(92px + env(safe-area-inset-bottom)), calc(var(--low, 0px) + 12px));
  left: 50%;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100% - 180px);
  transform: translateX(-50%);
  pointer-events: none;
}

/* A toast inside the game's notice column, stacked with the warnings. */
.toast-note {
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  animation: toast-in 0.25s ease;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast-note.is-out {
  opacity: 0;
  transform: translateY(-8px);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.92);
  }
}

.alert {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 8px 12px;
  border: 3px solid #fff;
  border-radius: 18px;
  background: #f0a020;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
  box-shadow: 0 5px 0 rgba(120, 70, 10, 0.45), 0 10px 24px rgba(0, 0, 0, 0.25);
  animation: alert 3.5s ease forwards;
}

.alert svg {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.alert--danger {
  background: #e04848;
  box-shadow: 0 5px 0 rgba(130, 20, 20, 0.5), 0 10px 24px rgba(0, 0, 0, 0.25);
}

.alert--poison {
  background: #3fae4a;
  box-shadow: 0 5px 0 rgba(20, 90, 30, 0.5), 0 10px 24px rgba(0, 0, 0, 0.25);
}

@keyframes alert {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.9);
  }
  8%,
  85% {
    opacity: 1;
    transform: none;
  }
  100% {
    opacity: 0;
    transform: translateY(-8px);
  }
}

/* ---- level up ---- */

/* Above open panels, so gear made in a panel still gets its banner. */
.levelups {
  position: absolute;
  z-index: 6;
  top: 30%;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  transform: translateX(-50%);
  pointer-events: none;
}

.levelup {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  width: max-content;
  max-width: 90vw;
  padding: 14px 22px 14px 16px;
  border: 4px solid #fff;
  border-radius: 24px;
  background: linear-gradient(135deg, #ffb020, #f0603c);
  color: #fff;
  box-shadow: 0 10px 0 rgba(150, 60, 20, 0.55), 0 18px 40px rgba(0, 0, 0, 0.3);
  /* --delay staggers level-ups that land together. */
  animation: levelup 3.2s cubic-bezier(0.2, 1.4, 0.4, 1) var(--delay, 0s) both;
}

.levelup--hunting {
  background: linear-gradient(135deg, #ff7a59, #d6336c);
  box-shadow: 0 10px 0 rgba(140, 30, 60, 0.55), 0 18px 40px rgba(0, 0, 0, 0.3);
}

.levelup--building {
  background: linear-gradient(135deg, #d08a4a, #8f5426);
  box-shadow: 0 10px 0 rgba(90, 50, 20, 0.55), 0 18px 40px rgba(0, 0, 0, 0.3);
}

.levelup--crafting {
  background: linear-gradient(135deg, #7d8bd6, #4b5bb8);
  box-shadow: 0 10px 0 rgba(40, 50, 120, 0.55), 0 18px 40px rgba(0, 0, 0, 0.3);
}

.perk-card--crafting .perk-icon {
  background: linear-gradient(135deg, #7d8bd6, #4b5bb8);
}

.levelup--cooking {
  background: linear-gradient(135deg, #f2a33a, #c2452d);
  box-shadow: 0 10px 0 rgba(120, 40, 20, 0.55), 0 18px 40px rgba(0, 0, 0, 0.3);
}

.levelup--exploration {
  background: linear-gradient(135deg, #2aa198, #3d7be0);
  box-shadow: 0 10px 0 rgba(20, 70, 120, 0.55), 0 18px 40px rgba(0, 0, 0, 0.3);
}

/* Several at once: smaller cards of one width, neatly stacked. */
.levelups:has(.levelup + .levelup) {
  gap: 12px;
}

.levelups:has(.levelup + .levelup) .levelup {
  width: min(320px, 86vw);
  gap: 12px;
  padding: 9px 16px 9px 10px;
  border-width: 3px;
  border-radius: 20px;
}

.levelups:has(.levelup + .levelup) .levelup-icon {
  width: 46px;
  height: 46px;
}

.levelups:has(.levelup + .levelup) .levelup-icon svg {
  width: 28px;
  height: 28px;
}

.levelups:has(.levelup + .levelup) .levelup-text strong {
  font-size: 20px;
}

.levelups:has(.levelup + .levelup) .levelup-text span {
  font-size: 15px;
}

.levelups:has(.levelup + .levelup) .levelup-text small {
  font-size: 12px;
}

.levelup-icon {
  width: 60px;
  height: 60px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  animation: spin-pop 0.9s ease var(--delay, 0s) both;
}

.levelup-icon svg {
  width: 36px;
  height: 36px;
}

.levelup-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.levelup-text strong {
  font-size: 28px;
  font-weight: 800;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
}

.levelup-text span {
  font-size: 18px;
  font-weight: 800;
}

.levelup-text small {
  font-size: 14px;
  font-weight: 700;
  opacity: 0.92;
}

.levelup-burst {
  position: absolute;
  top: 50%;
  left: 50%;
}

.levelup-burst i {
  position: absolute;
  width: 10px;
  height: 14px;
  border-radius: 3px;
  background: hsl(var(--h) 90% 60%);
  transform: rotate(var(--a)) translateY(0);
  animation: confetti 1.1s ease-out var(--delay, 0s) both;
}

/* A newly made piece of gear: the banner takes its tier's colour. */
.gearup {
  background: linear-gradient(135deg, color-mix(in srgb, var(--tier) 70%, #fff), var(--tier));
  box-shadow: 0 10px 0 color-mix(in srgb, var(--tier) 65%, #000), 0 18px 40px rgba(0, 0, 0, 0.3);
}

.gearup-icon {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
}

.gearup-icon svg {
  width: 48px;
  height: 48px;
}

.gearup--t3 .gearup-icon,
.gearup--t4 .gearup-icon {
  animation: spin-pop 0.9s ease both, tier-glow 1.6s ease-in-out 0.9s infinite;
}

@keyframes confetti {
  to {
    transform: rotate(var(--a)) translateY(calc(var(--d) * -1.6)) rotate(200deg);
    opacity: 0;
  }
}

@keyframes levelup {
  0% {
    opacity: 0;
    transform: scale(0.4) translateY(30px);
  }
  12% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  85% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
}

@keyframes spin-pop {
  0% {
    transform: scale(0) rotate(-180deg);
  }
  100% {
    transform: scale(1) rotate(0);
  }
}

/* ---- wooden panels (inventory, skills) ---- */

/* Panels are see-through so the world stays visible behind them. */
.panel-wrap {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(30, 20, 40, 0.1);
}

.panel-wrap[hidden] {
  display: none;
}

.wood-panel {
  width: min(100%, 540px);
  max-height: 100%;
  overflow-y: auto;
  padding: 14px 16px 18px;
  border: 6px solid rgba(107, 63, 31, 0.85);
  border-radius: 24px;
  background:
    repeating-linear-gradient(0deg, rgba(122, 82, 54, 0.05) 0 2px, transparent 2px 14px),
    rgba(247, 230, 194, 0.74);
  box-shadow: inset 0 0 0 3px rgba(192, 128, 72, 0.8), 0 10px 0 rgba(107, 63, 31, 0.85), 0 24px 60px rgba(0, 0, 0, 0.3);
  animation: panel-in 0.22s ease;
}

.wood-panel--wide {
  width: min(100%, 680px);
}

/* Thin rounded wooden scrollbar inside panels. */
.wood-panel {
  scrollbar-width: thin;
  scrollbar-color: rgba(107, 63, 31, 0.55) transparent;
}

.wood-panel::-webkit-scrollbar {
  width: 10px;
}

.wood-panel::-webkit-scrollbar-track {
  margin: 18px 0;
  background: transparent;
}

.wood-panel::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: rgba(107, 63, 31, 0.5) padding-box;
}

/* A titled section inside a panel (Equipment, Skills), with a line running after the title. */
.wood-section {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 22px 2px 12px;
  color: #7a5236;
  font-size: 18px;
  font-weight: 800;
  scroll-margin-top: 10px;
}

.wood-head + .wood-section {
  margin-top: 4px;
}

.wood-section svg {
  width: 22px;
  height: 22px;
}

.wood-section::after {
  content: '';
  flex: 1;
  height: 2px;
  border-radius: 2px;
  background: rgba(122, 82, 54, 0.25);
}

/* Crafting: one card per thing you can make. */
.craft-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.craft-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 3px solid #c49a62;
  border-radius: 16px;
  background: rgba(244, 227, 189, 0.65);
}

.craft-icon {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--wood-light), var(--wood));
  color: #fff;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.15);
}

.craft-icon svg {
  width: 32px;
  height: 32px;
}

.craft-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.craft-text strong {
  font-size: 18px;
  font-weight: 800;
}

.craft-text > span {
  color: #8a6a4a;
  font-size: 13px;
  font-weight: 700;
}

.craft-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 3px solid #189a5f;
  border-radius: 12px;
  background: var(--ok);
  color: #fff;
  font: inherit;
  font-weight: 800;
  box-shadow: 0 3px 0 #127a4b;
}

.craft-list .wood-section {
  margin: 12px 2px 0;
}

.craft-icon--item {
  border: 3px solid #c49a62;
  background: rgba(234, 211, 162, 0.8);
  box-shadow: none;
}

.craft-icon--item svg {
  width: 44px;
  height: 44px;
}

.craft-cost {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.craft-cost .build-chip {
  padding: 2px 8px 2px 3px;
  font-size: 14px;
}

.craft-cost .build-chip svg {
  width: 22px;
  height: 22px;
}

.craft-btn:disabled {
  border-color: #b59a78;
  background: #d8c39f;
  color: #7a5236;
  box-shadow: none;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
}

/* Stays at the top while the panel scrolls, so the close button is always there. */
.wood-head {
  position: sticky;
  top: -14px; /* the panel's top padding: nothing peeks out above it */
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -2px -4px 14px;
  padding: 8px 10px 8px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--wood-light), var(--wood));
  color: #fff8e8;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18);
}

.wood-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}

.wood-head h2 svg {
  width: 28px;
  height: 28px;
}

.wood-close {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff8e8;
}

.wood-close svg {
  width: 22px;
  height: 22px;
}

/* Slots keep a comfortable size: six a row on wide screens, four on mid-size, three on phones. */
.inv-grid,
.gear-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(107, 63, 31, 0.55) transparent;
}

@media (max-width: 600px) {
  .inv-grid,
  .gear-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 430px) {
  .inv-grid,
  .gear-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .panel-wrap {
    padding: 10px;
  }
}

/* The bag scrolls its slots inside; the item name and Eat button below always stay in view. */
.wood-panel--inv {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.wood-panel--inv .inv-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 3px;
}

.wood-panel--inv .wood-head,
.wood-panel--inv .inv-info {
  flex: 0 0 auto;
}

.inv-slot {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 8px;
  border: 3px solid #c49a62;
  border-radius: 14px;
  background: rgba(234, 211, 162, 0.7);
  box-shadow: inset 0 3px 0 rgba(122, 82, 54, 0.18);
}

.inv-slot svg {
  width: 100%;
  height: 100%;
}

.inv-slot--empty {
  border-style: dashed;
  background: rgba(234, 211, 162, 0.25);
  box-shadow: none;
}

.inv-count {
  position: absolute;
  bottom: 2px;
  inset-inline-end: 7px;
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  text-shadow: 0 0 2px #5a3c26, 0 1px 0 #5a3c26, 1px 0 0 #5a3c26, -1px 0 0 #5a3c26;
}

.inv-slot.is-selected {
  border-color: #ffb020;
  box-shadow: 0 0 0 3px rgba(255, 176, 32, 0.45);
}

.inv-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  margin-top: 10px;
}

.inv-name {
  margin: 0;
  color: #7a5236;
  font-weight: 800;
  text-align: center;
}

.eat-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border: 3px solid #189a5f;
  border-radius: 12px;
  background: var(--ok);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 3px 0 #127a4b;
}

.eat-btn[hidden] {
  display: none;
}

/* Putting something from the bag down on the ground. */
.craft-btn--danger {
  background: linear-gradient(180deg, #e8685e, #c8443a);
  border-color: #8f2a22;
  box-shadow: 0 3px 0 #8f2a22;
}

/* A chest: how much a tap moves, then the chest's slots and the bag's, each with quick buttons. */
.chest-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  margin-bottom: 10px;
}

.chest-use {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #7a5236;
  font-weight: 800;
  cursor: pointer;
}

.chest-mode {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #7a5236;
  font-weight: 800;
}

.chest-mode-btn {
  padding: 6px 14px;
  border: 3px solid var(--wood-dark);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  color: #5a3c26;
  font: inherit;
  font-weight: 800;
}

.chest-mode-btn.is-on {
  background: var(--wood);
  color: #fff8e8;
}

/* A chest's or the bag's heading: what it is and how full, with its buttons on the same row. */
.pack-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
  margin: 14px 2px 8px;
}

.pack-head h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: #7a5236;
  font-size: 17px;
  font-weight: 800;
}

.pack-head h3 svg {
  width: 22px;
  height: 22px;
}

.pack-head small,
.pack-count {
  color: #a07850;
  font-size: 14px;
  font-weight: 800;
}

.pack-acts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pack-acts .drop-btn,
.pack-sort {
  padding: 4px 10px;
  font-size: 14px;
}

.wood-head .pack-sort {
  margin-inline-end: 8px;
  margin-inline-start: auto;
}

.chest-acts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 10px 0 4px;
}

.drop-btn:disabled {
  opacity: 0.5;
}

.drop-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 3px solid var(--wood-dark);
  border-radius: 12px;
  background: var(--parchment);
  color: #5a3c26;
  font-weight: 800;
  box-shadow: 0 3px 0 var(--wood-dark);
}

.drop-btn[hidden] {
  display: none;
}

.drop-btn svg {
  width: 20px;
  height: 20px;
}

.eat-btn svg {
  width: 20px;
  height: 20px;
}

/* Equipment: the character in the middle, armour slots down both sides, weapons below. */
.doll {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
}

.doll-side {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.doll-figure {
  position: relative;
  display: grid;
  place-items: end center;
  min-height: 250px;
  border-radius: 20px;
  background: radial-gradient(ellipse at 50% 45%, rgba(255, 250, 232, 0.85), rgba(255, 250, 232, 0) 70%);
}

/* The floor the character stands on. */
.doll-figure::after {
  content: '';
  position: absolute;
  bottom: 12px;
  left: 50%;
  width: 62%;
  height: 16px;
  border-radius: 50%;
  background: rgba(90, 60, 38, 0.2);
  transform: translateX(-50%);
}

.doll-figure img {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 180px;
  height: auto;
  margin-bottom: 16px;
}

.gear-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
}

.gear-box {
  position: relative;
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border: 3px solid #c49a62;
  border-radius: 16px;
  background: rgba(234, 211, 162, 0.7);
  box-shadow: inset 0 3px 0 rgba(122, 82, 54, 0.18);
}

.gear-slot.is-empty .gear-box {
  border-style: dashed;
  background: rgba(234, 211, 162, 0.3);
  box-shadow: none;
}

.gear-box svg {
  width: 34px;
  height: 34px;
  color: #a07a52;
  opacity: 0.55;
}

.gear-slot {
  cursor: pointer;
}

/* Gear being worn shows its own picture, full colour. */
.gear-slot:not(.is-empty) .gear-box svg {
  width: 46px;
  height: 46px;
  opacity: 1;
}

/* The slot whose spare gear is listed below. */
.gear-slot.is-picked .gear-box {
  border: 3px solid #ffb020;
  background: rgba(255, 236, 190, 0.85);
  box-shadow: 0 0 0 3px rgba(255, 176, 32, 0.4);
}

.gear-slot.is-picked.is-empty .gear-box svg {
  color: #c07a2a;
  opacity: 0.9;
}

.gear-label {
  color: #7a5236;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

@media (max-width: 400px) {
  .gear-box {
    width: 58px;
    height: 58px;
  }

  .gear-box svg {
    width: 30px;
    height: 30px;
  }

  .doll-figure {
    min-height: 220px;
  }
}

/* Weapons under the character's feet, tools in a row below them. */
.doll-row {
  display: flex;
  justify-content: center;
  gap: 22px;
  margin-top: 12px;
}

.doll-row--tools {
  gap: 16px;
  padding-top: 14px;
  border-top: 2px dashed rgba(122, 82, 54, 0.3);
}

.doll-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  margin-top: 14px;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(234, 211, 162, 0.45);
  color: #7a5236;
  font-size: 14px;
  font-weight: 800;
}

.doll-prot,
.armor-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.doll-prot svg {
  width: 20px;
  height: 20px;
}

.armor-toggle {
  cursor: pointer;
}

.armor-toggle input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: #22b573;
}

/* Spare gear for the picked slot: starts as one row and grows, scrolling after a few. */
/* The picked slot's panel: same orange as the picked slot, with a notch pointing up at the slots. */
.gear-pick {
  position: relative;
  margin-top: 18px;
  padding: 10px;
  border: 3px solid #ffb020;
  border-radius: 16px;
  background: #f4e3bd;
  box-shadow: 0 0 0 3px rgba(255, 176, 32, 0.25);
}

.gear-pick-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
  margin-bottom: 8px;
  color: #5a3c26;
}

.gear-pick::before {
  content: '';
  position: absolute;
  top: -11px;
  left: 50%;
  width: 18px;
  height: 18px;
  border-top: 3px solid #ffb020;
  border-left: 3px solid #ffb020;
  background: #f4e3bd;
  transform: translateX(-50%) rotate(45deg);
}

.gear-pick-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #ffb020;
  color: #fff;
}

.gear-pick-icon svg {
  width: 22px;
  height: 22px;
}

.gear-pick-head p {
  flex: 1;
  margin: 0;
  font-weight: 700;
}

.gear-pick-head small {
  color: #8a6a4a;
  font-size: 13px;
}

.takeoff-btn {
  flex: 0 0 auto;
  padding: 5px 14px;
  border: 3px solid #b59a78;
  border-radius: 12px;
  background: #efe0c2;
  color: #7a5236;
  font: inherit;
  font-weight: 800;
}

.gear-grid {
  max-height: 250px;
  overflow-y: auto;
  padding: 3px;
}

.gear-hint {
  margin: 8px 0 0;
  color: #8a6a4a;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

/* ---- beginner guide: one step at a time, low in the middle of the screen ---- */
.guide {
  position: absolute;
  bottom: calc(22px + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: calc(100% - 180px);
  padding: 8px 8px 8px 12px;
  border: 3px solid var(--wood-dark);
  border-radius: 18px;
  background: rgba(247, 230, 194, 0.96);
  box-shadow: 0 5px 0 var(--wood-dark), 0 10px 22px rgba(0, 0, 0, 0.22);
  color: #5a3c26;
  font-weight: 800;
  transform: translateX(-50%);
  pointer-events: none;
}

.guide[hidden] {
  display: none;
}

.guide.is-new {
  animation: guide-in 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
}

@keyframes guide-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(16px) scale(0.92);
  }
}

.guide.is-nudge {
  animation: guide-nudge 0.5s ease;
}

@keyframes guide-nudge {
  25% {
    transform: translateX(-50%) scale(1.06);
  }
  50% {
    transform: translateX(calc(-50% - 6px));
  }
  75% {
    transform: translateX(calc(-50% + 6px));
  }
}

.guide-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(234, 211, 162, 0.9);
  color: #7a5236;
}

.guide-icon {
  position: relative;
}

.guide-icon svg {
  width: 30px;
  height: 30px;
}

/* Which step this is, as a little badge on the icon. */
.guide-count {
  position: absolute;
  bottom: -7px;
  inset-inline-end: -8px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--wood);
  color: #fff8e8;
  font-size: 11px;
  line-height: 17px;
  direction: ltr;
}

.guide-text {
  flex: 1 1 auto;
  min-width: 0;
}

/* A step just done: green, with a tick. */
.guide.is-done {
  border-color: #127a4b;
  background: rgba(214, 245, 226, 0.97);
  box-shadow: 0 5px 0 #127a4b, 0 10px 22px rgba(0, 0, 0, 0.22);
  color: #127a4b;
}

.guide.is-done .guide-icon {
  background: var(--ok);
  color: #fff;
  animation: spin-pop 0.6s ease both;
}

.guide.is-done .guide-skip {
  visibility: hidden;
}

.guide-btn {
  flex: 0 0 auto;
  padding: 6px 14px;
  border: 3px solid #b59a78;
  border-radius: 12px;
  background: #efe0c2;
  color: #7a5236;
  font: inherit;
  font-weight: 800;
  pointer-events: auto;
}

.guide-btn--hide {
  border-color: #b5543a;
  background: #e06a4a;
  color: #fff;
}

.guide.is-asking {
  padding: 8px 10px 8px 14px;
}

/* The button inside a panel the guide wants pressed. */
.is-coach-btn {
  animation: coach 1.2s ease-in-out infinite;
}

/* On phones the text gets the room; the count chips sit under it. */
@media (max-width: 430px) {
  .guide,
  .guide--tip {
    flex-wrap: wrap;
    left: calc(50% + var(--dock-side) * 45px);
    width: calc(100% - 114px);
    max-width: none;
  }

  .guide-text {
    flex-basis: calc(100% - 100px);
  }

  .guide-need {
    order: 3;
    width: 100%;
    justify-content: center;
  }
}

.guide-text {
  line-height: 1.3;
}

.guide-need {
  display: flex;
  gap: 4px;
}

.guide-need:empty {
  display: none;
}

.guide-need .build-chip {
  padding: 2px 8px 2px 3px;
  font-size: 14px;
}

.guide-need .build-chip svg {
  width: 22px;
  height: 22px;
}

.build-chip.is-done {
  background: rgba(34, 181, 115, 0.18);
  color: #127a4b;
}

.guide-skip {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: rgba(122, 82, 54, 0.12);
  color: #7a5236;
  pointer-events: auto;
}

.guide-skip svg {
  width: 16px;
  height: 16px;
}

/* The HUD button the guide is pointing at. */
.hud-btn.is-coach {
  animation: coach 1.2s ease-in-out infinite;
}

@keyframes coach {
  50% {
    box-shadow: 0 0 0 4px #ffb020, 0 0 18px 6px rgba(255, 176, 32, 0.6);
    transform: scale(1.08);
  }
}

/* ---- unique skills -------------------------------------------------------- */

.perk-btns {
  position: absolute;
  inset-inline-end: 16px;
  bottom: calc(256px + env(safe-area-inset-bottom));
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.perk-btn {
  position: relative;
  width: 58px;
  height: 58px;
}

.perk-btn svg {
  width: 32px;
  height: 32px;
}

.perk-btn.is-on {
  background: #8fe36b;
  box-shadow: 0 0 0 3px #fff, 0 0 18px 4px rgba(143, 227, 107, 0.8);
  animation: coach 1.4s ease-in-out infinite;
}

.perk-btn--exploration.is-on {
  background: #6fc3f0;
  box-shadow: 0 0 0 3px #fff, 0 0 18px 4px rgba(61, 123, 224, 0.75);
}

.perk-card--exploration .perk-icon {
  background: linear-gradient(135deg, #2aa198, #3d7be0);
}

.perk-btn--building.is-on {
  background: #e8b877;
  box-shadow: 0 0 0 3px #fff, 0 0 18px 4px rgba(208, 138, 74, 0.8);
}

.perk-card--building .perk-icon {
  background: linear-gradient(135deg, #d08a4a, #8f5426);
}

/* Moving a house: the bar stays, the move button can still be pressed to cancel. */
.game.is-building .perk-btns:has(.perk-btn--building.is-on) {
  display: flex;
}

.game.is-building .perk-btns:has(.perk-btn--building.is-on) .perk-btn:not(.perk-btn--building) {
  display: none;
}

.perk-btn--hunting.is-on {
  background: #ff8a6a;
  box-shadow: 0 0 0 3px #fff, 0 0 18px 4px rgba(255, 106, 80, 0.8);
}

.perk-count {
  position: absolute;
  top: -6px;
  inset-inline-end: -6px;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: #d6336c;
  color: #fff;
  font-size: 14px;
  line-height: 24px;
}

.game.is-picking .perk-btns,
.game.is-building .perk-btns {
  display: none;
}

.area-bar {
  pointer-events: none;
}

/* The unlock card: stays until OK, so there's time to read it. */
.perk-pop {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(20, 12, 40, 0.55);
  animation: fade-in 0.3s ease;
}

.perk-card {
  position: relative;
  width: min(380px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 20px 20px;
  border-radius: 26px;
  background: linear-gradient(160deg, #fff7e0, #ffe2a8);
  box-shadow: 0 12px 0 rgba(120, 70, 10, 0.45), 0 24px 60px rgba(0, 0, 0, 0.4);
  color: #4a2f12;
  text-align: center;
  animation: levelup-in 0.6s cubic-bezier(0.2, 1.4, 0.4, 1);
}

@keyframes levelup-in {
  from {
    opacity: 0;
    transform: scale(0.6) rotate(-4deg);
  }
}

.perk-kicker {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffb020, #f0603c);
  color: #fff;
  font-weight: 800;
}

.perk-kicker svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.perk-icon {
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  margin-top: 6px;
  border-radius: 28px;
  background: linear-gradient(135deg, #8fe36b, #22b573);
  color: #fff;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.15), 0 0 0 6px rgba(255, 255, 255, 0.7);
  animation: perk-glow 1.6s ease-in-out infinite;
}

.perk-card--hunting .perk-icon {
  background: linear-gradient(135deg, #ff7a59, #d6336c);
}

.perk-card--cooking .perk-icon {
  background: linear-gradient(135deg, #f2a33a, #c2452d);
}

@keyframes perk-glow {
  50% {
    box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.15), 0 0 0 6px rgba(255, 255, 255, 0.7), 0 0 30px 10px rgba(255, 200, 80, 0.7);
  }
}

.perk-icon svg {
  width: 56px;
  height: 56px;
}

.perk-name {
  font-size: 26px;
  line-height: 1.2;
}

.perk-from {
  color: #8a6a3a;
  font-weight: 700;
}

.perk-desc {
  margin: 4px 0 10px;
  font-weight: 700;
  line-height: 1.55;
}

/* In the skills list, once unlocked. */
.skill-perk {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 8px;
  align-items: center;
  margin: 8px 0 0;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 196, 80, 0.25);
  font-size: 13px;
  line-height: 1.4;
}

.skill-perk svg {
  width: 22px;
  height: 22px;
  grid-row: span 2;
  color: #c27a10;
}

/* A tip waits for "Got it", so it gets a wider card. */
.guide--tip {
  max-width: min(calc(100% - 180px), 560px);
  pointer-events: auto;
}

.game.is-building .guide {
  display: none;
}

.guide-done {
  background: linear-gradient(135deg, #22b573, #1d8fb0);
  box-shadow: 0 10px 0 rgba(20, 90, 70, 0.55), 0 18px 40px rgba(0, 0, 0, 0.3);
}

/* ---- gear tiers: the frame takes the tier's colour (--tier); Epic and up shine, Legendary glows ---- */
.gear-slot[data-tier] .gear-box,
.inv-slot--gear[data-tier],
.craft-card--gear[data-tier] .craft-icon {
  position: relative;
  overflow: hidden;
  border: 3px solid var(--tier);
  background: color-mix(in srgb, var(--tier) 20%, rgba(250, 238, 210, 0.92));
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--tier) 30%, transparent);
}

.gear-slot.is-picked[data-tier] .gear-box {
  box-shadow: 0 0 0 3px rgba(255, 176, 32, 0.6), inset 0 0 0 2px color-mix(in srgb, var(--tier) 30%, transparent);
}

.gear-slot:is([data-tier='3'], [data-tier='4'], [data-tier='5'], [data-tier='6']) .gear-box::after,
.inv-slot--gear:is([data-tier='3'], [data-tier='4'], [data-tier='5'], [data-tier='6'])::after,
.craft-card--gear:is([data-tier='3'], [data-tier='4'], [data-tier='5'], [data-tier='6']) .craft-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.7) 50%, transparent 65%) no-repeat;
  background-size: 250% 100%;
  animation: tier-shine 2.6s ease-in-out infinite;
  pointer-events: none;
}

.gear-slot:is([data-tier='4'], [data-tier='5'], [data-tier='6']) .gear-box,
.inv-slot--gear:is([data-tier='4'], [data-tier='5'], [data-tier='6']),
.craft-card--gear:is([data-tier='4'], [data-tier='5'], [data-tier='6']) .craft-icon {
  animation: tier-glow 1.8s ease-in-out infinite;
}

@keyframes tier-shine {
  0% {
    background-position: 150% 0;
  }
  60%,
  100% {
    background-position: -100% 0;
  }
}

@keyframes tier-glow {
  50% {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--tier) 55%, transparent), 0 0 18px 4px color-mix(in srgb, var(--tier) 50%, transparent);
  }
}

.tier-name {
  color: color-mix(in srgb, var(--tier, #5a3c26) 75%, #2b1d10);
}

.tier-tag {
  align-self: flex-start;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--tier);
  color: #fff;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

/* Nothing in this tool or weapon slot yet: a little hammer says it can be made right here. */
.gear-make {
  position: absolute;
  top: -8px;
  inset-inline-end: -8px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 2px 0 #127a4b;
  animation: make-pulse 1.4s ease-in-out infinite;
}

.gear-box .gear-make svg {
  width: 14px;
  height: 14px;
  color: #fff;
  opacity: 1;
}

@keyframes make-pulse {
  50% {
    transform: scale(1.15);
  }
}

.gear-pick .craft-card {
  margin: 0;
}

/* ---- stations ---- */
.station-title svg {
  width: 36px;
  height: 36px;
}

.station-empty {
  margin: 18px 0;
  color: #8a6a4a;
  font-weight: 800;
  text-align: center;
}

.craft-text > .craft-why {
  color: #c0392b;
  font-size: 12px;
  font-weight: 800;
}

.process-time {
  align-self: center;
  color: #8a6a4a;
  font-size: 13px;
  font-weight: 800;
}

.process-btns {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.process-btns .craft-btn {
  justify-content: center;
  min-width: 70px;
  padding: 6px 12px;
}

.craft-btn--stop {
  border-color: #b5543a;
  background: #e06a4a;
  box-shadow: 0 3px 0 #9a3f28;
}

/* In place of the Make button while it's being made. */
.craft-progress {
  flex: 0 0 auto;
  width: 96px;
  height: 18px;
  overflow: hidden;
  border: 3px solid #189a5f;
  border-radius: 999px;
  background: rgba(34, 181, 115, 0.15);
}

.craft-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #8fe36b, #22b573);
}

.process-bar {
  height: 8px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(122, 82, 54, 0.2);
}

.process-bar span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #ffb020, #f08a3c);
}

.equip-note {
  margin: 12px 0 0;
  color: #8a6a4a;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.skill-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skill {
  display: flex;
  gap: 12px;
  padding: 12px;
  border: 3px solid #c49a62;
  border-radius: 16px;
  background: rgba(244, 227, 189, 0.65);
}

.skill-icon {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, #ffb020, #f0603c);
  color: #fff;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.15);
}

.skill--hunting .skill-icon {
  background: linear-gradient(135deg, #ff7a59, #d6336c);
}

.skill--exploration .skill-icon {
  background: linear-gradient(135deg, #2aa198, #3d7be0);
}

.skill--crafting .skill-icon {
  background: linear-gradient(135deg, #7d8bd6, #4b5bb8);
}

.skill--crafting .skill-bar span {
  background: linear-gradient(90deg, #aab6f0, #4b5bb8);
}

.skill--cooking .skill-icon {
  background: linear-gradient(135deg, #f2a33a, #c2452d);
}

.skill--cooking .skill-bar span {
  background: linear-gradient(90deg, #ffc46b, #c2452d);
}

.skill--building .skill-icon {
  background: linear-gradient(135deg, var(--wood-light), var(--wood));
}

.skill--building .skill-bar span {
  background: linear-gradient(90deg, #e8b877, #9a6234);
}

.skill-icon svg {
  width: 32px;
  height: 32px;
}

.skill-body {
  flex: 1;
  min-width: 0;
}

.skill-top,
.skill-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.skill-name {
  font-size: 19px;
  font-weight: 800;
}

.skill-level {
  flex: 0 0 auto;
  font-weight: 800;
  color: #7a5236;
  white-space: nowrap;
}

.skill-level small {
  opacity: 0.6;
}

.skill-bar {
  height: 14px;
  margin: 6px 0;
  overflow: hidden;
  border: 2px solid #7a5236;
  border-radius: 999px;
  background: #e2c690;
}

.skill-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffcf4d, #ff8a3c);
  transition: width 0.3s ease;
}

.skill--hunting .skill-bar span {
  background: linear-gradient(90deg, #ff9a7a, #d6336c);
}

.skill--exploration .skill-bar span {
  background: linear-gradient(90deg, #5fd6c4, #3d7be0);
}

.skill-meta {
  align-items: center;
  color: #7a5236;
  font-size: 14px;
  font-weight: 700;
}

.skill-meta span {
  min-width: 0;
}

/* The bonus multiplier as a small badge ("×1.18"). */
.skill-mult {
  flex: 0 0 auto;
  padding: 1px 10px;
  border-radius: 999px;
  background: rgba(122, 82, 54, 0.14);
  font-size: 15px;
  font-weight: 800;
  direction: ltr;
}

.skill-how {
  margin: 6px 0 0;
  color: #8a6a4a;
  font-size: 13px;
}

/* ---- friends and educational groups --------------------------------------- */

.social {
  flex: 1;
  min-height: 0;
  width: min(100%, 620px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding: 8px 10px 20px;
  margin-top: -8px;
}

.social-card {
  padding: 16px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.social-card[hidden] {
  display: none;
}

.social-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 19px;
}

.social-head:not(:first-child) {
  margin-top: 16px;
}

.social-head svg {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  color: var(--primary);
}

.social-code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  font-weight: 700;
}

.social-code b,
.group-code b {
  padding: 4px 14px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  font: 800 24px/1.2 system-ui, sans-serif;
  letter-spacing: 3px;
}

.game-setting {
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.55);
}

.game-reload {
  width: 100%;
}

.code-with-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.copy-btn {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  margin-inline-start: 6px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  vertical-align: middle;
}

.copy-btn svg {
  width: 20px;
  height: 20px;
}

.copy-btn:active {
  transform: scale(0.92);
}

.hud-code {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-inline-start: 6px;
  padding: 0 6px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
  color: inherit;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  pointer-events: auto;
}

.hud-code svg {
  width: 13px;
  height: 13px;
}

.social-add {
  display: flex;
  gap: 8px;
}

.social-add .dialog-input {
  flex: 1;
  margin: 0;
  text-align: center;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.people {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.person {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--tile);
  color: var(--ink);
  font: inherit;
  text-align: start;
}

.person--btn {
  width: 100%;
  cursor: pointer;
}

.person.is-focus {
  box-shadow: 0 0 0 3px var(--primary);
}

.person-face {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(180deg, #bfe2ff, #eaf6ff);
  color: var(--muted);
}

.person-face svg {
  width: 100%;
  height: 100%;
}

.person-face--icon {
  background: var(--primary-soft);
  color: var(--primary);
}

.person-face--icon svg {
  width: 26px;
  height: 26px;
}

.person-text {
  flex: 1;
  min-width: 120px;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.person-text small {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-weight: 700;
}

.person-text small svg {
  width: 14px;
  height: 14px;
  color: #e04848;
}

.person-acts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #b9b0c6;
}

.person.is-online .dot {
  background: var(--ok);
}

.btn--small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 14px;
}

.btn--small svg {
  width: 18px;
  height: 18px;
}

.group-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.group-actions .btn {
  flex: 1 1 160px;
}

.role-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.role-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 8px;
  border: 3px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--tile);
  color: var(--ink);
  font: inherit;
  font-size: 17px;
}

.role-btn svg {
  width: 40px;
  height: 40px;
  color: var(--primary);
}

.role-btn:hover {
  border-color: var(--primary);
}

.group-codes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.group-code {
  flex: 1 1 200px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--tile);
  font-weight: 700;
}

.group-code small {
  color: var(--muted);
}

.role-tag,
.you-tag {
  margin-inline-start: auto;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 13px;
  font-style: normal;
}

.you-tag {
  margin-inline-start: 4px;
}

.group-soon {
  width: 100%;
  cursor: default;
}

.group-leave {
  align-self: center;
}

.online-code {
  width: 100%;
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.85);
}

/* ---- playing online: players, chat, knocking ------------------------------ */

.hud-online {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
}

.hud-online svg {
  width: 14px;
  height: 14px;
}

.hud-online span {
  margin-inline-start: 6px;
}

.chat {
  position: absolute;
  bottom: calc(14px + env(safe-area-inset-bottom));
  inset-inline-start: 12px;
  z-index: 4;
  width: min(340px, calc(100% - 100px));
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.chat-log {
  max-height: 150px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  scrollbar-width: none;
}

.chat-line {
  align-self: flex-start;
  max-width: 100%;
  margin: 0;
  padding: 3px 10px;
  border-radius: 10px;
  background: rgba(30, 20, 40, 0.55);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
  transition: opacity 1s;
}

.chat-line b {
  color: #ffd25a;
}

.chat-line--note {
  color: #cdeccf;
  font-style: italic;
}

.chat-line.is-old {
  opacity: 0;
}

.chat.is-open {
  pointer-events: auto;
}

.chat.is-open .chat-log {
  padding: 6px;
  border-radius: 12px;
  background: rgba(30, 20, 40, 0.35);
}

.chat.is-open .chat-line.is-old {
  opacity: 1;
}

.chat-form {
  display: flex;
  gap: 6px;
  pointer-events: auto;
}

.chat-form[hidden] {
  display: none;
}

.chat-input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 3px solid var(--wood-dark);
  border-radius: 12px;
  background: #fffaf0;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  unicode-bidi: plaintext;
}

.chat-input:focus {
  outline: none;
  border-color: var(--primary);
}

.chat-send {
  width: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 3px solid var(--wood-dark);
  border-radius: 12px;
  background: var(--ok);
  color: #fff;
}

[dir='rtl'] .chat-send svg {
  transform: scaleX(-1);
}

.chat-send svg {
  width: 20px;
  height: 20px;
}

.knock-btn {
  position: absolute;
  bottom: calc(150px + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 3px solid var(--wood-dark);
  border-radius: 999px;
  background: var(--parchment);
  box-shadow: 0 5px 0 var(--wood-dark);
  color: #5a3c26;
  font: inherit;
  font-size: 17px;
  font-weight: 800;
  transform: translateX(-50%);
  animation: coach 1.4s ease-in-out infinite;
}

.knock-btn[hidden] {
  display: none;
}

.knock-btn svg {
  width: 24px;
  height: 24px;
}

/* Away from the server: the world waits under a notice until it's back. */
.net-down {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(20, 12, 40, 0.5);
}

.net-down[hidden] {
  display: none;
}

.net-down-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 340px;
  padding: 22px 24px;
  border: 4px solid var(--wood-dark);
  border-radius: 22px;
  background: var(--parchment);
  box-shadow: 0 8px 0 var(--wood-dark);
  color: #5a3c26;
  text-align: center;
}

.net-down-card strong {
  font-size: 19px;
}

.net-down-card small {
  color: #8a6a4a;
  font-weight: 700;
}

/* Waiting on the server: a spinner over the whole screen. */
.busy {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: rgba(43, 34, 48, 0.35);
}

.busy-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border: 3px solid var(--wood-dark);
  border-radius: 16px;
  background: var(--parchment);
  color: #5a3c26;
  font-weight: 800;
  box-shadow: 0 5px 0 var(--wood-dark);
}

.net-spin {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 5px solid rgba(122, 82, 54, 0.25);
  border-top-color: #c2452d;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.net-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: -4px auto 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--shadow);
  font-weight: 800;
}

.net-banner[hidden] {
  display: none;
}

.net-banner .net-spin {
  width: 20px;
  height: 20px;
  border-width: 3px;
}

/* Waiting to arrive at a family member. */
.teleport-bar {
  position: absolute;
  bottom: calc(150px + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 6;
  width: min(380px, calc(100% - 24px));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 10px 14px;
  border: 3px solid var(--wood-dark);
  border-radius: 16px;
  background: rgba(247, 230, 194, 0.98);
  box-shadow: 0 6px 0 var(--wood-dark);
  color: #5a3c26;
  font-weight: 800;
  transform: translateX(-50%);
}

.teleport-bar .net-spin {
  width: 22px;
  height: 22px;
  border-width: 3px;
}

.teleport-bar [data-role="tpText"] {
  flex: 1;
}

.teleport-bar .process-bar {
  flex: 1 1 100%;
  order: 3;
  margin: 0;
}

.net-popups {
  position: absolute;
  top: calc(120px + env(safe-area-inset-top));
  left: 50%;
  z-index: 7;
  width: min(420px, calc(100% - 24px));
  display: flex;
  flex-direction: column;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}

.net-popup {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding: 10px 12px;
  border: 3px solid var(--wood-dark);
  border-radius: 16px;
  background: rgba(247, 230, 194, 0.98);
  box-shadow: 0 6px 0 var(--wood-dark), 0 12px 26px rgba(0, 0, 0, 0.25);
  color: #5a3c26;
  font-weight: 800;
  pointer-events: auto;
  animation: guide-in 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.net-popup > svg {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  color: #c2452d;
}

.net-popup span {
  flex: 1;
  min-width: 140px;
}

.net-yes,
.net-no {
  padding: 6px 14px;
  border: 3px solid #189a5f;
  border-radius: 12px;
  background: var(--ok);
  color: #fff;
  font: inherit;
  font-weight: 800;
}

.net-no {
  border-color: #b59a78;
  background: #efe0c2;
  color: #7a5236;
}

.family-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(224, 72, 72, 0.12);
  color: #8a2d2d;
  font-weight: 800;
}

.family-bar svg {
  width: 20px;
  height: 20px;
}

.family-bar span {
  flex: 1;
}

/* ---- settings ----------------------------------------------------------- */

.settings {
  flex: 1;
  min-height: 0;
  width: min(100%, 620px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding: 8px 10px 20px;
  margin-top: -8px;
}

.settings-card {
  padding: 16px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.settings-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  font-size: 20px;
}

.settings-head svg {
  width: 26px;
  height: 26px;
  color: var(--primary);
}

.setting-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  min-height: 56px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--tile);
  font-weight: 700;
}

.setting-row + .setting-row {
  margin-top: 8px;
}

label.setting-row {
  cursor: pointer;
}

.setting-name {
  flex: 1;
}

.setting-row.is-soon {
  color: var(--muted);
}

.setting-row .badge {
  background: var(--primary-soft);
  color: var(--primary);
}

.setting-range {
  width: 100%;
  accent-color: var(--primary);
}

.setting-range:disabled {
  opacity: 0.45;
}

/* An on/off switch drawn over a checkbox. */
.switch {
  appearance: none;
  position: relative;
  width: 56px;
  height: 32px;
  flex: 0 0 auto;
  margin: 0;
  border-radius: 999px;
  background: #cfc6de;
  cursor: pointer;
  transition: background 0.2s;
}

.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: inset-inline-start 0.2s;
}

.switch:checked {
  background: var(--ok);
}

.switch:checked::after {
  inset-inline-start: 27px;
}

.settings-sub {
  margin: 0 0 14px;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.5;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.settings-actions .btn {
  flex: 1 1 180px;
}

.icon-btn.is-current {
  box-shadow: 0 0 0 3px var(--primary), var(--shadow);
  color: var(--primary);
}

/* ---- moving progress to another device ----------------------------------- */

.link-dialog {
  text-align: center;
}

.link-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 0 12px;
  font-size: 20px;
  line-height: 1.35;
}

.link-title svg {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  color: var(--primary);
}

.link-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 120px;
  margin-bottom: 14px;
}

.link-qr {
  width: min(56vw, 210px);
  padding: 8px;
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--line);
}

.link-qr svg {
  display: block;
  width: 100%;
  height: auto;
}

.link-msg {
  margin: 0;
  font-weight: 700;
  line-height: 1.5;
}

.link-msg.is-bad,
.link-error {
  color: #c43c3c;
}

.link-code {
  margin: 0;
  color: var(--primary);
  font: 800 40px/1.1 system-ui, sans-serif;
  letter-spacing: 4px;
}

.link-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.link-input {
  direction: ltr;
  unicode-bidi: isolate;
  font: 800 30px/1.2 system-ui, sans-serif;
  letter-spacing: 6px;
  text-align: center;
}

.link-error {
  margin: -8px 0 14px;
  font-weight: 700;
}

.link-dialog .dialog-actions {
  justify-content: center;
}

.link-wait {
  width: 44px;
  height: 44px;
  margin: auto;
  border: 5px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.link-ok {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ok);
  color: #fff;
  animation: pop 0.32s ease;
}

.link-ok svg {
  width: 44px;
  height: 44px;
  stroke-width: 3;
}

/* "Already playing on another device?" on a new device's character creator. */
/* A round button in the corner, like the ones opposite, so it stays clear of the character. */
.stage-link {
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  z-index: 2;
  width: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
}

.stage-link i {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--card);
  box-shadow: var(--shadow);
}

.stage-link svg {
  width: 28px;
  height: 28px;
}

/* ---- profile ------------------------------------------------------------ */

.profile {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow-y: auto;
}

.profile-card {
  width: min(100%, 420px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 20px 20px 24px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.profile-stage {
  width: 100%;
  height: min(52dvh, 420px);
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.95) 0 28%, rgba(255, 255, 255, 0) 62%),
    linear-gradient(180deg, #bfe2ff, #eaf6ff);
}

.profile-stage svg {
  height: 94%;
  aspect-ratio: 2 / 3;
}

/* The name reads like a title but is a text field: tap it to rename. */
.profile-name-field {
  position: relative;
  width: min(100%, 320px);
}

.profile-name {
  width: 100%;
  padding: 6px 40px;
  border: 2px dashed var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 26px;
  font-weight: 800;
  text-align: center;
}

.profile-name::placeholder {
  color: var(--muted);
  font-size: 20px;
}

.profile-name:hover {
  border-color: #cbbde6;
}

.profile-name:focus {
  outline: none;
  border-style: solid;
  border-color: var(--primary);
  background: var(--tile);
}

.profile-name-pen {
  position: absolute;
  top: 50%;
  inset-inline-end: 12px;
  display: grid;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.profile-name-pen svg {
  width: 20px;
  height: 20px;
}

.profile-name:focus + .profile-name-pen {
  display: none;
}

/* ---- character animation ------------------------------------------------ */

.c-body {
  transform-box: view-box;
  transform-origin: 100px 290px;
  animation: breathe 3.2s ease-in-out infinite;
}

.c-eyes {
  transform-box: view-box;
  transform-origin: 100px 101px;
  animation: blink 5s infinite;
}

@keyframes breathe {
  50% {
    transform: scaleY(1.012);
  }
}

@keyframes blink {
  0%,
  95%,
  100% {
    transform: scaleY(1);
  }
  97% {
    transform: scaleY(0.1);
  }
}

@keyframes pop {
  40% {
    transform: scale(1.04);
  }
}

/* ---- wide screens ------------------------------------------------------- */

@media (min-width: 820px) {
  .creator {
    flex-direction: row;
  }

  .stage {
    flex: 1 1 auto;
    min-height: 0;
  }

  .panel {
    flex: 0 0 440px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .c-body,
  .c-eyes,
  .stage-char.is-pop {
    animation: none;
  }
}
