/* Map-first product shell. Kept separate while legacy feature views are migrated building by building. */

.app-shell {
  padding: 0;
  background: #dfe8dd;
}

.phone-frame {
  max-width: var(--phone-max-width);
}

.app-surface {
  display: block;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #dfe8dd;
  box-shadow: none;
}

.town-view,
.map-panel,
.canvas-shell {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.town-view,
.map-panel {
  display: block;
}

.canvas-shell {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: linear-gradient(180deg, #cfe7f4 0%, #dcebd8 48%, #9fc58f 100%);
  box-shadow: none;
}

.map-canvas {
  width: 100%;
  height: 100%;
  min-height: 100%;
  border-radius: 0;
}

.map-overlay {
  inset: 0;
}

.hud-card {
  position: absolute;
  z-index: 8;
  top: max(12px, calc(var(--safe-top) + 8px));
  right: 12px;
  left: 12px;
  min-height: 54px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
}

.player-chip,
.resource-cluster {
  pointer-events: auto;
}

.player-chip {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 11px 6px 6px;
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(255, 252, 244, 0.54), rgba(232, 244, 226, 0.36)),
    rgba(255, 255, 255, 0.22);
  box-shadow:
    0 8px 24px rgba(41, 76, 59, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  transition: all 220ms ease;
  cursor: pointer;
}

.player-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(227, 174, 66, 0.4);
  box-shadow:
    0 10px 28px rgba(41, 76, 59, 0.22),
    0 3px 12px rgba(227, 174, 66, 0.2);
}

.player-chip:active {
  transform: translateY(0) scale(0.98);
  transition: transform 120ms ease;
}

.player-chip-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 245, 198, 0.72), transparent 58%),
    linear-gradient(145deg, rgba(143, 190, 158, 0.56), rgba(46, 107, 74, 0.32));
  color: #fffaf0;
  font-weight: 800;
  box-shadow:
    0 5px 14px rgba(46, 107, 74, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(10px) saturate(1.18);
  -webkit-backdrop-filter: blur(10px) saturate(1.18);
}

.player-chip-avatar-img {
  width: 118%;
  height: 118%;
  object-fit: contain;
  object-position: center bottom;
  transform: translateY(4%);
  filter: drop-shadow(0 5px 8px rgba(41, 76, 59, 0.2));
}

.player-chip-avatar[data-character-id="character_storybook_traveler"] .player-chip-avatar-img {
  transform: translateY(4%);
}

.player-chip-avatar[data-character-id="character_leaf_scout"] .player-chip-avatar-img {
  transform: translateY(4%);
}

.player-chip-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
  text-align: left;
}

.player-chip-copy strong {
  color: #294c3b;
  font-size: 0.82rem;
}

.player-chip-copy small {
  max-width: 100px;
  overflow: hidden;
  color: rgba(41, 76, 59, 0.62);
  font-size: 0.62rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-cluster {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: 999px;
  background: rgba(255, 252, 244, 0.97);
  box-shadow:
    0 8px 24px rgba(41, 76, 59, 0.16),
    0 2px 8px rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(14px);
}

.resource-pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 5px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  background: rgba(46, 107, 74, 0.08);
  color: #294c3b;
  font-size: 0.77rem;
  transition: all 180ms ease;
  position: relative;
}

.resource-pill-coin {
  background: linear-gradient(135deg, rgba(255, 236, 166, 0.92), rgba(255, 249, 224, 0.78));
  box-shadow: inset 0 0 0 1px rgba(227, 174, 66, 0.18);
}

.resource-pill-dice {
  background: linear-gradient(135deg, rgba(222, 239, 255, 0.9), rgba(239, 247, 255, 0.74));
  box-shadow: inset 0 0 0 1px rgba(126, 161, 199, 0.18);
}

.resource-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(41, 76, 59, 0.14));
}

.resource-label {
  color: rgba(41, 76, 59, 0.66);
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.resource-pill strong {
  transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
  display: inline-block;
  min-width: 1.2em;
  text-align: right;
}

.resource-pill.is-updating strong {
  animation: number-roll 0.4s ease-out;
}

.sync-indicator {
  width: 9px;
  height: 9px;
  margin-right: 4px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #4cbf67;
  box-shadow: 0 0 0 2px rgba(76, 191, 103, 0.14);
  transition: all 200ms ease;
}

.sync-indicator[data-syncing="true"] {
  animation: pulse-gentle 1.5s ease-in-out infinite;
  background: #e3ae42;
  box-shadow: 0 0 0 2px rgba(227, 174, 66, 0.3);
}

.sync-indicator[data-error="true"] {
  background: #c85a4a;
  box-shadow: 0 0 0 2px rgba(200, 90, 74, 0.2);
  animation: shimmer 1s ease-in-out infinite;
}

.map-hotspot-layer {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

.building-entry {
  --hotspot-width: 72px;
  --hotspot-height: 54px;
  --hotspot-scale: 1;
  position: absolute;
  top: 0;
  left: 0;
  width: var(--hotspot-width);
  height: var(--hotspot-height);
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #294c3b;
  pointer-events: auto;
  transform-origin: center bottom;
  will-change: transform;
  transition: all 220ms ease;
  cursor: pointer;
}

.building-entry:hover:not(.is-locked) {
  transform: scale(1.08) translateY(-3px);
}

.building-entry:active:not(.is-locked) {
  transform: scale(1) translateY(0);
  transition: transform 120ms ease;
}

.building-entry.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.building-entry.is-locked {
  filter: saturate(0.45) brightness(0.92);
}

.building-entry:focus-visible {
  outline: 2px solid rgba(255, 248, 220, 0.98);
  outline-offset: 4px;
}

.building-entry-glow {
  position: absolute;
  inset: 0;
  border: 1px solid transparent;
  border-radius: inherit;
  background: transparent;
  pointer-events: none;
  transition: all 220ms ease;
}

.building-entry:hover:not(.is-locked) .building-entry-glow {
  /* No hover effect on transparent glow */
}

.building-entry[data-has-event="true"] .building-entry-glow {
  animation: glow-breathe 2.5s ease-in-out infinite;
}

.building-entry-icon {
  width: clamp(28px, calc(var(--hotspot-height) * 0.55), 38px);
  height: clamp(28px, calc(var(--hotspot-height) * 0.55), 38px);
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  color: transparent;
  font-size: 0;
  opacity: 0;
  pointer-events: none;
}

.building-entry[data-building-id="aiCottage"] .building-entry-icon {
  width: clamp(34px, calc(var(--hotspot-height) * 0.72), 52px);
  height: clamp(34px, calc(var(--hotspot-height) * 0.72), 52px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.62);
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 237, 169, 0.62), transparent 58%),
    rgba(255, 255, 255, 0.28);
  box-shadow:
    0 10px 24px rgba(41, 76, 59, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px) saturate(1.25);
  -webkit-backdrop-filter: blur(12px) saturate(1.25);
  opacity: 1;
}

.building-entry[data-building-id="aiCottage"] .building-entry-icon-img {
  width: 118%;
  height: 118%;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 7px 10px rgba(41, 76, 59, 0.18));
}

.building-entry-label,
.building-entry-progress,
.building-entry-badge {
  position: absolute;
  z-index: 2;
}

.building-entry-label {
  top: calc(-8px - min(12px, var(--hotspot-height) * 0.14));
  padding: 6px 13px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  box-shadow: 0 6px 18px rgba(41, 76, 59, 0.14);
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  color: #1f3a2c;
  font-size: 0.85rem;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.6);
}

.building-entry-progress {
  bottom: calc(-31px - min(12px, var(--hotspot-height) * 0.14));
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 252, 244, 0.82);
  color: rgba(41, 76, 59, 0.76);
  font-size: 0.6rem;
  line-height: 1;
  white-space: nowrap;
}

.building-entry-status {
  position: absolute;
  top: calc(-30px - min(12px, var(--hotspot-height) * 0.14));
  right: -6px;
  z-index: 4;
  max-width: 104px;
  overflow: hidden;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 12px 12px 12px 3px;
  background: rgba(255, 252, 244, 0.55);
  box-shadow: 0 5px 14px rgba(41, 76, 59, 0.12);
  backdrop-filter: blur(9px) saturate(1.15);
  -webkit-backdrop-filter: blur(9px) saturate(1.15);
  color: #294c3b;
  font-size: 0.6rem;
  font-weight: 800;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
}

/* Dialogue bubble tail pointing down toward the building */
.building-entry-status::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 12px;
  width: 10px;
  height: 10px;
  background: inherit;
  border-right: inherit;
  border-bottom: inherit;
  border-bottom-right-radius: 2px;
  transform: rotate(45deg);
  backdrop-filter: inherit;
  -webkit-backdrop-filter: inherit;
}

.building-entry.has-status .building-entry-glow {
  /* Golden particle animation when building has events */
}

.building-entry.has-status .building-entry-glow::before,
.building-entry.has-status .building-entry-glow::after {
  content: "";
  position: absolute;
  inset: -12px;
  border: 2px solid rgba(255, 209, 102, 0.6);
  border-radius: inherit;
  animation: golden-pulse 2s ease-in-out infinite;
  pointer-events: none;
}

.building-entry.has-status .building-entry-glow::after {
  inset: -20px;
  border-width: 1.5px;
  opacity: 0.5;
  animation-delay: 0.5s;
}

@keyframes golden-pulse {
  0% { transform: scale(0.8); opacity: 0; }
  40% { opacity: 0.8; }
  100% { transform: scale(1.3); opacity: 0; }
}

.building-entry-status[data-hint-tone="ai"] {
  background: rgba(238, 241, 255, 0.55);
  color: #405174;
}

.building-entry-status[data-hint-tone="market"] {
  background: rgba(255, 248, 222, 0.55);
  color: #8a5e14;
}

.building-entry-status[data-hint-tone="home"] {
  background: rgba(239, 248, 241, 0.55);
  color: #2f6b48;
}

.building-entry-badge {
  right: -2px;
  bottom: 1px;
  min-width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(255, 209, 102, 0.92);
  color: #624900;
  font-size: 0.58rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 4px 10px rgba(98, 73, 0, 0.16);
  transform: translate(28%, 18%);
}

.building-entry-badge[hidden] {
  display: none !important;
}

.building-entry.is-guide .building-entry-glow::before,
.building-entry.is-guide .building-entry-glow::after {
  content: "";
  position: absolute;
  inset: -10px;
  border: 2px solid rgba(255, 209, 102, 0.78);
  border-radius: inherit;
  box-shadow: 0 0 18px rgba(255, 209, 102, 0.46);
  animation: building-guide-pulse 2s ease-out infinite;
}

.building-entry.is-guide .building-entry-glow::after {
  inset: -18px;
  opacity: 0.45;
  animation-delay: 0.7s;
}

.task-preview-mount[hidden] {
  display: none !important;
}

.dice-view-mount {
  right: auto;
  bottom: max(16px, calc(var(--safe-bottom) + 10px));
  left: 50%;
  transform: translateX(-50%);
}

.dice-view-mount.is-dice-stage-active {
  position: fixed;
  inset: 0;
  z-index: 34;
  display: grid;
  place-items: center;
  transform: none;
  pointer-events: none;
}

.dice-view-mount.is-dice-stage-active .dice-fab-shell {
  width: 100%;
  height: 100%;
}

.dice-fab {
  width: 154px;
  min-height: 68px;
  grid-template-columns: auto auto;
  gap: 8px;
  padding: 8px 12px 8px 8px;
  border-color: rgba(255, 255, 255, 0.82);
  border-radius: 999px;
  background: rgba(255, 252, 244, 0.92);
  box-shadow: 0 14px 30px rgba(41, 76, 59, 0.25);
  backdrop-filter: blur(14px);
}

