:root {
  --ink: #2b2723;
  --ink-soft: rgba(43, 39, 35, 0.62);
  --paper: #f2e9dc;
  --paper-strong: #faf3e8;
  --terracotta: #c96f4a;
  --terracotta-deep: #a9533a;
  --sage: #7e9273;
  --line: rgba(43, 39, 35, 0.14);
  --radius: 16px;
  --font-ui: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    system-ui, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --safe-top: max(18px, env(safe-area-inset-top));
  --safe-right: max(18px, env(safe-area-inset-right));
  --safe-bottom: max(20px, env(safe-area-inset-bottom));
  --safe-left: max(18px, env(safe-area-inset-left));
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #120f0c;
  color: var(--ink);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  overscroll-behavior: none;
}

#app {
  position: fixed;
  inset: 0;
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  outline: none;
  cursor: grab;
}

#vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse at 50% 44%,
    rgba(0, 0, 0, 0) 38%,
    rgba(14, 10, 7, 0.28) 72%,
    rgba(10, 7, 4, 0.62) 100%
  );
}

#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

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

.task-panel {
  position: absolute;
  top: var(--safe-top);
  left: var(--safe-left);
  width: 268px;
  padding: 12px 10px 9px;
  border-radius: var(--radius);
  background: rgba(248, 240, 228, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow:
    0 18px 45px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  pointer-events: auto;
}

.task-panel-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 3px 7px;
}

.task-panel-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  padding: 0;
  font-family: var(--font-ui);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  cursor: pointer;
  text-align: left;
}

.wallet-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  height: 22px;
  padding: 0 8px 0 6px;
  border-radius: 999px;
  background: rgba(43, 39, 35, 0.08);
  color: var(--ink);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.wallet-chip .wallet-icon {
  width: 14px;
  height: 14px;
  color: var(--terracotta-deep);
}

.wallet-chip .wallet-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.wallet-chip.wallet-float {
  position: absolute;
  top: var(--safe-top);
  left: var(--safe-left);
  z-index: 8;
  height: 32px;
  padding: 0 11px 0 9px;
  border-radius: 999px;
  background: rgba(248, 240, 228, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--ink);
  font-size: 11px;
  pointer-events: none;
}

.wallet-float .wallet-icon {
  width: 16px;
  height: 16px;
}

/* ---------- coin payout VFX ---------- */

.coin-fly {
  position: fixed;
  z-index: 72;
  width: 20px;
  height: 20px;
  pointer-events: none;
  color: #e9b949;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35));
  will-change: transform, opacity;
}

.coin-fly svg {
  width: 100%;
  height: 100%;
  display: block;
}

.coin-gain {
  position: fixed;
  z-index: 73;
  transform: translate(-50%, 0);
  color: #f6d27a;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  will-change: transform, opacity;
}

@keyframes wallet-pop {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(1.12);
    box-shadow:
      0 0 0 5px rgba(233, 185, 73, 0.28),
      0 12px 30px rgba(0, 0, 0, 0.24);
  }
  100% {
    transform: scale(1);
  }
}

.wallet-chip.wallet-float.coin-hit {
  animation: wallet-pop 0.62s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.task-chevron {
  margin-left: 8px;
  font-size: 8px;
  line-height: 1;
  letter-spacing: 0.08em;
  color: var(--terracotta-deep);
  opacity: 0.8;
}

.task-panel:not(.expanded) .task-row:not(.current) {
  display: none;
}

.task-panel:not(.expanded) .task-hint {
  display: none;
}

.task-panel:not(.expanded) .task-panel-foot {
  justify-content: flex-end;
}

.task-panel-count {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  color: var(--terracotta-deep);
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.task-row {
  appearance: none;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 6px 5px;
  border-radius: 10px;
  color: var(--ink);
  font-family: var(--font-ui);
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease;
}

.task-row:hover {
  background: rgba(43, 39, 35, 0.05);
}

.task-row.current {
  background: rgba(201, 111, 74, 0.1);
}

.task-ico {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(43, 39, 35, 0.08);
  color: var(--ink);
  transition: background 0.2s ease, color 0.2s ease;
}

.task-ico svg {
  width: 18px;
  height: 18px;
  display: block;
}

.task-row.done .task-ico {
  background: var(--sage);
  color: var(--paper);
}

.task-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.task-name {
  font-size: 11.5px;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-row.done .task-name {
  opacity: 0.65;
}

.task-bar {
  height: 3px;
  border-radius: 99px;
  background: rgba(43, 39, 35, 0.12);
  overflow: hidden;
}

.task-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--terracotta), #e0a06f);
  transition: width 0.16s ease-out;
}

.task-row.done .task-fill {
  background: var(--sage);
}

.task-pct {
  flex: 0 0 32px;
  text-align: right;
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
  color: var(--terracotta-deep);
}

.task-row.done .task-pct {
  color: var(--sage);
}

.task-panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
  padding: 0 5px;
}