.dice-fab-copy {
  display: none;
}

.dice-fab-badge {
  order: 2;
}

.dice-roll-stage {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 235, 167, 0.28), transparent 27%),
    rgba(27, 60, 43, 0.18);
  -webkit-backdrop-filter: blur(8px) saturate(1.12);
  backdrop-filter: blur(8px) saturate(1.12);
  transition: opacity 180ms ease, visibility 180ms step-end;
}

.dice-roll-stage span {
  position: absolute;
  top: calc(50% + 128px);
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  background: rgba(255, 252, 244, 0.56);
  box-shadow: 0 10px 28px rgba(41, 76, 59, 0.16);
  color: #294c3b;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.dice-fab-shell.is-rolling .dice-roll-stage {
  opacity: 1 !important;
  visibility: visible !important;
  transition: opacity 180ms ease;
}

.dice-fab-shell.is-rolling .dice-fab {
  position: static;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  animation: none;
}

.dice-fab-shell.is-rolling .dice-fab-badge,
.dice-fab-shell.is-rolling .dice-fab-copy {
  opacity: 0;
}

.dice-fab-shell.is-rolling .dice-fab-visual {
  width: min(54vw, 232px);
  height: min(54vw, 232px);
  position: fixed;
  z-index: 36;
  top: 48%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: width 220ms ease, height 220ms ease, transform 220ms ease;
}

.dice-fab-shell.is-rolling .dice-fab-canvas {
  width: min(62vw, 266px);
  height: min(62vw, 266px);
}

.dice-fab-shell.is-rolling .dice-fab-cube {
  width: min(47vw, 196px);
  height: min(47vw, 196px);
  border-radius: 26px;
}

.dice-fab-shell.is-rolling .dice-pip {
  width: clamp(12px, 3.6vw, 16px);
  height: clamp(12px, 3.6vw, 16px);
}

.dice-fab-shell.is-rolling .pip-top-left,
.dice-fab-shell.is-rolling .pip-top-right {
  top: 21%;
}

.dice-fab-shell.is-rolling .pip-bottom-left,
.dice-fab-shell.is-rolling .pip-bottom-right {
  bottom: 21%;
}

.dice-fab-shell.is-rolling .pip-top-left,
.dice-fab-shell.is-rolling .pip-middle-left,
.dice-fab-shell.is-rolling .pip-bottom-left {
  left: 21%;
}

.dice-fab-shell.is-rolling .pip-top-right,
.dice-fab-shell.is-rolling .pip-middle-right,
.dice-fab-shell.is-rolling .pip-bottom-right {
  right: 21%;
}

.dice-fab-shell.is-rolling .pip-center {
  top: calc(50% - clamp(6px, 1.8vw, 8px));
  left: calc(50% - clamp(6px, 1.8vw, 8px));
}

.dice-fab-shell.is-rolling .pip-middle-left,
.dice-fab-shell.is-rolling .pip-middle-right {
  top: calc(50% - clamp(6px, 1.8vw, 8px));
}

@media (prefers-reduced-motion: reduce) {
  .dice-roll-stage,
  .dice-fab-shell.is-rolling .dice-fab-visual {
    transition-duration: 1ms;
  }
}

.building-layer {
  position: absolute;
  z-index: 20;
  right: 0;
  left: 0;
  margin: 0 auto;
  overflow: hidden;
  background: rgba(245, 249, 239, 0.96);
  box-shadow: 0 -18px 50px rgba(24, 48, 34, 0.24);
  backdrop-filter: blur(16px);
}

.building-layer[data-building-layer="home"],
.building-layer[data-building-layer="market"],
.building-layer[data-building-layer="aiCottage"],
.building-layer:has(.home-page),
.building-layer:has(.shop-page) {
  background: transparent;
}

.building-layer[data-building-layer="home"],
.building-layer[data-building-layer="market"],
.building-layer[data-building-layer="aiCottage"] {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.building-layer[data-building-layer="aiCottage"] {
  isolation: isolate;
  background:
    radial-gradient(circle at 18% 8%, rgba(255, 226, 151, 0.22), transparent 34%),
    linear-gradient(180deg, rgba(255, 252, 244, 0.12), rgba(236, 246, 235, 0.2)),
    url('../../assets/runtime/ui/ai-cottage-background.png');
  background-color: #eaf4df;
  background-size: 100% 100%, 100% 100%, contain;
  background-position: center, center, center top;
  background-repeat: no-repeat;
}

.building-layer[data-building-layer="aiCottage"]::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(
      180deg,
      rgba(234, 244, 223, 0) 0%,
      rgba(234, 244, 223, 0) 24%,
      rgba(244, 249, 232, 0.28) 38%,
      rgba(239, 247, 232, 0.68) 58%,
      rgba(234, 244, 223, 0.9) 100%
    ),
    radial-gradient(ellipse at 50% 40%, rgba(255, 246, 206, 0.28), transparent 58%);
  backdrop-filter: blur(14px) saturate(1.12);
  -webkit-backdrop-filter: blur(14px) saturate(1.12);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, transparent 22%, rgba(0, 0, 0, 0.24) 36%, #000 54%, #000 100%);
  mask-image: linear-gradient(180deg, transparent 0%, transparent 22%, rgba(0, 0, 0, 0.24) 36%, #000 54%, #000 100%);
}

.building-layer[hidden] {
  display: none !important;
}

.building-layer-full {
  inset: 0;
}

.building-layer-near-full {
  top: max(22px, calc(var(--safe-top) + 14px));
  bottom: 0;
  width: min(100%, var(--phone-max-width));
  border-radius: 28px 28px 0 0;
}

.building-layer-drawer {
  bottom: 0;
  width: min(100%, var(--phone-max-width));
  height: 85%;
  border-radius: 28px 28px 0 0;
}

.shop-page {
  --shop-background-image: url('../../assets/runtime/ui/shop-greeting-background-transparent.png');
  --shop-background-size: 100% auto;
  --shop-background-overlay:
    linear-gradient(
      180deg,
      rgba(239, 248, 241, 0) 0%,
      rgba(239, 248, 241, 0) 18%,
      rgba(249, 252, 241, 0.1) 34%,
      rgba(239, 248, 241, 0.22) 58%,
      rgba(232, 243, 219, 0.38) 100%
    ),
    radial-gradient(ellipse at 50% 40%, rgba(255, 247, 213, 0.14), transparent 60%);
  position: relative;
  isolation: isolate;
  min-height: 100%;
  display: grid;
  align-content: start;
  gap: 14px;
  padding: max(66px, calc(var(--safe-top) + 58px)) 18px max(20px, calc(var(--safe-bottom) + 16px));
  overflow: visible;
  color: #294c3b;
  background: transparent;
  -webkit-backdrop-filter: blur(10px) saturate(1.08);
  backdrop-filter: blur(10px) saturate(1.08);
}

.shop-page[data-shop-active-category="recommended"],
.shop-page[data-shop-active-category="wardrobe"],
.shop-page[data-shop-active-category="dice"],
.shop-page[data-shop-active-category="decor"] {
  background: transparent;
}

.shop-page::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--shop-background-image) center top / var(--shop-background-size) no-repeat;
  opacity: 0.9;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 54%, rgba(0, 0, 0, 0.72) 72%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 54%, rgba(0, 0, 0, 0.72) 72%, transparent 100%);
}

.shop-page::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--shop-background-overlay);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, transparent 18%, rgba(0, 0, 0, 0.24) 34%, #000 58%, #000 100%);
  mask-image: linear-gradient(180deg, transparent 0%, transparent 18%, rgba(0, 0, 0, 0.24) 34%, #000 58%, #000 100%);
}

.shop-header,
.shop-tabs,
.shop-grid {
  position: relative;
  z-index: 1;
}

.shop-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 26px;
  background: rgba(255, 253, 247, 0.34);
  box-shadow: 0 12px 30px rgba(41, 76, 59, 0.1);
  -webkit-backdrop-filter: blur(18px) saturate(1.16);
  backdrop-filter: blur(18px) saturate(1.16);
}

.shop-header h2 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
}

.shop-header p {
  margin: 5px 0 0;
  color: rgba(41, 76, 59, 0.68);
  font-size: 0.78rem;
  line-height: 1.5;
}

.shop-wallet {
  flex: 0 0 auto;
  padding: 9px 13px;
  border: 1px solid rgba(227, 174, 66, 0.28);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 248, 222, 0.56), rgba(255, 237, 179, 0.46));
  color: #8a5e14;
  font-size: 0.75rem;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(154, 104, 27, 0.12);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

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

.shop-tabs button {
  min-height: 38px;
  padding: 0 8px;
  border: 1px solid rgba(46, 107, 74, 0.1);
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.34);
  color: rgba(41, 76, 59, 0.68);
  font-size: 0.7rem;
  font-weight: 700;
  transition: all 180ms ease;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.shop-tabs button.is-active {
  border-color: rgba(76, 191, 103, 0.3);
  background: linear-gradient(135deg, rgba(46, 107, 74, 0.96), rgba(76, 191, 103, 0.82));
  color: #fffaf0;
  box-shadow: 0 6px 16px rgba(46, 107, 74, 0.2);
}

.shop-grid {
  min-height: 0;
  display: grid;
  gap: 14px;
  overflow: visible;
  padding-bottom: 18px;
}

.shop-card {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(46, 107, 74, 0.12);
  border-radius: 24px;
  background: rgba(255, 253, 247, 0.36);
  box-shadow: 0 14px 34px rgba(41, 76, 59, 0.13);
  -webkit-backdrop-filter: blur(18px) saturate(1.18);
  backdrop-filter: blur(18px) saturate(1.18);
  transition: all 220ms ease;
}

.shop-card:hover {
  border-color: rgba(76, 191, 103, 0.28);
  box-shadow: 0 14px 32px rgba(41, 76, 59, 0.14);
  transform: translateY(-2px);
}

.shop-card.is-owned {
  background: rgba(237, 247, 231, 0.4);
  border-color: rgba(76, 191, 103, 0.2);
}

.shop-preview {
  min-height: 90px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(76, 191, 103, 0.14);
  border-radius: 20px;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.52), transparent 38%),
    linear-gradient(145deg, rgba(76, 191, 103, 0.18), rgba(255, 209, 102, 0.16));
  color: #2e6b4a;
  font-size: 2.1rem;
  font-weight: 900;
  box-shadow: inset 0 2px 8px rgba(255, 255, 255, 0.4);
  overflow: hidden;
}

.shop-preview-img {
  width: 100%;
  height: 100%;
  min-height: 90px;
  object-fit: contain;
  padding: 8px;
}

.shop-confirm-preview {
  display: grid;
  place-items: center;
  margin-bottom: 8px;
}

.shop-confirm-preview img {
  width: 88px;
  height: 88px;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(41, 76, 59, 0.2));
}

.shop-card-body {
  display: grid;
  gap: 7px;
  align-content: start;
}

.shop-card-status {
  justify-self: start;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(143, 190, 158, 0.2);
  color: #4b765c;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.shop-card h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
}

.shop-card p {
  margin: 0;
  color: rgba(41, 76, 59, 0.68);
  font-size: 0.73rem;
  line-height: 1.6;
}

.shop-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
}

.shop-card-meta > span {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 248, 222, 0.76);
  color: #9a681b;
  font-size: 0.73rem;
  font-weight: 800;
}

.shop-card-action {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  background: linear-gradient(135deg, #2e6b4a, #3a8557);
  color: #fffaf0;
  font-size: 0.7rem;
  font-weight: 800;
  box-shadow: 0 6px 14px rgba(46, 107, 74, 0.2);
  transition: all 180ms ease;
}

.shop-card-action:hover:not(:disabled) {
  box-shadow: 0 8px 18px rgba(46, 107, 74, 0.28);
  transform: translateY(-1px);
}

.shop-card-action:active:not(:disabled) {
  transform: translateY(0);
}

.shop-card-action:disabled {
  cursor: not-allowed;
  filter: saturate(0.35);
  opacity: 0.5;
  box-shadow: none;
}

.shop-confirm-sheet {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: end center;
  padding: 18px;
  background: linear-gradient(180deg, transparent, rgba(30, 48, 37, 0.28));
  backdrop-filter: blur(4px);
}

.shop-confirm-card {
  width: 100%;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 26px;
  background: rgba(255, 252, 244, 0.98);
  box-shadow: 0 20px 48px rgba(24, 48, 34, 0.28);
}

.shop-confirm-card h3 {
  margin: 3px 0 10px;
  font-size: 1.1rem;
  font-weight: 700;
}

.shop-confirm-card p {
  color: rgba(41, 76, 59, 0.7);
  font-size: 0.78rem;
  line-height: 1.65;
}

.shop-confirm-card strong {
  display: block;
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255, 248, 222, 0.84);
  color: #9a681b;
  font-size: 0.85rem;
  font-weight: 800;
}

.shop-confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.shop-alert {
  position: absolute;
  z-index: 5;
  top: 12px;
  right: 16px;
  left: 16px;
  padding: 9px 12px;
  border-radius: 14px;
  background: rgba(255, 248, 222, 0.92);
  color: #8a5e14;
  font-size: 0.7rem;
  font-weight: 800;
}

/* Home and memory galaxy */
.home-page {
  position: relative;
  isolation: isolate;
  min-height: 100%;
  padding: max(66px, calc(var(--safe-top) + 58px)) 16px max(22px, calc(var(--safe-bottom) + 18px));
  overflow: visible;
  background: transparent;
  -webkit-backdrop-filter: blur(10px) saturate(1.08);
  backdrop-filter: blur(10px) saturate(1.08);
}

.home-page::before {
  content: none;
}

.home-page::after {
  content: none;
}

.home-page > * {
  position: relative;
  z-index: 1;
}

.home-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 15px;
  align-items: center;
  min-height: 132px;
  padding: 18px 18px 17px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 28px;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 248, 222, 0.2), transparent 38%),
    rgba(255, 253, 247, 0.28);
  box-shadow: 0 14px 34px rgba(41, 76, 59, 0.12);
  -webkit-backdrop-filter: blur(18px) saturate(1.16);
  backdrop-filter: blur(18px) saturate(1.16);
}

.home-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: url('../../assets/runtime/ui/home-cottage-background.png') center 42% / 118% auto no-repeat;
  opacity: 0.76;
}

.home-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 252, 236, 0.54), rgba(255, 239, 178, 0.24) 52%, rgba(46, 107, 74, 0.1)),
    linear-gradient(180deg, rgba(255, 252, 236, 0.36), rgba(232, 243, 219, 0.14));
  -webkit-backdrop-filter: blur(4px) saturate(1.08);
  backdrop-filter: blur(4px) saturate(1.08);
}

.home-hero > * {
  position: relative;
  z-index: 1;
}

.home-character-orb {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border: 3px solid rgba(255, 255, 255, 0.88);
  border-radius: 30px;
  background: linear-gradient(145deg, #fff8de, #bfe5c6);
  color: #2e6b4a;
  font-size: 1.9rem;
  font-weight: 900;
  box-shadow: 0 16px 36px rgba(41, 76, 59, 0.16);
}

.home-character-portrait {
  width: 78px;
  height: 78px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 3px solid rgba(255, 255, 255, 0.88);
  border-radius: 30px;
  background:
    radial-gradient(circle at 48% 28%, rgba(255, 248, 222, 0.94), transparent 50%),
    linear-gradient(145deg, rgba(255, 248, 222, 0.9), rgba(191, 229, 198, 0.82));
  box-shadow: 0 16px 36px rgba(41, 76, 59, 0.16);
}

.home-character-portrait img {
  width: 118%;
  max-width: none;
  height: 118%;
  object-fit: contain;
  object-position: center bottom;
  transform: translateY(4%);
  display: block;
}

.home-hero h1 {
  margin: 0;
  color: #294c3b;
  font-size: 1.48rem;
  font-weight: 700;
}

.home-hero p {
  margin: 5px 0 0;
  color: rgba(41, 76, 59, 0.68);
  font-size: 0.76rem;
  line-height: 1.65;
}

.home-growth-card,
.home-panel {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid rgba(46, 107, 74, 0.12);
  border-radius: 26px;
  background: rgba(255, 253, 247, 0.34);
  box-shadow: 0 14px 34px rgba(41, 76, 59, 0.13);
  -webkit-backdrop-filter: blur(18px) saturate(1.18);
  backdrop-filter: blur(18px) saturate(1.18);
}

.home-growth-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background:
    radial-gradient(circle at 16% 20%, rgba(255, 246, 206, 0.18), transparent 42%),
    rgba(255, 253, 247, 0.18);
  -webkit-backdrop-filter: blur(18px) saturate(1.14);
  backdrop-filter: blur(18px) saturate(1.14);
}