.task-hint {
  font-size: 8px;
  line-height: 1.3;
  color: var(--ink-soft);
  max-width: 148px;
}

.reset-btn {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 5px 0;
  margin: 0;
  color: var(--terracotta-deep);
  font-family: var(--font-ui);
  font-size: 10px;
  letter-spacing: 0.02em;
  cursor: pointer;
  opacity: 0.7;
  white-space: nowrap;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.reset-btn:hover {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.reset-btn.armed {
  opacity: 1;
  font-weight: 700;
  color: #9f3f2d;
}

/* ---------- time of day ---------- */

.time-dock {
  position: absolute;
  top: var(--safe-top);
  right: var(--safe-right);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(30, 25, 21, 0.62);
  border: 1px solid rgba(242, 233, 220, 0.14);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  pointer-events: auto;
}

.time-orb {
  position: relative;
  appearance: none;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 50%;
  background: rgba(248, 240, 228, 0.07);
  color: var(--paper);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.12s ease;
}

.time-orb:hover {
  background: rgba(248, 240, 228, 0.14);
}

.time-orb:active {
  transform: scale(0.95);
}

.time-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  pointer-events: none;
}

.time-ring-track {
  fill: none;
  stroke: rgba(242, 233, 220, 0.16);
  stroke-width: 3;
}

.time-ring-fill {
  fill: none;
  stroke: var(--terracotta);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 70;
  transition: stroke-dashoffset 0.18s linear;
}

.time-orb-icon {
  position: relative;
  width: 22px;
  height: 22px;
  display: block;
  pointer-events: none;
}

.time-orb-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.time-auto {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(242, 233, 220, 0.55);
  width: 34px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  cursor: pointer;
  pointer-events: auto;
  transition: color 0.2s ease, background 0.2s ease;
}

.time-auto svg {
  width: 14px;
  height: 14px;
  display: block;
}

.time-auto:hover {
  color: var(--paper);
  background: rgba(242, 233, 220, 0.08);
}

.time-auto.paused {
  color: var(--terracotta);
}

/* ---------- radial object menu ---------- */

.object-menu {
  position: fixed;
  z-index: 46;
  width: 0;
  height: 0;
  pointer-events: none;
}

.object-menu-hub {
  position: absolute;
  left: 0;
  top: 0;
  width: 64px;
  height: 64px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(30, 25, 21, 0.78);
  border: 1px solid rgba(242, 233, 220, 0.18);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.object-menu.open .object-menu-hub {
  opacity: 1;
}

.object-menu-title {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  width: 62px;
  transform: translate(-50%, -50%);
  color: rgba(242, 233, 220, 0.86);
  font-size: 8px;
  line-height: 1.15;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
  pointer-events: none;
  max-height: 58px;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.object-menu.open .object-menu-title {
  opacity: 1;
}

.object-menu-bubbles {
  position: absolute;
  left: 0;
  top: 0;
}

.object-action {
  position: absolute;
  left: 0;
  top: 0;
  appearance: none;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 50%;
  background: rgba(248, 240, 228, 0.96);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.35);
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition:
    transform 0.3s cubic-bezier(0.2, 1.35, 0.4, 1),
    opacity 0.18s ease,
    background 0.18s ease;
  transition-delay: 0s;
}

.object-menu.open .object-action {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) translate(var(--x), var(--y)) scale(1);
  transition-delay: calc(var(--i) * 40ms);
}

.object-action svg {
  width: 21px;
  height: 21px;
  display: block;
}

.object-action:hover {
  background: var(--paper-strong);
}

.object-action:active {
  filter: brightness(0.96);
}

.object-action span {
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--paper);
  font-size: 8.5px;
  line-height: 1.15;
  text-shadow: 0 1px 7px rgba(0, 0, 0, 0.65);
  pointer-events: none;
}