.home-growth-card span {
  color: rgba(41, 76, 59, 0.62);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.home-growth-card strong {
  display: block;
  margin-top: 4px;
  color: #294c3b;
  font-size: 1.08rem;
  font-weight: 700;
}

.home-growth-card p {
  margin: 5px 0 0;
  color: rgba(41, 76, 59, 0.68);
  font-size: 0.72rem;
  line-height: 1.5;
}

.home-growth-card button {
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  background: linear-gradient(135deg, #2e6b4a, #3a8557);
  color: #fffaf0;
  font-size: 0.72rem;
  font-weight: 800;
  box-shadow: 0 6px 14px rgba(46, 107, 74, 0.18);
  transition: all 180ms ease;
}

.home-growth-card button:hover {
  box-shadow: 0 8px 18px rgba(46, 107, 74, 0.24);
  transform: translateY(-1px);
}

.home-function-block {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid rgba(46, 107, 74, 0.12);
  border-radius: 26px;
  background: rgba(255, 253, 247, 0.34);
  box-shadow: 0 14px 34px rgba(41, 76, 59, 0.13);
  -webkit-backdrop-filter: blur(18px) saturate(1.18);
  backdrop-filter: blur(18px) saturate(1.18);
}

.home-entry-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin-top: 12px;
}

.home-entry-grid button {
  min-height: 44px;
  padding: 0 8px;
  border: 1px solid rgba(46, 107, 74, 0.1);
  border-radius: 18px;
  background: rgba(255, 253, 247, 0.32);
  color: rgba(41, 76, 59, 0.74);
  font-size: 0.7rem;
  font-weight: 700;
  transition: all 180ms ease;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.home-entry-grid button:hover:not(.is-active) {
  background: rgba(255, 253, 247, 0.46);
  border-color: rgba(76, 191, 103, 0.2);
}

.home-entry-grid button.is-active {
  border-color: rgba(76, 191, 103, 0.3);
  background: linear-gradient(135deg, rgba(46, 107, 74, 0.96), rgba(76, 191, 103, 0.78));
  color: #fffaf0;
  box-shadow: 0 6px 16px rgba(46, 107, 74, 0.18);
}

.home-status-grid {
  display: grid;
  gap: 16px;
}

.home-status-grid h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #294c3b;
}

.home-character-section {
  display: grid;
  gap: 12px;
}

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

.home-character-card {
  --character-accent: #7c9f6f;
  position: relative;
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 116px;
  padding: 12px;
  overflow: visible;
  border: 1px solid rgba(46, 107, 74, 0.1);
  border-radius: 24px;
  background:
    radial-gradient(circle at 18% 18%, color-mix(in srgb, var(--character-accent) 24%, transparent), transparent 34%),
    rgba(255, 253, 247, 0.36);
  color: #294c3b;
  text-align: left;
  box-shadow: 0 12px 28px rgba(41, 76, 59, 0.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.14);
  backdrop-filter: blur(14px) saturate(1.14);
}

.home-character-card.is-selected {
  border-color: color-mix(in srgb, var(--character-accent) 56%, white);
  background:
    radial-gradient(circle at 18% 18%, color-mix(in srgb, var(--character-accent) 32%, transparent), transparent 36%),
    linear-gradient(145deg, rgba(255, 253, 247, 0.48), rgba(239, 248, 241, 0.38));
  box-shadow: 0 16px 34px rgba(41, 76, 59, 0.14);
}

.home-character-card-art {
  position: relative;
  width: 78px;
  height: 84px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 20px;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 248, 222, 0.92), transparent 50%),
    linear-gradient(160deg, rgba(255, 248, 222, 0.88), color-mix(in srgb, var(--character-accent) 28%, #ffffff));
}

.home-character-card-portrait {
  width: 76px;
  max-width: 100%;
  height: 76px;
  object-fit: contain;
  object-position: center;
  display: block;
  filter: drop-shadow(0 8px 12px rgba(41, 76, 59, 0.16));
}

.home-character-card-map {
  width: 30px;
  height: 30px;
  position: absolute;
  right: 5px;
  bottom: 5px;
  object-fit: cover;
  object-position: left top;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 15px;
  background: rgba(255, 252, 244, 0.68);
  box-shadow: 0 8px 18px rgba(41, 76, 59, 0.16);
}

.home-character-card-copy {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 14px 4px 0 0;
}

.home-character-card-copy strong {
  font-size: 0.92rem;
  line-height: 1.2;
}

.home-character-card-copy em {
  color: color-mix(in srgb, var(--character-accent) 70%, #294c3b);
  font-size: 0.66rem;
  font-style: normal;
  font-weight: 900;
}

.home-character-card-copy small {
  color: rgba(41, 76, 59, 0.64);
  font-size: 0.64rem;
  line-height: 1.42;
}

.home-character-card-state {
  position: absolute;
  top: 9px;
  right: 9px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 252, 244, 0.82);
  color: color-mix(in srgb, var(--character-accent) 76%, #294c3b);
  font-size: 0.62rem;
  font-weight: 900;
}

@media (max-width: 420px) {
  .home-character-grid {
    grid-template-columns: 1fr;
  }
}

.home-decoration-chip {
  display: inline-flex;
  margin: 6px 8px 0 0;
  padding: 7px 11px;
  border: 1px solid rgba(227, 174, 66, 0.24);
  border-radius: 999px;
  background: rgba(255, 248, 222, 0.88);
  color: #9a681b;
  font-size: 0.7rem;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(154, 104, 27, 0.08);
}

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

.home-decoration-card {
  min-height: 96px;
  display: grid;
  gap: 7px;
  place-items: center;
  padding: 10px;
  border: 1px solid rgba(227, 174, 66, 0.2);
  border-radius: 20px;
  background: rgba(255, 248, 222, 0.34);
  color: #9a681b;
  font-size: 0.7rem;
  font-weight: 800;
  text-align: center;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.home-decoration-card img {
  max-width: 76px;
  max-height: 58px;
  object-fit: contain;
  filter: drop-shadow(0 8px 12px rgba(154, 104, 27, 0.16));
}

.home-settings-panel {
  display: grid;
  gap: 14px;
}

.setting-list,
.home-ai-settings,
.home-ai-config-copy {
  display: grid;
  gap: 10px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(46, 107, 74, 0.07);
  color: #294c3b;
  font-size: 0.76rem;
  font-weight: 800;
}

.home-ai-settings {
  padding: 14px;
  border: 1px solid rgba(46, 107, 74, 0.1);
  border-radius: 22px;
  background:
    radial-gradient(circle at 10% 10%, rgba(255, 209, 102, 0.18), transparent 38%),
    rgba(255, 252, 244, 0.72);
}

.home-ai-config-copy {
  padding: 12px;
  border-radius: 16px;
  background: rgba(46, 107, 74, 0.07);
  color: rgba(41, 76, 59, 0.72);
  font-size: 0.72rem;
  line-height: 1.6;
}

.home-ai-config-copy p,
.home-ai-config-copy strong {
  margin: 0;
}

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

.field,
.field-wide {
  display: grid;
  gap: 6px;
}

.field-wide {
  grid-column: 1 / -1;
}

.field span {
  color: rgba(41, 76, 59, 0.65);
  font-size: 0.68rem;
  font-weight: 900;
}

.field input,
.field select {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(46, 107, 74, 0.13);
  border-radius: 13px;
  padding: 0 10px;
  background: rgba(255, 253, 247, 0.86);
  color: #294c3b;
  font: inherit;
  font-size: 0.76rem;
}

.memory-galaxy {
  min-height: 520px;
  position: relative;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 28px;
  background:
    radial-gradient(circle at 25% 30%, rgba(255, 209, 102, 0.16), transparent 24%),
    radial-gradient(circle at 68% 18%, rgba(180, 154, 255, 0.16), transparent 25%),
    linear-gradient(160deg, #0d1f1f, #173433 55%, #1d2b3b);
  box-shadow: 0 22px 48px rgba(13, 31, 31, 0.28);
}

.memory-galaxy.is-three-galaxy {
  min-height: calc(100dvh - 168px);
  display: grid;
  grid-template-rows: minmax(320px, 1fr) auto;
}

.memory-galaxy.home-memory-card {
  min-height: 430px;
  display: grid;
  grid-template-rows: auto minmax(230px, 1fr) auto;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background:
    radial-gradient(circle at 18% 14%, rgba(255, 209, 102, 0.18), transparent 25%),
    radial-gradient(circle at 72% 18%, rgba(180, 154, 255, 0.18), transparent 28%),
    linear-gradient(160deg, rgba(13, 31, 31, 0.78), rgba(23, 52, 51, 0.74) 55%, rgba(29, 43, 59, 0.78));
  box-shadow: 0 18px 42px rgba(13, 31, 31, 0.24);
  -webkit-backdrop-filter: blur(16px) saturate(1.16);
  backdrop-filter: blur(16px) saturate(1.16);
}

.home-memory-card-head {
  position: relative;
  z-index: 2;
  padding: 16px 16px 0;
}

.home-memory-card-head h2 {
  margin: 2px 0 0;
  color: #fff8de;
  font-size: 1.1rem;
}

.home-memory-card .memory-galaxy-stage {
  min-height: 230px;
}

.home-memory-card .memory-galaxy-canvas {
  min-height: 230px;
  touch-action: pan-y;
}

.home-memory-card .memory-detail {
  margin: 0 14px 14px;
  background: rgba(244, 249, 238, 0.34);
  color: #294c3b;
  -webkit-backdrop-filter: blur(16px) saturate(1.16);
  backdrop-filter: blur(16px) saturate(1.16);
}

.memory-galaxy-stage {
  position: relative;
  min-height: 420px;
  overflow: hidden;
}

.memory-galaxy-canvas {
  width: 100%;
  height: 100%;
  min-height: 420px;
  display: block;
  cursor: grab;
  touch-action: none;
}

.memory-galaxy-canvas:active {
  cursor: grabbing;
}

.memory-galaxy-signature {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 52%, transparent 0 28%, rgba(6, 20, 20, 0.18) 46%, rgba(6, 20, 20, 0.58) 100%),
    linear-gradient(180deg, rgba(255, 248, 222, 0.08), transparent 34%);
}

.memory-galaxy-signature span {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 72%, rgba(255, 209, 102, 0.18), transparent 32%);
  animation: memory-window-fade 1200ms ease-out both;
}

.memory-starfield {
  min-height: 320px;
  position: relative;
  background-image:
    radial-gradient(circle at 20% 80%, rgba(255,255,255,.65) 0 1px, transparent 1.5px),
    radial-gradient(circle at 76% 22%, rgba(255,255,255,.48) 0 1px, transparent 1.5px),
    radial-gradient(circle at 56% 64%, rgba(255,255,255,.42) 0 1px, transparent 1.5px);
}

.memory-star {
  width: var(--star-size);
  height: var(--star-size);
  position: absolute;
  left: 50%;
  top: 48%;
  border-radius: 50%;
  background: transparent;
  transform: rotate(var(--angle)) translateX(var(--radius)) rotate(calc(-1 * var(--angle)));
}

.is-three-galaxy .memory-star-list {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.is-three-galaxy .memory-galaxy-stage.is-webgl-unavailable {
  display: grid;
  align-items: center;
  padding: 18px;
}

.is-three-galaxy .memory-galaxy-stage.is-webgl-unavailable .memory-star-list {
  position: relative;
  inset: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: center;
  pointer-events: auto;
}

.is-three-galaxy .memory-star {
  width: auto;
  height: auto;
  left: auto;
  top: auto;
  right: 14px;
  bottom: calc(18px + var(--star-offset, 0px));
  max-width: min(58%, 260px);
  padding: 5px 9px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(244, 249, 238, 0.1);
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.62rem;
  font-weight: 800;
  pointer-events: auto;
  transform: none;
}

.is-three-galaxy .memory-star span {
  width: auto;
  height: auto;
  display: inline;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.is-three-galaxy .memory-star.is-candidate {
  border-color: rgba(180, 154, 255, 0.36);
  color: rgba(215, 194, 255, 0.86);
}

.is-three-galaxy .memory-star.is-confirmed {
  border-color: rgba(255, 209, 102, 0.3);
}

.is-three-galaxy .memory-star.is-selected {
  background: rgba(255, 248, 222, 0.18);
  color: #fff8de;
}

.memory-star span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: #ffd166;
  box-shadow: 0 0 18px rgba(255, 209, 102, 0.9);
}

.memory-star.is-candidate span {
  background: rgba(180, 154, 255, 0.82);
  box-shadow: 0 0 18px rgba(180, 154, 255, 0.8);
  opacity: 0.72;
}

.memory-star.is-selected span {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 4px;
}

.memory-empty {
  position: absolute;
  inset: 42% 24px auto;
  color: rgba(255, 255, 255, 0.72);
  text-align: center;
  font-size: 0.78rem;
  line-height: 1.7;
}

.memory-detail {
  position: relative;
  right: auto;
  bottom: auto;
  left: auto;
  margin: 0 14px 14px;
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  background: rgba(244, 249, 238, 0.92);
  backdrop-filter: blur(14px);
}

.memory-restore-bar {
  position: relative;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 14px 10px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 209, 102, 0.22);
  border-radius: 16px;
  background: rgba(255, 248, 222, 0.1);
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.72rem;
  font-weight: 800;
}

.memory-restore-bar button {
  border: 0;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255, 209, 102, 0.9);
  color: #2a2412;
  font-weight: 900;
}

.memory-detail input,
.memory-detail textarea {
  width: 100%;
  border: 1px solid rgba(46, 107, 74, 0.12);
  border-radius: 12px;
  background: rgba(255, 253, 247, 0.78);
  color: #294c3b;
  font: inherit;
}

.memory-detail input {
  padding: 8px 10px;
  font-weight: 900;
}

.memory-detail textarea {
  min-height: 76px;
  resize: vertical;
  padding: 10px;
  font-size: 0.74rem;
  line-height: 1.6;
}

.memory-detail small {
  color: rgba(41, 76, 59, 0.58);
  font-size: 0.64rem;
}

.memory-detail-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.memory-detail-actions button {
  min-height: 34px;
  border-radius: 999px;
  background: rgba(46, 107, 74, 0.1);
  color: #294c3b;
  font-size: 0.66rem;
  font-weight: 900;
}

@keyframes memory-window-fade {
  0% { opacity: 1; filter: blur(16px); transform: scale(1.08); }
  100% { opacity: 0.28; filter: blur(0); transform: scale(1); }
}

.building-layer-close {
  width: 38px;
  height: 38px;
  position: absolute;
  z-index: 3;
  top: max(12px, calc(var(--safe-top) + 8px));
  right: 12px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 50%;
  background: rgba(255, 252, 244, 0.9);
  box-shadow: 0 8px 22px rgba(41, 76, 59, 0.15);
  color: #294c3b;
  font-size: 1.2rem;
  font-weight: 800;
}

.building-placeholder-card {
  margin: 72px 18px 18px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 24px;
  background: rgba(255, 252, 244, 0.88);
  box-shadow: 0 16px 36px rgba(41, 76, 59, 0.16);
}

.building-lock-sheet {
  position: absolute;
  z-index: 30;
  inset: auto 0 0;
  display: grid;
  place-items: end center;
  padding: 18px;
  background: linear-gradient(180deg, transparent, rgba(30, 48, 37, 0.22));
  pointer-events: auto;
}

.building-lock-sheet[hidden] {
  display: none !important;
}

.building-lock-card {
  width: min(100%, calc(var(--phone-max-width) - 28px));
  position: relative;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 24px;
  background: rgba(255, 252, 244, 0.95);
  box-shadow: 0 18px 44px rgba(24, 48, 34, 0.24);
  color: #294c3b;
  backdrop-filter: blur(16px);
}

.building-lock-card h2 {
  margin: 4px 42px 8px 0;
  font-size: 1.1rem;
}

.building-lock-card p {
  margin: 0 0 14px;
  color: rgba(41, 76, 59, 0.72);
  font-size: 0.86rem;
  line-height: 1.55;
}

.building-lock-close {
  width: 32px;
  height: 32px;
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(46, 107, 74, 0.08);
  color: #294c3b;
  font-weight: 900;
}

/* AI cottage companion home */
.ai-cottage-page {
  position: relative;
  box-sizing: border-box;
  z-index: 1;
  min-height: 100%;
  display: grid;
  align-content: start;
  gap: 14px;
  padding: max(72px, calc(var(--safe-top) + 64px)) 16px max(18px, calc(var(--safe-bottom) + 14px));
  overflow: visible;
  color: #294c3b;
  background:
    radial-gradient(circle at 18% 8%, rgba(255, 226, 151, 0.22), transparent 34%),
    linear-gradient(180deg, rgba(255, 252, 244, 0.1), rgba(236, 246, 235, 0.18));
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: local;
}

.ai-cottage-header,
.ai-mode-strip,
.ai-home-hero,
.ai-assistant-switch,
.ai-panel-card,
.ai-quick-button,
.ai-action-card {
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: rgba(255, 252, 244, 0.34);
  box-shadow: 0 14px 34px rgba(41, 76, 59, 0.13);
  backdrop-filter: blur(18px) saturate(1.16);
  -webkit-backdrop-filter: blur(18px) saturate(1.16);
}

.ai-cottage-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 15px;
  border-radius: 26px;
  background:
    radial-gradient(circle at 8% 20%, rgba(255, 209, 102, 0.24), transparent 34%),
    rgba(255, 252, 244, 0.36);
}

@media (max-width: 380px) {
  .ai-cottage-header {
    gap: 10px;
    padding: 14px 14px 15px;
  }

  .ai-cottage-header h1 {
    font-size: 1.2rem;
  }

  .ai-cottage-header .compact-button {
    min-height: 36px;
    padding: 0 12px;
    white-space: nowrap;
  }
}

.ai-cottage-header h1,
.ai-home-copy h2,
.ai-panel-card h2,
.ai-action-card p {
  margin: 0;
}

.ai-cottage-header h1 {
  margin-top: 2px;
  font-size: 1.34rem;
}

.ai-cottage-header span,
.ai-mode-strip span,
.ai-home-copy p {
  color: rgba(41, 76, 59, 0.66);
  font-size: 0.78rem;
}

.ai-mode-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 10% 10%, rgba(126, 161, 199, 0.22), transparent 36%),
    rgba(255, 252, 244, 0.34);
  transition: background 240ms ease;
}

.ai-mode-strip.is-ready {
  background:
    radial-gradient(circle at 10% 10%, rgba(76, 191, 103, 0.22), transparent 36%),
    rgba(255, 252, 244, 0.38);
}

.ai-status-dot {
  font-size: 1.1rem;
  color: #c88f3a;
}

.ai-mode-strip.is-ready .ai-status-dot {
  color: #4cbf67;
}

.ai-setup-hint {
  margin: 0 0 4px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(227, 174, 66, 0.14);
  color: #294c3b;
  font-size: 0.76rem;
  line-height: 1.55;
}

.ai-setup-hint strong {
  color: #b77a00;
}

.ai-mode-strip div {
  display: grid;
  gap: 3px;
}

.ai-mode-strip strong {
  font-size: 0.94rem;
}

.ai-mode-strip p {
  margin: 0;
  color: rgba(41, 76, 59, 0.68);
  font-size: 0.72rem;
  line-height: 1.55;
}

.ai-home-hero {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  grid-template-rows: minmax(92px, auto) auto;
  gap: 15px;
  align-items: center;
  min-height: 178px;
  padding: 15px;
  overflow: visible;
  border-radius: 28px;
  background:
    radial-gradient(circle at 12% 22%, rgba(255, 209, 102, 0.22), transparent 38%),
    radial-gradient(circle at 86% 8%, rgba(126, 161, 199, 0.22), transparent 34%),
    linear-gradient(145deg, rgba(255, 252, 244, 0.34), rgba(236, 244, 232, 0.28));
}

.ai-companion-orb {
  width: 92px;
  height: 92px;
  margin: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 3px solid rgba(255, 250, 229, 0.94);
  border-radius: 32px 44px 42px 44px;
  background:
    radial-gradient(circle at 48% 35%, rgba(255, 255, 255, 0.74), transparent 35%),
    linear-gradient(145deg, rgba(143, 190, 158, 0.5), rgba(46, 107, 74, 0.18));
  box-shadow:
    0 16px 28px rgba(46, 107, 74, 0.18),
    0 0 0 7px rgba(255, 209, 102, 0.08);
}

.ai-companion-orb img {
  width: 116%;
  height: 116%;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 10px 12px rgba(41, 76, 59, 0.16));
}

.ai-companion-orb img[src*="expression-sheet"],
.ai-companion-orb img[src*="ai-leaf-ear-companion-transparent"] {
  width: 200%;
  max-width: none;
  height: auto;
  align-self: start;
  justify-self: start;
  object-fit: initial;
  object-position: initial;
}

.ai-home-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.ai-status-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.ai-status-grid span {
  display: grid;
  gap: 2px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(255, 253, 247, 0.34);
  box-shadow: inset 0 0 0 1px rgba(46, 107, 74, 0.06);
  -webkit-backdrop-filter: blur(10px) saturate(1.12);
  backdrop-filter: blur(10px) saturate(1.12);
}

.ai-status-grid strong {
  font-size: 1rem;
}

.ai-status-grid small,
.ai-quick-button span,
.ai-mini-task span {
  color: rgba(41, 76, 59, 0.62);
  font-size: 0.68rem;
}

.ai-assistant-switch {
  display: grid;
  gap: 11px;
  padding: 14px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 209, 102, 0.16), transparent 36%),
    rgba(255, 252, 244, 0.32);
}

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

.ai-assistant-card {
  min-height: 82px;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(46, 107, 74, 0.12);
  border-radius: 22px;
  background: rgba(255, 253, 247, 0.42);
  color: #294c3b;
  text-align: left;
  box-shadow: 0 10px 24px rgba(41, 76, 59, 0.08);
  -webkit-backdrop-filter: blur(12px) saturate(1.14);
  backdrop-filter: blur(12px) saturate(1.14);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.ai-assistant-card:hover {
  border-color: rgba(227, 174, 66, 0.32);
  background: rgba(255, 253, 247, 0.48);
  transform: translateY(-1px);
}

.ai-assistant-card.is-selected {
  border-color: rgba(76, 191, 103, 0.42);
  background:
    radial-gradient(circle at 18% 20%, rgba(76, 191, 103, 0.16), transparent 42%),
    rgba(255, 253, 247, 0.46);
  box-shadow: 0 14px 30px rgba(46, 107, 74, 0.14);
}

.ai-assistant-card img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  border-radius: 18px;
  filter: drop-shadow(0 7px 10px rgba(41, 76, 59, 0.14));
}

.ai-assistant-card span {
  display: grid;
  gap: 3px;
}

.ai-assistant-card strong {
  font-size: 0.82rem;
}

.ai-assistant-card small {
  color: rgba(41, 76, 59, 0.62);
  font-size: 0.66rem;
  font-weight: 800;
}

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

.ai-quick-button {
  min-height: 74px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 12px;
  border-radius: 20px;
  color: #294c3b;
  text-align: left;
  position: relative;
  transition: transform 220ms ease, box-shadow 220ms ease, background 220ms ease, border-color 220ms ease;
  cursor: pointer;
}

.ai-quick-button:hover {
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 209, 102, 0.18), transparent 38%),
    rgba(255, 252, 244, 0.48);
  box-shadow: 0 16px 34px rgba(41, 76, 59, 0.16);
  transform: translateY(-2px);
  border-color: rgba(227, 174, 66, 0.3);
}

.ai-quick-button:active {
  transform: translateY(0) scale(0.98);
  transition: transform 120ms ease;
}

.ai-quick-button strong {
  font-size: 0.84rem;
}

.ai-home-columns,
.ai-suggestion-stack,
.ai-session-list,
.ai-panel-card,
.ai-action-card {
  display: grid;
  gap: 10px;
}

.ai-panel-card {
  padding: 15px;
  border-radius: 24px;
}

.card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-heading h2,
.card-heading h3,
.card-heading p {
  margin: 0;
}

.card-heading small {
  color: rgba(41, 76, 59, 0.56);
  font-size: 0.68rem;
  font-weight: 900;
}

.ai-mini-task {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(255, 253, 247, 0.28);
  -webkit-backdrop-filter: blur(10px) saturate(1.12);
  backdrop-filter: blur(10px) saturate(1.12);
}

.ai-conversation-card {
  min-height: 260px;
  gap: 12px;
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.34), rgba(247, 248, 235, 0.26)),
    rgba(255, 252, 244, 0.28);
}

.ai-message-list {
  max-height: 360px;
  display: grid;
  gap: 10px;
  overflow-y: auto;
  padding: 8px;
  border-radius: 18px;
  background: rgba(255, 253, 247, 0.18);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  backdrop-filter: blur(10px) saturate(1.1);
}

.ai-message-list[data-empty="true"] {
  padding: 10px;
  background:
    radial-gradient(circle at 50% 22%, rgba(255, 209, 102, 0.16), transparent 42%),
    rgba(46, 107, 74, 0.045);
}

.ai-empty-workbench {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-height: 142px;
  align-content: center;
  padding: 18px;
  border: 1px dashed rgba(46, 107, 74, 0.18);
  border-radius: 20px;
  color: rgba(41, 76, 59, 0.7);
  text-align: center;
}

.ai-empty-spark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 209, 102, 0.24);
  color: #b77a00;
  font-size: 0.9rem;
  box-shadow: 0 8px 18px rgba(157, 113, 32, 0.12);
}

.ai-empty-workbench p {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.55;
}

.message-bubble {
  display: grid;
  gap: 5px;
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(255, 253, 247, 0.58);
  color: #294c3b;
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 4px 12px rgba(41, 76, 59, 0.08);
  -webkit-backdrop-filter: blur(10px) saturate(1.12);
  backdrop-filter: blur(10px) saturate(1.12);
  animation: fade-in 0.3s ease-out;
}

.message-bubble.is-user {
  justify-self: end;
  background: rgba(46, 107, 74, 0.12);
  border-color: rgba(46, 107, 74, 0.16);
}

.message-bubble small {
  color: rgba(41, 76, 59, 0.58);
  font-size: 0.62rem;
  font-weight: 900;
}

.message-bubble p {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.55;
}

.ai-composer textarea {
  min-height: 68px;
  resize: vertical;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.ai-composer textarea:focus {
  border-color: rgba(227, 174, 66, 0.4);
  box-shadow: 0 0 0 3px rgba(227, 174, 66, 0.12);
  outline: none;
}

.ai-composer .primary-button {
  min-height: 44px;
  align-self: stretch;
  border-radius: 18px;
}

.ai-conversation-card .error-copy {
  margin: 0;
  padding: 9px 11px;
  border: 1px solid rgba(155, 52, 43, 0.12);
  border-radius: 14px;
  background: rgba(255, 238, 232, 0.82);
  color: #9b342b;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.45;
}

.session-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-radius: 16px;
  background: rgba(46, 107, 74, 0.07);
  transition: all 200ms ease;
  cursor: pointer;
}

.session-row:hover {
  background: rgba(46, 107, 74, 0.12);
  transform: translateX(2px);
}

.session-row.is-active {
  background: rgba(76, 191, 103, 0.13);
  border: 1px solid rgba(76, 191, 103, 0.24);
}

.session-row button:first-child {
  min-width: 0;
  display: grid;
  gap: 2px;
  color: #294c3b;
  text-align: left;
}

.session-row small {
  color: rgba(41, 76, 59, 0.55);
  font-size: 0.64rem;
}

.ai-action-card {
  margin-top: 4px;
  padding: 10px;
  border-radius: 16px;
}

.ai-action-card.is-suggestion {
  background: rgba(227, 174, 66, 0.14);
}

.ai-action-card.is-result {
  background: rgba(76, 191, 103, 0.12);
}

.ai-action-card.is-memory {
  background: rgba(126, 161, 199, 0.14);
}

.ai-config-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  font-weight: 800;
}

.ai-config-card summary small {
  color: rgba(41, 76, 59, 0.62);
  font-size: 0.72rem;
  font-weight: 700;
}

.ai-config-card .form-grid {
  margin-top: 12px;
}

/* Full-screen travel journal */
.task-drawer {
  padding: 0;
}

.task-drawer::backdrop {
  background: rgba(30, 48, 37, 0.45);
  backdrop-filter: blur(8px);
}

.task-drawer-panel {
  --journal-accent: #4cbf67;
  --journal-accent-soft: rgba(76, 191, 103, 0.18);
  --journal-image: url("../../assets/runtime/ui/task-journal-pattern-today.jpeg");
  position: relative;
  width: min(100%, var(--phone-max-width));
  height: 100%;
  max-height: none;
  margin: 0 auto;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  border: 0;
  border-radius: 0;
  background-color: #edf4e8;
  background-image:
    linear-gradient(rgba(246, 240, 230, 0.2), rgba(239, 245, 234, 0.34)),
    var(--journal-image),
    radial-gradient(circle at 12% 18%, rgba(76, 191, 103, 0.16) 0 2px, transparent 3px),
    radial-gradient(circle at 78% 68%, rgba(227, 174, 66, 0.14) 0 1.5px, transparent 2.5px),
    repeating-linear-gradient(35deg, rgba(46, 107, 74, 0.025) 0 1px, transparent 1px 9px);
  background-position: center, center, 0 0, 0 0, 0 0;
  background-size: cover, cover, 38px 38px, 31px 31px, auto;
  box-shadow: 0 24px 80px rgba(24, 48, 34, 0.3);
}