/* ---------- bubble tool dock ---------- */

.bubble-bar {
  position: absolute;
  left: 50%;
  bottom: var(--safe-bottom);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  pointer-events: none;
  z-index: 6;
}

.tool-dock {
  position: relative;
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  pointer-events: none;
}

.tool-center {
  position: absolute;
  inset: 0;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 50%;
  background: rgba(33, 27, 22, 0.78);
  color: var(--paper);
  display: grid;
  place-items: center;
  cursor: pointer;
  pointer-events: auto;
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: transform 0.16s ease, background 0.2s ease;
  z-index: 3;
}

.tool-center:hover {
  transform: scale(1.04);
}

.tool-center:active {
  transform: scale(0.96);
}

.tool-center svg {
  width: 28px;
  height: 28px;
  display: block;
}

.tool-center.is-look {
  background: rgba(248, 240, 228, 0.92);
  color: var(--ink);
}

.tool-dock.open .tool-center {
  transform: scale(0.9);
}

.tool-fan {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.tool-bubble {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 50%;
  background: rgba(248, 240, 228, 0.94);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.35);
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition:
    transform 0.32s cubic-bezier(0.2, 1.35, 0.4, 1),
    opacity 0.2s ease,
    background 0.2s ease,
    color 0.2s ease;
}

.tool-bubble svg {
  width: 24px;
  height: 24px;
  display: block;
}

.tool-dock.open .tool-bubble {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) translate(var(--x), var(--y)) scale(1);
}

.tool-bubble.active {
  background: var(--terracotta);
  color: var(--paper);
  border-color: rgba(255, 255, 255, 0.6);
}

.bubble-label {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  color: var(--paper);
  font-size: 9px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-shadow: 0 1px 7px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.2s ease 0.08s;
  pointer-events: none;
}

.tool-dock.open .bubble-label {
  opacity: 0.92;
}

.notebook-bubble {
  position: relative;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(242, 233, 220, 0.24);
  border-radius: 50%;
  background: rgba(33, 27, 22, 0.78);
  color: rgba(242, 233, 220, 0.78);
  display: grid;
  place-items: center;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background 0.2s ease, color 0.2s ease, transform 0.16s ease;
  z-index: 5;
}

.notebook-bubble:hover {
  color: var(--paper);
  transform: scale(1.05);
}

.notebook-ring {
  position: absolute;
  inset: -2px;
  width: calc(100% + 4px);
  height: calc(100% + 4px);
  transform: rotate(-90deg);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s ease;
}

.notebook-bubble.has-progress .notebook-ring {
  opacity: 1;
}

.notebook-ring-track {
  fill: none;
  stroke: rgba(242, 233, 220, 0.16);
  stroke-width: 3;
}

.notebook-ring-fill {
  fill: none;
  stroke: var(--terracotta);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transition: stroke-dashoffset 0.3s ease;
}

.notebook-icon {
  position: relative;
  width: 20px;
  height: 20px;
  display: block;
  pointer-events: none;
}

.notebook-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ---------- colour swatches ---------- */

.swatches {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 14px);
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 999px;
  background: rgba(30, 25, 21, 0.66);
  border: 1px solid rgba(242, 233, 220, 0.16);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.tool-dock.show-palette:not(.open) .swatches {
  opacity: 1;
  pointer-events: auto;
}

.tool-dock.open .swatches {
  opacity: 0;
  pointer-events: none;
}

.swatch {
  appearance: none;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid rgba(242, 233, 220, 0.55);
  background: var(--swatch);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.35);
}

.swatch:hover {
  transform: scale(1.08);
}

.swatch.active {
  border-color: var(--paper);
  box-shadow:
    0 0 0 2px var(--terracotta),
    inset 0 1px 2px rgba(255, 255, 255, 0.35);
}