.task-drawer-panel[data-journal-theme="journey"] {
  --journal-accent: #e3ae42;
  --journal-accent-soft: rgba(227, 174, 66, 0.2);
  --journal-image: url("../../assets/runtime/ui/task-journal-pattern-journey.jpeg");
  background-color: #f4e9d3;
}

.task-drawer-panel[data-journal-theme="records"] {
  --journal-accent: #7ea1c7;
  --journal-accent-soft: rgba(126, 161, 199, 0.2);
  --journal-image: url("../../assets/runtime/ui/task-journal-pattern-records.png");
  background-color: #e7eef1;
}

.journal-particles {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.journal-particles i {
  width: 5px;
  height: 5px;
  position: absolute;
  left: calc((var(--n, 1) * 7%) - 2%);
  bottom: -12px;
  border-radius: 50% 0 50% 50%;
  background: var(--journal-accent);
  opacity: 0;
  filter: blur(0.2px);
  animation: journal-particle-rise calc(6s + var(--n, 1) * 0.35s) ease-in infinite;
  animation-delay: calc(var(--n, 1) * -0.7s);
}

.journal-particles i:nth-child(1) { --n: 1; }
.journal-particles i:nth-child(2) { --n: 2; }
.journal-particles i:nth-child(3) { --n: 3; }
.journal-particles i:nth-child(4) { --n: 4; }
.journal-particles i:nth-child(5) { --n: 5; }
.journal-particles i:nth-child(6) { --n: 6; }
.journal-particles i:nth-child(7) { --n: 7; }
.journal-particles i:nth-child(8) { --n: 8; }
.journal-particles i:nth-child(9) { --n: 9; }
.journal-particles i:nth-child(10) { --n: 10; }
.journal-particles i:nth-child(11) { --n: 11; }
.journal-particles i:nth-child(12) { --n: 12; }
.journal-particles i:nth-child(13) { --n: 13; }
.journal-particles i:nth-child(14) { --n: 14; }

.task-drawer-header,
.task-journal-tabs,
.task-journal-summary,
.task-drawer-scroll,
.task-journal-footer {
  position: relative;
  z-index: 1;
}

.task-drawer-header {
  align-items: center;
  padding: max(17px, calc(var(--safe-top) + 12px)) 18px 13px;
  border: 0;
  background-image:
    linear-gradient(135deg, rgba(250, 247, 235, 0.86), rgba(231, 239, 218, 0.8)),
    var(--journal-image);
  background-position: center;
  background-size: cover;
  color: #294c3b;
  box-shadow: inset 0 -1px rgba(46, 107, 74, 0.1);
}

.task-drawer-close {
  width: 42px;
  min-height: 42px;
  padding: 0;
  border: 1px solid rgba(46, 107, 74, 0.14);
  background: rgba(255, 253, 247, 0.64);
  color: #294c3b;
  box-shadow: 0 5px 16px rgba(41, 76, 59, 0.1);
  font-size: 1.2rem;
}

.task-drawer-heading {
  flex: 1;
  gap: 2px;
}

.task-drawer-kicker {
  color: rgba(41, 76, 59, 0.6);
  font-size: 0.57rem;
  letter-spacing: 0.13em;
}

.task-drawer-title {
  color: #294c3b;
  font-size: 1.22rem;
}

.task-streak {
  padding: 7px 10px;
  border: 1px solid rgba(157, 113, 32, 0.2);
  border-radius: 999px;
  background: rgba(255, 250, 229, 0.6);
  color: #9a681b;
  font-size: 0.68rem;
  font-weight: 800;
}

.task-journal-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 10px 16px 0;
  background-image:
    linear-gradient(rgba(241, 244, 226, 0.76), rgba(241, 244, 226, 0.92)),
    var(--journal-image);
  background-position: center 42%;
  background-size: cover;
}

.task-journal-tabs button {
  min-height: 40px;
  border-radius: 15px 15px 0 0;
  color: rgba(41, 76, 59, 0.62);
  font-size: 0.78rem;
  font-weight: 700;
  transition: color 220ms ease, background 260ms ease, transform 220ms ease, box-shadow 260ms ease;
}

.task-journal-tabs button.is-active {
  background:
    radial-gradient(circle at 18% 30%, var(--journal-accent-soft) 0 2px, transparent 3px),
    linear-gradient(145deg, rgba(255,255,255,0.94), rgba(246,240,230,0.88));
  color: #294c3b;
  box-shadow: 0 -5px 16px rgba(19, 54, 35, 0.12);
  transform: translateY(-2px);
}

.task-journal-tabs button:not(.is-active):hover {
  color: #294c3b;
  background: rgba(255, 255, 255, 0.34);
}

.task-journal-summary {
  position: relative;
  margin: 14px 16px 4px;
  display: grid;
  gap: 9px;
  padding: 15px 16px;
  border: 1px solid rgba(113, 77, 35, 0.18);
  border-radius: 18px;
  background-image:
    linear-gradient(rgba(113, 77, 35, 0.04), rgba(82, 53, 23, 0.05)),
    url("../../assets/runtime/ui/task-progress-wood-board.jpeg"),
    repeating-linear-gradient(7deg, #d7a75e 0 5px, #ca944e 6px 9px, #dcb16d 10px 15px);
  background-position: center;
  background-size: 100% 100%, 154% 235%, cover;
  color: #3e2a16;
  box-shadow: 0 8px 20px rgba(81, 55, 25, 0.12), inset 0 0 18px rgba(255, 235, 177, 0.14);
  transform: rotate(-0.35deg);
}

.task-journal-summary > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.task-journal-summary span,
.task-journal-summary p {
  color: rgba(62, 42, 22, 0.76);
  font-size: 0.72rem;
}

.task-journal-summary strong {
  color: #3e2a16;
  font-size: 1.05rem;
}

.task-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.task-summary-grid div {
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 248, 222, 0.34);
}

.task-summary-grid dt,
.task-summary-grid dd {
  margin: 0;
}

.task-summary-grid dt {
  color: rgba(62, 42, 22, 0.64);
  font-size: 0.62rem;
}

.task-summary-grid dd {
  color: #3e2a16;
  font-size: 0.88rem;
  font-weight: 900;
}

.task-journal-progress-track {
  height: 7px;
  overflow: visible;
  border-radius: 99px;
  margin-right: 12px;
  background: rgba(255, 248, 222, 0.48);
  box-shadow: inset 0 1px 4px rgba(62, 42, 22, 0.2);
}

.task-journal-progress-track span {
  width: 0;
  height: 100%;
  display: block;
  border-radius: inherit;
  position: relative;
  background: linear-gradient(90deg, #4cbf67, #8fd36e 55%, #ffd166 100%);
  background-size: 200% 100%;
  transition: width 320ms ease;
  animation: progress-shimmer 2.2s linear infinite;
}

.task-journal-progress-track i {
  width: 24px;
  height: 24px;
  position: absolute;
  top: 50%;
  right: -12px;
  display: grid;
  place-items: center;
  border: 2px solid #fff7cf;
  border-radius: 50%;
  background: #2e6b4a;
  color: #ffd166;
  font-size: 0.68rem;
  font-style: normal;
  box-shadow: 0 3px 10px rgba(46, 107, 74, 0.3);
  transform: translateY(-50%);
  animation: progress-icon-breathe 1.7s ease-in-out infinite;
}

.task-journal-progress-track i b {
  --particle-x: 0px;
  width: 4px;
  height: 4px;
  position: absolute;
  left: 50%;
  top: 18px;
  border-radius: 50%;
  background: #ffd166;
  box-shadow: 0 0 6px rgba(255, 209, 102, 0.9);
  pointer-events: none;
  opacity: 0;
  animation: progress-particle-fall 1.5s ease-in infinite;
}

.task-journal-progress-track i b:nth-child(1) { --particle-x: -9px; animation-delay: -0.15s; }
.task-journal-progress-track i b:nth-child(2) { --particle-x: 7px; animation-delay: -0.72s; animation-duration: 1.8s; }
.task-journal-progress-track i b:nth-child(3) { --particle-x: -3px; animation-delay: -1.1s; animation-duration: 1.3s; }
.task-journal-progress-track i b:nth-child(4) { --particle-x: 11px; animation-delay: -1.4s; animation-duration: 2s; }
.task-journal-progress-track i b:nth-child(5) { --particle-x: -12px; animation-delay: -0.48s; animation-duration: 1.65s; }

.task-drawer-scroll {
  padding: 10px 16px 18px;
}

.task-group + .task-group {
  margin-top: 21px;
}

.task-group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  padding: 0 3px;
}

.task-group-heading h3 {
  color: #294c3b;
  font-size: 0.95rem;
  font-weight: 700;
}

.task-group-heading p {
  margin-top: 3px;
  color: rgba(41, 76, 59, 0.52);
  font-size: 0.66rem;
  font-weight: 500;
}

.task-group-heading > span {
  color: #4b8b62;
  font-size: 0.74rem;
  font-weight: 800;
}

.task-card {
  position: relative;
  min-height: 0;
  gap: 12px;
  padding: 15px;
  border-color: rgba(255, 255, 255, 0.56);
  border-radius: 5px 18px 13px 17px;
  overflow: hidden;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.46), rgba(255, 253, 247, 0.28)),
    radial-gradient(circle at 85% 15%, color-mix(in srgb, var(--journal-accent-soft) 72%, transparent), transparent 46%);
  -webkit-backdrop-filter: blur(16px) saturate(1.18);
  backdrop-filter: blur(16px) saturate(1.18);
  box-shadow: 0 10px 24px rgba(46, 107, 74, 0.1);
  transition: all 280ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.task-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 20%, rgba(255,255,255,0.6) 48%, transparent 72%);
  opacity: 0;
  transform: translateX(-70%);
  transition: opacity 280ms ease, transform 480ms ease;
  pointer-events: none;
}

.task-card:hover {
  border-color: color-mix(in srgb, var(--journal-accent) 42%, transparent);
  box-shadow: 0 15px 30px rgba(46, 107, 74, 0.14);
  transform: translateY(-3px) rotate(-0.2deg);
}

.task-card:hover::after {
  opacity: 0.7;
  transform: translateX(70%);
}

.task-card + .task-card {
  margin-top: 10px;
}

.task-card:nth-child(even) {
  transform: rotate(0.2deg);
}

.task-card-main {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.task-card-expand {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(46, 107, 74, 0.14);
  border-radius: 12px;
  background: rgba(255, 253, 247, 0.42);
  color: #2e6b4a;
  font-size: 1rem;
  font-weight: 900;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.task-card-action {
  min-width: 56px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(46, 107, 74, 0.14);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(46, 107, 74, 0.94), rgba(76, 191, 103, 0.78));
  color: #fffaf0;
  font-size: 0.68rem;
  font-weight: 900;
  box-shadow: 0 6px 14px rgba(46, 107, 74, 0.16);
}

.task-card-action:disabled,
.task-add-button:disabled,
.task-ai-button:disabled {
  cursor: not-allowed;
  filter: saturate(0.35);
  opacity: 0.58;
}

.task-card.is-completed .task-card-action {
  background: rgba(255, 253, 247, 0.44);
  color: #4b765c;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.task-card-detail {
  margin: 11px 0 0 44px;
  padding: 10px 12px;
  border: 1px dashed rgba(46, 107, 74, 0.16);
  border-radius: 14px;
  background: rgba(255, 253, 247, 0.28);
  color: rgba(41, 76, 59, 0.7);
  font-size: 0.72rem;
  line-height: 1.65;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.task-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.task-card-tags span {
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--journal-accent-soft);
  color: #4b765c;
  font-size: 0.6rem;
  font-weight: 800;
}

.task-reward-hook {
  position: absolute;
  right: 22px;
  top: 50%;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.task-reward-stream {
  position: absolute;
  right: 22px;
  bottom: calc(max(13px, var(--safe-bottom) + 9px) + 64px);
  z-index: 3;
  display: grid;
  gap: 6px;
  pointer-events: none;
}

.task-reward-token {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 999px;
  background: rgba(255, 248, 222, 0.94);
  color: #9a681b;
  font-size: 0.68rem;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(157, 113, 32, 0.16);
  animation: task-reward-float 1100ms ease-out both;
}

.task-action-alert {
  position: relative;
  z-index: 2;
  margin: 8px 16px 0;
  padding: 9px 12px;
  border: 1px solid rgba(183, 122, 0, 0.18);
  border-radius: 14px;
  background: rgba(255, 248, 222, 0.82);
  color: #8a5e14;
  font-size: 0.7rem;
  font-weight: 800;
}

.task-empty-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.task-total-empty {
  min-height: 200px;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  padding: 24px 20px;
}

.task-total-empty .task-empty-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.task-total-empty .task-empty-copy {
  max-width: 280px;
  font-size: 0.82rem;
  line-height: 1.65;
}

.journal-story-panel {
  min-height: 360px;
  position: relative;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 30px 24px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: 8px 28px 14px 26px;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.72), rgba(255,255,255,0.38)),
    radial-gradient(circle at 80% 20%, var(--journal-accent-soft), transparent 50%);
  box-shadow: 0 18px 40px rgba(41, 76, 59, 0.12);
  backdrop-filter: blur(10px);
}

.journal-story-panel h3 { max-width: 280px; color: #294c3b; font-size: 1.15rem; line-height: 1.5; }
.journal-story-panel p { max-width: 310px; color: rgba(41,76,59,0.68); font-size: 0.78rem; line-height: 1.8; }
.journal-stamp { justify-self: start; padding: 6px 10px; border: 1px dashed var(--journal-accent); border-radius: 4px; color: var(--journal-accent); font-size: 0.6rem; font-weight: 900; letter-spacing: 0.12em; transform: rotate(-2deg); }
.journey-route { height: 150px; position: relative; margin-top: 20px; border-bottom: 3px dashed rgba(46,107,74,0.28); border-radius: 50%; transform: rotate(-8deg); }
.journey-route i { width: 22px; height: 22px; position: absolute; bottom: -12px; border: 5px solid white; border-radius: 50%; background: var(--journal-accent); box-shadow: 0 5px 12px rgba(46,107,74,0.2); }
.journey-route i:nth-child(1){left:5%}.journey-route i:nth-child(2){left:34%;bottom:4px}.journey-route i:nth-child(3){left:64%;bottom:-2px}.journey-route i:nth-child(4){right:2%;bottom:18px}
.record-tickets { display:grid; gap:10px; margin-top:18px; }
.record-tickets i { height:58px; border:1px dashed rgba(46,107,74,0.2); border-radius:7px 18px 8px 16px; background:rgba(255,255,255,0.45); transform:rotate(-0.5deg); }
.record-tickets i:nth-child(2){transform:rotate(0.8deg);background:var(--journal-accent-soft)}

.task-records-calendar {
  position: relative;
  min-height: 430px;
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 26px;
  background:
    radial-gradient(circle at 18% 16%, rgba(126, 161, 199, 0.18), transparent 38%),
    rgba(255, 253, 247, 0.32);
  box-shadow: 0 14px 34px rgba(41, 76, 59, 0.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.16);
  backdrop-filter: blur(16px) saturate(1.16);
}

.task-records-head {
  display: grid;
  gap: 8px;
}

.task-records-head h3 {
  margin: 0;
  color: #294c3b;
  font-size: 1.12rem;
}

.task-records-head p {
  margin: 3px 0 0;
  color: rgba(41, 76, 59, 0.62);
  font-size: 0.72rem;
}

.task-calendar-weekdays,
.task-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
}

.task-calendar-weekdays span {
  color: rgba(41, 76, 59, 0.54);
  font-size: 0.62rem;
  font-weight: 900;
  text-align: center;
}

.task-calendar-day {
  position: relative;
  min-height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(46, 107, 74, 0.1);
  border-radius: 16px;
  background: rgba(255, 253, 247, 0.28);
  color: rgba(41, 76, 59, 0.66);
  font-size: 0.78rem;
  font-weight: 900;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.task-calendar-day.has-record {
  border-color: rgba(126, 161, 199, 0.28);
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 209, 102, 0.2), transparent 42%),
    rgba(255, 253, 247, 0.42);
  color: #294c3b;
}

.task-calendar-day.is-selected {
  border-color: rgba(46, 107, 74, 0.36);
  box-shadow: 0 10px 22px rgba(46, 107, 74, 0.14);
}

.task-calendar-day.is-empty {
  min-height: 48px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.task-calendar-day strong {
  position: absolute;
  right: 5px;
  bottom: 5px;
  min-width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(227, 174, 66, 0.82);
  color: #fffaf0;
  font-size: 0.56rem;
}

.task-record-modal {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(30, 48, 37, 0.12);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
}

.task-record-card {
  width: min(100%, 330px);
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 26px;
  background: rgba(255, 253, 247, 0.38);
  box-shadow: 0 18px 48px rgba(24, 48, 34, 0.22);
  -webkit-backdrop-filter: blur(18px) saturate(1.18);
  backdrop-filter: blur(18px) saturate(1.18);
}

.task-record-card header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.task-record-card h3 {
  margin: 2px 0 0;
  color: #294c3b;
  font-size: 1.08rem;
}

.task-record-card header button {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.34);
  color: #294c3b;
  font-size: 1.05rem;
  font-weight: 900;
}

.task-record-list {
  display: grid;
  gap: 9px;
}

.task-record-item {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(46, 107, 74, 0.08);
  border-radius: 16px;
  background: rgba(255, 253, 247, 0.32);
}

.task-record-item strong {
  color: #294c3b;
  font-size: 0.84rem;
}

.task-record-item span,
.task-record-empty {
  color: rgba(41, 76, 59, 0.62);
  font-size: 0.7rem;
  line-height: 1.55;
}

@keyframes progress-shimmer { to { background-position: -200% 0; } }
@keyframes progress-icon-breathe { 50% { transform: translateY(-50%) scale(1.16) rotate(10deg); } }
@keyframes progress-particle-fall {
  0% { opacity: 0; transform: translate(-50%, -2px) scale(.65); }
  18% { opacity: .95; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--particle-x)), 35px) scale(.15); }
}
@keyframes task-reward-float {
  0% { opacity: 0; transform: translateY(12px) scale(0.92); }
  18% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-36px) scale(1.06); }
}

@keyframes task-complete-celebrate {
  0% { transform: scale(1); }
  30% { transform: scale(1.02) rotate(-0.5deg); }
  60% { transform: scale(0.98) rotate(0.5deg); }
  100% { transform: scale(1) rotate(0deg); }
}
@keyframes journal-particle-rise { 0% { opacity:0; transform:translate(0,0) rotate(0); } 15% { opacity:.28; } 75% { opacity:.16; } 100% { opacity:0; transform:translate(24px,-86vh) rotate(260deg); } }
@keyframes building-guide-pulse { 0% { transform:scale(.55); opacity:0; } 35% { opacity:.9; } 100% { transform:scale(1.22); opacity:0; } }
@keyframes building-guide-float { 50% { transform:translateY(-5px); } }

.tutorial-mount[hidden] {
  display: none !important;
}

.tutorial-layer {
  position: absolute;
  z-index: 60;
  inset: 0;
  pointer-events: none;
}

.tutorial-scrim {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 55%, transparent 0 32%, rgba(28, 48, 36, 0.16) 66%),
    linear-gradient(180deg, rgba(37, 61, 48, 0.12), rgba(37, 61, 48, 0.2));
  animation: tutorial-map-fade 520ms ease-out both;
}

.tutorial-dialog {
  width: min(332px, calc(100% - 28px));
  position: absolute;
  left: 50%;
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 24px;
  background: rgba(255, 252, 244, 0.94);
  box-shadow: 0 18px 42px rgba(24, 48, 34, 0.22);
  color: #294c3b;
  backdrop-filter: blur(16px);
  pointer-events: auto;
  transform: translateX(-50%);
}

.tutorial-layer[data-placement="center"] .tutorial-dialog {
  top: 50%;
  transform: translate(-50%, -50%);
}

.tutorial-layer[data-placement="top"] .tutorial-dialog {
  top: max(82px, calc(var(--safe-top) + 74px));
}

.tutorial-layer[data-placement="bottom"] .tutorial-dialog {
  bottom: max(104px, calc(var(--safe-bottom) + 88px));
}

.tutorial-eyebrow {
  margin: 0;
  color: rgba(46, 107, 74, 0.62);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.tutorial-dialog h2 {
  margin: 0;
  color: #294c3b;
  font-size: 1.08rem;
  line-height: 1.35;
}

.tutorial-dialog p:not(.tutorial-eyebrow) {
  margin: 0;
  color: rgba(41, 76, 59, 0.72);
  font-size: 0.8rem;
  line-height: 1.62;
}

.tutorial-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.tutorial-skip,
.tutorial-primary {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 900;
}

.tutorial-skip {
  border: 1px solid rgba(46, 107, 74, 0.14);
  background: rgba(255, 253, 247, 0.6);
  color: rgba(41, 76, 59, 0.72);
}

.tutorial-primary {
  border: 1px solid rgba(255, 255, 255, 0.62);
  background: linear-gradient(135deg, rgba(46, 107, 74, 0.96), rgba(76, 191, 103, 0.84));
  color: #fffaf0;
  box-shadow: 0 8px 18px rgba(46, 107, 74, 0.2);
}

.tutorial-reward-flight {
  position: absolute;
  left: 50%;
  bottom: 45%;
  z-index: 2;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 999px;
  background: rgba(255, 248, 222, 0.96);
  color: #9a681b;
  font-size: 0.72rem;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(157, 113, 32, 0.2);
  animation: tutorial-reward-to-dice 850ms cubic-bezier(.2,.8,.2,1) both;
}

body[data-tutorial-step="highlight_task_guild"] .building-entry[data-building-id="taskGuild"] .building-entry-glow,
body[data-tutorial-step="complete_first_task"] .building-entry[data-building-id="taskGuild"] .building-entry-glow,
body[data-tutorial-step="roll_dice"] .dice-fab {
  box-shadow:
    0 0 0 4px rgba(255, 209, 102, 0.22),
    0 0 28px rgba(255, 209, 102, 0.56),
    0 14px 30px rgba(41, 76, 59, 0.25);
}

body[data-tutorial-step="roll_dice"] .dice-fab {
  animation: tutorial-focus-breathe 1.7s ease-in-out infinite;
}

@keyframes tutorial-map-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes tutorial-focus-breathe {
  50% { transform: translateY(-3px) scale(1.03); }
}

@keyframes tutorial-reward-to-dice {
  0% { opacity: 0; transform: translate(-50%, 18px) scale(0.9); }
  22% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, 210px) scale(0.72); }
}

.task-card-checkbox {
  accent-color: #2e6b4a;
}

.task-card-body {
  display: grid;
  gap: 8px;
}

.task-card-title {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.4;
}