/* ---------- hints / toast ---------- */

.hint {
  position: absolute;
  right: var(--safe-right);
  bottom: var(--safe-bottom);
  color: rgba(242, 233, 220, 0.5);
  font-size: 10px;
  letter-spacing: 0.03em;
  text-align: right;
  line-height: 1.65;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.4);
}

.wipe-hint {
  position: absolute;
  left: 50%;
  top: 58%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px 9px 10px;
  border-radius: 999px;
  background: rgba(30, 25, 21, 0.5);
  border: 1px solid rgba(242, 233, 220, 0.16);
  color: var(--paper);
  font-size: 11.5px;
  letter-spacing: 0.035em;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  pointer-events: none;
  z-index: 4;
  transition: opacity 0.45s ease, transform 0.45s ease;
  animation: hint-float 3.4s ease-in-out infinite;
}

.wipe-hint svg {
  width: 18px;
  height: 18px;
  display: block;
  opacity: 0.9;
}

.wipe-hint.hide {
  opacity: 0;
  transform: translate(-50%, calc(-50% + 8px));
  animation: none;
}

@keyframes hint-float {
  0%,
  100% {
    transform: translate(-50%, -50%);
  }
  50% {
    transform: translate(-50%, calc(-50% - 5px));
  }
}

.toast {
  position: absolute;
  z-index: 60;
  left: 50%;
  top: var(--safe-top);
  transform: translate(-50%, -10px);
  padding: 11px 18px;
  border-radius: 999px;
  background: rgba(248, 240, 228, 0.95);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.01em;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.26);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- responsive ---------- */

@media (max-width: 760px) {
  :root {
    --safe-top: max(14px, env(safe-area-inset-top));
    --safe-right: max(14px, env(safe-area-inset-right));
    --safe-bottom: max(16px, env(safe-area-inset-bottom));
    --safe-left: max(14px, env(safe-area-inset-left));
  }

  .task-panel {
    top: var(--safe-top);
    width: 190px;
    padding: 9px 7px 7px;
  }

  .task-panel-head {
    gap: 4px;
    padding-bottom: 5px;
  }

  .task-panel-toggle {
    font-size: 8px;
  }

  .wallet-chip {
    height: 20px;
    padding: 0 6px 0 5px;
    font-size: 9px;
    gap: 3px;
  }

  .wallet-chip .wallet-icon {
    width: 12px;
    height: 12px;
  }

  .task-row {
    gap: 7px;
    padding: 4px;
  }

  .task-ico {
    width: 24px;
    height: 24px;
    flex-basis: 24px;
    border-radius: 8px;
  }

  .task-ico svg {
    width: 18px;
    height: 18px;
  }

  .task-name {
    font-size: 10.5px;
  }

  .task-pct {
    flex-basis: 28px;
    font-size: 9px;
  }

  .task-hint {
    display: none;
  }

  .task-panel-foot {
    justify-content: flex-end;
    margin-top: 4px;
    padding: 0 4px;
  }

  .time-dock {
    padding: 3px;
    gap: 2px;
  }

  .time-orb {
    width: 40px;
    height: 40px;
  }

  .time-orb-icon {
    width: 19px;
    height: 19px;
  }

  .time-auto {
    width: 30px;
    height: 40px;
  }

  .time-auto svg {
    width: 12px;
    height: 12px;
  }

  .hint {
    display: none;
  }

  .wipe-hint {
    top: 55%;
  }

  .tool-bubble {
    width: 52px;
    height: 52px;
  }

  .tool-bubble svg {
    width: 22px;
    height: 22px;
  }

  .tool-center {
    box-shadow:
      0 10px 26px rgba(0, 0, 0, 0.32),
      inset 0 1px 0 rgba(255, 255, 255, 0.15);
  }

  .notebook-bubble {
    flex-basis: 38px;
    width: 38px;
    height: 38px;
  }

  .notebook-icon {
    width: 18px;
    height: 18px;
  }

  .swatches {
    gap: 7px;
    padding: 6px 8px;
    bottom: calc(100% + 12px);
  }

  .swatch {
    width: 24px;
    height: 24px;
  }

  .bubble-label {
    font-size: 8px;
  }
}

@media (max-width: 380px) {
  .task-panel {
    width: 184px;
  }

  .task-name {
    font-size: 10px;
  }

  .tool-bubble {
    width: 48px;
    height: 48px;
  }

  .tool-bubble svg {
    width: 20px;
    height: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- notebook popup ---------- */

.notebook-card {
  width: min(430px, 100%);
}

.notebook-count {
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: var(--terracotta-deep);
}

.notebook-list {
  gap: 1px;
}

.notebook-card .task-row {
  padding: 7px 6px;
}

.notebook-foot {
  margin-top: 10px;
  padding: 10px 4px 0;
  border-top: 1px solid var(--line);
}

.notebook-foot .task-hint {
  max-width: 210px;
}

@media (max-width: 760px) {
  .wallet-chip.wallet-float {
    height: 28px;
    padding: 0 9px 0 8px;
    font-size: 10px;
  }

  .wallet-float .wallet-icon {
    width: 14px;
    height: 14px;
  }

  .notebook-card {
    width: min(430px, calc(100% - 8px));
  }

  .notebook-card .task-row {
    padding: 6px 4px;
  }

  .notebook-foot .task-hint {
    font-size: 7.5px;
    max-width: 150px;
  }
}

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

.settings-card {
  width: min(480px, 100%);
}

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

.settings-row {
  appearance: none;
  width: 100%;
  border: 1px solid rgba(43, 39, 35, 0.1);
  border-radius: 16px;
  background: rgba(255, 252, 245, 0.72);
  color: var(--ink);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  text-align: left;
  font-family: var(--font-ui);
  cursor: pointer;
}

.settings-row:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.settings-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.settings-name {
  font-size: 13px;
}

.settings-hint {
  font-size: 10px;
  line-height: 1.35;
  color: var(--ink-soft);
}

.settings-switch {
  position: relative;
  flex: 0 0 46px;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: rgba(43, 39, 35, 0.18);
  transition: background 0.2s ease;
}

.settings-switch span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fffaf0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
  transition: transform 0.2s ease;
}

.settings-row.active .settings-switch {
  background: var(--terracotta);
}

.settings-row.active .settings-switch span {
  transform: translateX(20px);
}

.settings-note {
  padding: 0 4px;
  font-size: 9.5px;
  line-height: 1.5;
  text-align: center;
  color: var(--ink-soft);
}

/* ---------- utility: shop / warehouse ---------- */

.utility-bubble {
  appearance: none;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(242, 233, 220, 0.22);
  border-radius: 50%;
  background: rgba(33, 27, 22, 0.78);
  color: rgba(242, 233, 220, 0.72);
  display: grid;
  place-items: center;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background 0.2s ease, color 0.2s ease, transform 0.16s ease;
}

.utility-bubble svg {
  width: 20px;
  height: 20px;
  display: block;
}

.utility-bubble:hover {
  color: var(--paper);
  background: rgba(33, 27, 22, 0.92);
  transform: scale(1.05);
}

.utility-bubble:active {
  transform: scale(0.95);
}

.warehouse-bubble {
  position: relative;
}

.warehouse-bubble .delivery-ring {
  position: absolute;
  inset: -3px;
  width: calc(100% + 6px);
  height: calc(100% + 6px);
  transform: rotate(-90deg);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s ease;
}

.warehouse-bubble.delivering .delivery-ring {
  opacity: 1;
}

.delivery-ring-track {
  fill: none;
  stroke: rgba(242, 233, 220, 0.16);
  stroke-width: 3;
}

.delivery-ring-fill {
  fill: none;
  stroke: var(--terracotta);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transition: stroke-dashoffset 0.25s linear;
}

.delivery-time {
  position: absolute;
  left: 50%;
  bottom: -13px;
  transform: translateX(-50%);
  font-size: 8px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: rgba(242, 233, 220, 0.86);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  white-space: nowrap;
}

.warehouse-bubble.delivering .delivery-time {
  opacity: 1;
}

/* ---------- placement bar ---------- */

.placement-bar {
  position: absolute;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 92px);
  transform: translate(-50%, 10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 10px 12px 11px;
  border-radius: 18px;
  background: rgba(30, 25, 21, 0.86);
  border: 1px solid rgba(242, 233, 220, 0.18);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.2s ease;
  z-index: 20;
}

.placement-bar.open {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.placement-bar.invalid {
  border-color: rgba(196, 84, 69, 0.5);
}

.placement-name {
  color: rgba(242, 233, 220, 0.68);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.placement-hint {
  display: none;
  max-width: 320px;
  color: rgba(242, 233, 220, 0.64);
  font-size: 9px;
  line-height: 1.35;
  text-align: center;
}

.placement-hint.has-text {
  display: block;
}

.placement-actions {
  display: flex;
  gap: 5px;
}

.placement-bar .wall-controls {
  display: none;
}

.placement-bar.wall .wall-controls,
.placement-bar.carpet .wall-controls {
  display: flex;
}

.placement-bar:not(.wall) .wall-controls [data-action="height-down"],
.placement-bar:not(.wall) .wall-controls [data-action="height-up"],
.placement-bar:not(.wall) .wall-controls [data-action="tilt-down"],
.placement-bar:not(.wall) .wall-controls [data-action="tilt-up"] {
  display: none;
}

.placement-bar:not(.carpet) .wall-controls [data-action="mount"] {
  display: none;
}

.placement-bar.carpet .main-actions [data-action="left"],
.placement-bar.carpet .main-actions [data-action="right"] {
  display: grid;
}

.placement-bar.wall .main-actions [data-action="left"],
.placement-bar.wall .main-actions [data-action="right"] {
  display: none;
}

.placement-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 12px;
  background: rgba(248, 240, 228, 0.94);
  color: var(--ink);
  min-width: 44px;
  height: 40px;
  padding: 0 10px;
  font-family: var(--font-ui);
  font-size: 10px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.12s ease, opacity 0.2s ease, background 0.2s ease;
}

.placement-btn svg {
  width: 17px;
  height: 17px;
  display: block;
}

.placement-btn:hover {
  transform: translateY(-1px);
}

.placement-btn.primary {
  background: var(--terracotta);
  color: var(--paper);
  padding: 0 14px;
}

.placement-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  transform: none;
}

/* ---------- modal overlays ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 7, 4, 0.58);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: min(920px, 100%);
  max-height: calc(100dvh - 40px);
  overflow: auto;
  border-radius: 22px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.55);
  padding: 18px;
  scrollbar-width: thin;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 4px 14px;
}

.modal-kicker {
  color: var(--ink-soft);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.modal-title {
  margin-top: 3px;
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1.1;
}

.modal-head-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-wallet {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(43, 39, 35, 0.08);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.modal-wallet svg {
  width: 17px;
  height: 17px;
  color: var(--terracotta-deep);
}

.modal-close {
  appearance: none;
  border: 1px solid rgba(43, 39, 35, 0.12);
  background: rgba(43, 39, 35, 0.05);
  color: var(--ink);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.modal-close svg {
  width: 16px;
  height: 16px;
}

/* ---------- shop ---------- */

.shop-layout {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 14px;
}

.shop-tabs {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-content: start;
}

.shop-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  padding: 9px 11px;
  border-radius: 11px;
  text-align: left;
  font-family: var(--font-ui);
  font-size: 11px;
  cursor: pointer;
}