.task-card-source {
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(143, 190, 158, 0.2);
  color: #4b765c;
  font-size: 0.59rem;
  white-space: nowrap;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.task-card-desc {
  font-size: 0.72rem;
  line-height: 1.5;
  color: rgba(41, 76, 59, 0.68);
}

.task-card-time,
.task-card-reward {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  font-size: 0.71rem;
}

.reward-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  padding: 2px 7px 2px 3px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 999px;
  color: #5f4720;
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 6px 14px rgba(157, 113, 32, 0.1);
}

.reward-chip img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  filter: drop-shadow(0 3px 4px rgba(41, 76, 59, 0.12));
}

.reward-chip-coin {
  background: rgba(255, 239, 183, 0.52);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.reward-chip-dice {
  background: rgba(226, 241, 255, 0.5);
  color: #385f85;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.reward-empty {
  color: rgba(41, 76, 59, 0.48);
  font-size: 0.62rem;
  font-weight: 800;
}

.task-card-reward {
  color: #b77a00;
  font-weight: 700;
}

.task-card.is-completed {
  background:
    linear-gradient(120deg, rgba(226, 239, 226, 0.44), rgba(245, 251, 242, 0.3)),
    radial-gradient(circle at 85% 15%, rgba(76, 191, 103, 0.18), transparent 46%);
  animation: task-complete-celebrate 600ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.task-card.is-completed .task-card-title {
  color: rgba(41, 76, 59, 0.58);
  text-decoration: line-through;
}

.task-card.is-completed .task-card-desc,
.task-card.is-completed .task-card-time {
  color: rgba(41, 76, 59, 0.45);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.task-journal-footer {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 9px;
  padding: 11px 16px max(13px, calc(var(--safe-bottom) + 9px));
  border-top: 1px solid rgba(46, 107, 74, 0.08);
  background-image:
    linear-gradient(rgba(248, 246, 235, 0.86), rgba(236, 241, 222, 0.94)),
    var(--journal-image);
  background-position: center bottom;
  background-size: cover;
  box-shadow: 0 -8px 24px rgba(41, 76, 59, 0.06);
}

.task-journal-footer button {
  min-height: 47px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
}

.task-add-button {
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: linear-gradient(135deg, rgba(46, 107, 74, 0.96), rgba(74, 133, 87, 0.88));
  color: #fffaf0;
  box-shadow: 0 8px 18px rgba(46, 107, 74, 0.2);
}

.task-ai-button {
  border: 1px solid rgba(46, 107, 74, 0.15);
  background: rgba(255, 253, 247, 0.66);
  backdrop-filter: blur(8px);
  color: #2e6b4a;
}

/* 添加任务表单 */
.task-add-form[hidden] {
  display: none;
}

.task-add-form {
  position: absolute;
  left: 50%;
  bottom: max(78px, calc(var(--safe-bottom) + 74px));
  z-index: 3;
  width: min(340px, calc(100% - 28px));
  transform: translateX(-50%);
  display: grid;
  gap: 11px;
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: linear-gradient(180deg, #fffdf7 0%, #fbf7ec 100%);
  box-shadow: 0 18px 48px rgba(20, 31, 26, 0.24);
  animation: task-add-form-enter 0.28s ease-out;
}

@keyframes task-add-form-enter {
  from { opacity: 0; transform: translate(-50%, 14px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.task-add-form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.task-add-form-head strong {
  color: #294c3b;
  font-size: 0.92rem;
}

.task-add-form-close {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: rgba(46, 107, 74, 0.08);
  color: #294c3b;
  font-size: 1.1rem;
  line-height: 1;
}

.task-add-field {
  display: grid;
  gap: 5px;
}

.task-add-field span {
  color: rgba(41, 76, 59, 0.7);
  font-size: 0.72rem;
  font-weight: 700;
}

.task-add-field input,
.task-add-field select {
  min-height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(46, 107, 74, 0.18);
  background: rgba(255, 255, 255, 0.9);
  color: #294c3b;
  font-size: 0.84rem;
}

.task-add-field input:focus,
.task-add-field select:focus {
  outline: none;
  border-color: rgba(46, 107, 74, 0.5);
  box-shadow: 0 0 0 3px rgba(76, 191, 103, 0.16);
}

.task-add-error {
  margin: 0;
  color: #c0392b;
  font-size: 0.74rem;
}

.task-add-form-actions {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 9px;
}

.task-add-form-actions button {
  min-height: 42px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.task-add-form-cancel {
  border: 1px solid rgba(46, 107, 74, 0.15);
  background: rgba(255, 253, 247, 0.8);
  color: #2e6b4a;
}

.task-add-form-submit {
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: linear-gradient(135deg, rgba(46, 107, 74, 0.96), rgba(74, 133, 87, 0.88));
  color: #fffaf0;
  box-shadow: 0 8px 18px rgba(46, 107, 74, 0.2);
}

/* 撤销确认弹窗 */
.task-undo-confirm[hidden] {
  display: none;
}

.task-undo-confirm {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
}

.task-undo-confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 31, 26, 0.6);
  backdrop-filter: blur(8px);
  animation: fade-in 200ms ease-out;
}

.task-undo-confirm-card {
  position: relative;
  z-index: 51;
  width: min(100%, 340px);
  padding: 24px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: linear-gradient(180deg, #fffdf7 0%, #fefbf3 100%);
  box-shadow: 0 20px 60px rgba(20, 31, 26, 0.3);
  animation: slide-up 300ms ease-out;
  display: grid;
  gap: 16px;
  text-align: center;
}

.task-undo-confirm-card strong {
  color: #294c3b;
  font-size: 1.1rem;
  font-weight: 700;
}

.task-undo-confirm-card p {
  margin: 0;
  color: #426b57;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-line;
}

.task-undo-confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 8px;
}

.task-undo-cancel,
.task-undo-proceed {
  min-height: 44px;
  padding: 0 20px;
  border-radius: 14px;
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 200ms ease;
}

.task-undo-cancel {
  border: 1px solid rgba(46, 107, 74, 0.2);
  background: rgba(255, 253, 247, 0.9);
  color: #426b57;
}

.task-undo-cancel:hover {
  background: rgba(255, 253, 247, 1);
  border-color: rgba(46, 107, 74, 0.3);
  transform: translateY(-1px);
}

.task-undo-proceed {
  border: 1px solid rgba(200, 90, 74, 0.3);
  background: linear-gradient(135deg, #c85a4a, #a94a3d);
  color: #fffaf0;
  box-shadow: 0 6px 16px rgba(200, 90, 74, 0.25);
}

.task-undo-proceed:hover {
  background: linear-gradient(135deg, #d16555, #c85a4a);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(200, 90, 74, 0.3);
}

.task-undo-cancel:active,
.task-undo-proceed:active {
  transform: translateY(0) scale(0.98);
  transition: transform 100ms ease;
}

@media (min-width: 481px) {
  .app-shell {
    padding: 18px;
  }

  .app-surface,
  .canvas-shell,
  .map-canvas {
    border-radius: 34px;
  }

  .app-surface {
    box-shadow: 0 24px 70px rgba(41, 76, 59, 0.2);
  }
}

@media (max-width: 370px) {
  .player-chip-copy small {
    display: none;
  }

  .resource-pill {
    padding-inline: 7px;
  }

  .resource-label {
    display: none;
  }

  .task-journal-summary {
    margin-inline: 13px;
  }

  .task-drawer-scroll,
  .task-journal-footer {
    padding-inline: 13px;
  }

  .tutorial-dialog {
    width: calc(100% - 22px);
    padding: 14px;
  }
}

/* Building upgrade dialog */
.building-upgrade-dialog {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: linear-gradient(180deg, transparent, rgba(30, 48, 37, 0.24));
  pointer-events: auto;
}

.building-upgrade-card {
  width: min(360px, 100%);
  position: relative;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 24px;
  background: rgba(255, 252, 244, 0.96);
  box-shadow: 0 18px 44px rgba(24, 48, 34, 0.24);
  color: #294c3b;
  backdrop-filter: blur(16px);
}

.building-upgrade-close {
  width: 32px;
  height: 32px;
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(46, 107, 74, 0.08);
  color: #294c3b;
  font-weight: 900;
  font-size: 1.1rem;
}

.building-upgrade-card h2 {
  margin: 0 36px 12px 0;
  font-size: 1.2rem;
  color: #294c3b;
}

.building-upgrade-level {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.level-badge {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(46, 107, 74, 0.12);
  color: #2e6b4a;
  font-size: 0.74rem;
  font-weight: 900;
}

.max-level-badge {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 209, 102, 0.18);
  color: #9a681b;
  font-size: 0.68rem;
  font-weight: 900;
}

.building-upgrade-stats {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(46, 107, 74, 0.06);
  margin-bottom: 16px;
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.8rem;
}

.stat-row-next {
  padding-top: 10px;
  border-top: 1px dashed rgba(46, 107, 74, 0.15);
}

.stat-label {
  color: rgba(41, 76, 59, 0.68);
  font-weight: 700;
}

.stat-value {
  color: #294c3b;
  font-weight: 900;
}

.stat-value-highlight {
  color: #2e6b4a;
}

.stat-value-insufficient {
  color: rgba(183, 74, 74, 0.88);
}

.building-upgrade-confirm {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(46, 107, 74, 0.96), rgba(76, 191, 103, 0.84));
  color: #fffaf0;
  font-size: 0.82rem;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(46, 107, 74, 0.2);
}

.building-upgrade-confirm:disabled {
  cursor: not-allowed;
  filter: saturate(0.35);
  opacity: 0.58;
}

.building-upgrade-max-message {
  text-align: center;
  color: rgba(41, 76, 59, 0.68);
  font-size: 0.8rem;
  margin: 8px 0 0;
}

/* Map building overlay hotspots */
.map-building-hotspot {
  position: absolute;
  width: 48px;
  height: 48px;
  margin-left: -24px;
  margin-top: -24px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  pointer-events: auto;
  cursor: pointer;
  transform: translateZ(0);
  transition: transform 180ms ease;
}

.map-building-hotspot:hover {
  transform: translateZ(0) scale(1.12);
}

.map-building-hotspot::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  background: rgba(255, 209, 102, 0.0);
  transition: background 220ms ease;
}

.map-building-hotspot:hover::before {
  background: rgba(255, 209, 102, 0.22);
  box-shadow: 0 0 16px rgba(255, 209, 102, 0.4);
}

/* Building gold particle animation */
.building-entry.has-status::after {
  content: "";
  position: absolute;
  inset: -20px;
  pointer-events: none;
  background:
    radial-gradient(circle at 30% 40%, rgba(255, 209, 102, 0.4) 0 2px, transparent 3px),
    radial-gradient(circle at 65% 25%, rgba(255, 209, 102, 0.3) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 50% 70%, rgba(255, 209, 102, 0.35) 0 1.8px, transparent 3px);
  animation: building-gold-particles 3s ease-in-out infinite;
}

@keyframes building-gold-particles {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  20% {
    opacity: 0.85;
  }
  100% {
    opacity: 0;
    transform: scale(1.5);
  }
}

@media (prefers-reduced-motion: reduce) {
  .building-entry.is-guide .building-entry-glow::before,
  .building-entry.is-guide .building-entry-glow::after,
  body[data-tutorial-step="roll_dice"] .dice-fab,
  .tutorial-scrim,
  .tutorial-reward-flight,
  .building-entry.has-status::after {
    animation: none !important;
  }

  .tutorial-reward-flight {
    opacity: 1;
    transform: translate(-50%, 0);
  }

  .building-entry.has-status::after {
    opacity: 0.6;
    transform: scale(1.2);
  }
}