.shop-tab:hover {
  background: rgba(43, 39, 35, 0.05);
  color: var(--ink);
}

.shop-tab.active {
  background: var(--ink);
  color: var(--paper);
}

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

.shop-item {
  display: flex;
  gap: 10px;
  padding: 11px;
  border-radius: 15px;
  background: rgba(255, 252, 245, 0.7);
  border: 1px solid rgba(43, 39, 35, 0.09);
}

.shop-item-art {
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(43, 39, 35, 0.07);
  color: var(--ink);
}

.shop-item-art svg {
  width: 27px;
  height: 27px;
  display: block;
}

.shop-item-art.photo {
  flex-basis: 64px;
  width: 64px;
  height: 56px;
  padding: 0;
  overflow: hidden;
  background: rgba(43, 39, 35, 0.05);
}

.shop-item-art.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.rug-textures {
  display: flex;
  gap: 5px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.rug-texture {
  appearance: none;
  width: 19px;
  height: 19px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  background-image: var(--carpet);
  background-size: cover;
  background-position: center;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(43, 39, 35, 0.18);
}

.rug-texture.active {
  border-color: var(--terracotta);
  box-shadow: 0 0 0 1px var(--paper), 0 0 0 2px var(--terracotta);
}

.shop-item-custom {
  border-color: rgba(201, 111, 74, 0.34);
  background: linear-gradient(
    135deg,
    rgba(255, 250, 241, 0.94),
    rgba(242, 233, 220, 0.8)
  );
}

.shop-item-custom .custom-art {
  border-radius: 50%;
  background: radial-gradient(
    circle at 35% 30%,
    rgba(255, 250, 241, 0.98),
    rgba(201, 111, 74, 0.18)
  );
  box-shadow: inset 0 0 0 1.5px rgba(201, 111, 74, 0.35);
  color: var(--terracotta-deep);
}

.shop-item-custom .custom-upload {
  background: var(--ink);
}

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

.shop-item-name {
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.1;
}

.wall-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(201, 111, 74, 0.16);
  color: var(--terracotta-deep);
  font-family: var(--font-ui);
  font-size: 7.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: middle;
  white-space: nowrap;
}

.shop-item-memory {
  margin-top: 3px;
  font-size: 9.5px;
  color: var(--ink-soft);
  line-height: 1.3;
}

.shop-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 9px;
  margin-top: 6px;
  font-size: 8.5px;
  color: var(--ink-soft);
}

.shop-item-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 8px;
}

.shop-item-count {
  font-size: 8.5px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.shop-buy {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: var(--terracotta);
  color: var(--paper);
  padding: 6px 10px;
  font-family: var(--font-ui);
  font-size: 9.5px;
  cursor: pointer;
  white-space: nowrap;
}

.shop-buy:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ---------- warehouse ---------- */

.warehouse-card {
  width: min(720px, 100%);
}

.warehouse-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 14px;
}

.warehouse-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 11px;
  border-radius: 16px;
  background: rgba(255, 252, 245, 0.7);
  border: 1px solid rgba(43, 39, 35, 0.09);
}

.warehouse-side-title {
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 0 3px 8px;
}

.warehouse-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: auto;
  max-height: 380px;
}

.warehouse-item {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 11px;
  padding: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  font-family: var(--font-ui);
}

.warehouse-item:hover {
  background: rgba(43, 39, 35, 0.05);
}

.warehouse-item.selected {
  border-color: var(--terracotta);
  background: rgba(201, 111, 74, 0.1);
}

.warehouse-item-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(43, 39, 35, 0.07);
}

.warehouse-item-icon svg {
  width: 19px;
  height: 19px;
}

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

.warehouse-item-name {
  font-size: 11px;
}

.warehouse-item-shape {
  font-size: 8px;
  color: var(--ink-soft);
}

.warehouse-empty {
  padding: 18px 8px;
  font-size: 10px;
  color: var(--ink-soft);
  text-align: center;
}

.warehouse-main {
  min-width: 0;
}

.warehouse-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.warehouse-status {
  font-size: 10px;
  color: var(--ink-soft);
}

.warehouse-status.shake {
  animation: shake 0.32s ease;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}

.warehouse-actions {
  display: flex;
  gap: 5px;
}

.warehouse-btn {
  appearance: none;
  border: 1px solid rgba(43, 39, 35, 0.14);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  height: 34px;
  padding: 0 12px;
  font-family: var(--font-ui);
  font-size: 9.5px;
  cursor: pointer;
}

.warehouse-btn.primary {
  background: var(--terracotta);
  border-color: transparent;
  color: var(--paper);
}

.warehouse-btn.sell:not(:disabled) {
  border-color: rgba(201, 111, 74, 0.35);
  color: var(--terracotta-deep);
}

.warehouse-btn.sell:not(:disabled):hover {
  background: rgba(201, 111, 74, 0.1);
}

.warehouse-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.truck-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  width: min(100%, 264px);
  margin: 0 auto;
  aspect-ratio: 4 / 3;
  padding: 7px;
  border-radius: 14px;
  background: rgba(43, 39, 35, 0.08);
  border: 1px solid rgba(43, 39, 35, 0.12);
}

.truck-cell {
  appearance: none;
  border: 1px dashed rgba(43, 39, 35, 0.16);
  border-radius: 7px;
  background: rgba(255, 252, 245, 0.58);
  cursor: pointer;
  padding: 0;
  min-width: 0;
  position: relative;
  transition: background 0.12s ease, transform 0.12s ease;
}

.truck-cell:hover {
  background: rgba(255, 252, 245, 0.9);
}

.truck-cell.filled {
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.4);
  background: var(--block-color, var(--sage));
}

.truck-cell.preview {
  background: rgba(126, 146, 115, 0.45);
  border-color: var(--sage);
}

.truck-cell.preview-invalid {
  background: rgba(196, 84, 69, 0.25);
  border-color: #c45445;
}

.truck-block-label {
  position: absolute;
  inset: 2px;
  display: grid;
  place-items: center;
  color: var(--paper);
  font-size: 7px;
  line-height: 1.05;
  text-align: center;
  overflow: hidden;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.warehouse-hint {
  margin-top: 8px;
  font-size: 8.5px;
  line-height: 1.4;
  color: var(--ink-soft);
  text-align: center;
}

/* ---------- final ---------- */

.final-card {
  width: min(560px, 100%);
  text-align: center;
  padding: 34px 28px 30px;
}

.final-kicker {
  font-size: 9px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.final-title {
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: 34px;
  line-height: 1.05;
}

.final-text {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.final-button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: var(--terracotta);
  color: var(--paper);
  margin-top: 20px;
  padding: 11px 24px;
  font-family: var(--font-ui);
  font-size: 12px;
  cursor: pointer;
}

@media (max-width: 760px) {
  .bubble-bar {
    gap: 7px;
  }

  .utility-bubble {
    flex-basis: 36px;
    width: 36px;
    height: 36px;
  }

  .utility-bubble svg {
    width: 18px;
    height: 18px;
  }

  .placement-bar {
    bottom: calc(var(--safe-bottom) + 88px);
    width: min(360px, calc(100% - 24px));
    padding: 8px 9px 9px;
  }

  .placement-btn {
    height: 38px;
    min-width: 42px;
    font-size: 9px;
    padding: 0 8px;
  }

  .placement-btn.primary {
    padding: 0 10px;
  }

  .modal-card {
    padding: 13px;
    border-radius: 18px;
    max-height: calc(100dvh - 24px);
  }

  .modal-title {
    font-size: 20px;
  }

  .shop-layout,
  .warehouse-layout {
    display: block;
  }

  .shop-tabs {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    gap: 3px;
    margin-bottom: 9px;
    padding-bottom: 2px;
  }

  .shop-tab {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 7px 10px;
    font-size: 10px;
  }

  .shop-grid {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .shop-item {
    padding: 9px;
  }

  .shop-item-art {
    flex-basis: 40px;
    width: 40px;
    height: 40px;
  }

  .shop-item-art svg {
    width: 24px;
    height: 24px;
  }

  .warehouse-side {
    margin-bottom: 9px;
    max-height: 154px;
  }

  .warehouse-list {
    max-height: 108px;
  }

  .warehouse-toolbar {
    margin-bottom: 6px;
  }

  .warehouse-status {
    font-size: 9px;
    max-width: 150px;
  }

  .truck-grid {
    width: min(100%, 300px);
  }

  .truck-block-label {
    font-size: 6.5px;
  }
}

@media (max-width: 380px) {
  .bubble-bar {
    gap: 6px;
  }

  .utility-bubble {
    flex-basis: 34px;
    width: 34px;
    height: 34px;
  }

  .placement-btn {
    height: 36px;
    min-width: 38px;
    padding: 0 6px;
    font-size: 8.5px;
  }

  .placement-actions {
    gap: 3px;
  }

  .warehouse-toolbar {
    flex-wrap: wrap;
  }
}
