:root {
  --bg1: #85d8ff;
  --bg2: #d3f2ff;
  --pink1: #ffb7d8;
  --pink2: #ff82b8;
  --pink3: #d85d93;
  --cream: #fffaf3;
  --lav2: #7d83d8;
  --mint: #93f2bb;
  --mint2: #48bb7b;
  --yellow: #ffe67a;
  --yellow2: #d6a842;
  --ink: #3d3366;
  --muted: #6c6799;
  --grass1: #6fe38b;
  --grass2: #3cbf64;
  --cloud: #ffffff;
  --dog1: #d9a16f;
  --dog2: #99633e;
  --dog3: #7a492d;
  --card-text: #2f2a52;
  --card-muted: #595381;
  --card-link: #2943a8;
  --card-border-soft: #8d86cb;
  --status-ok-bg: #effcef;
  --status-ok-fg: #21663c;
  --status-warn-bg: #fff6d8;
  --status-warn-fg: #8f6214;
  --status-danger-bg: #ffe1e8;
  --status-danger-fg: #9e3555;
}

* { box-sizing: border-box; image-rendering: pixelated; }
body {
  margin: 0;
  font-family: ui-monospace, 'Cascadia Code', 'Menlo', 'Consolas', 'Source Code Pro', monospace;
  color: var(--ink);
  background: linear-gradient(180deg, #78cfff 0%, #d4f4ff 45%, #fef6ff 100%);
  transition: background .2s ease, color .2s ease;
}
body[data-theme="night"] {
  --ink: #eef0ff;
  --muted: #bcc5ef;
  --card-text: #241f46;
  --card-muted: #514b7d;
  --card-link: #2a3a9e;
  --card-border-soft: #8a84cc;
  --status-ok-bg: #e5f6ea;
  --status-ok-fg: #246243;
  --status-warn-bg: #fff1c9;
  --status-warn-fg: #8c5d12;
  --status-danger-bg: #ffd9e5;
  --status-danger-fg: #9a3654;
  background: linear-gradient(180deg, #1a1e48 0%, #20295d 45%, #151630 100%);
}
.frame {
  border: 4px solid #5d5aa2;
  box-shadow: inset 0 0 0 2px #ffffff, 0 6px 0 #8f8ac8;
}
.candy {
  background: linear-gradient(180deg, #ffd5e7 0%, #ffbdd8 100%);
}
.white-panel {
  background: var(--cream);
  border: 4px solid #706bb6;
  box-shadow: inset 0 0 0 2px #fff, 0 6px 0 #b3afdf;
}
.dream-shell {
  min-height: 100vh;
  padding: 14px;
  max-width: min(100%, 1280px);
  margin-inline: auto;
}
.dream-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  margin-bottom: 14px;
}
.title-block {
  display: grid;
  gap: 4px;
}
.game-kicker {
  display: inline-block;
  width: fit-content;
  padding: 3px 8px;
  font-size: 10px;
  letter-spacing: .16em;
  color: #fffdf7;
  background: #6e67b2;
  border: 3px solid #4f4891;
  box-shadow: 0 3px 0 #2f2b61;
}
.game-title {
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1;
  letter-spacing: .08em;
  color: #fffef8;
  text-shadow: 4px 4px 0 #b95b87, 0 0 0 #fff;
}
.game-sub {
  max-width: 42rem;
  font-size: 12px;
  line-height: 1.5;
  color: #fff;
}
.top-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.stat-pill {
  min-width: 110px;
  padding: 8px 10px;
  background: rgba(255,255,255,.65);
  border: 3px solid #8d86cb;
}
.theme-toggle,
.layout-toggle {
  appearance: none;
  cursor: pointer;
  text-align: left;
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}
.theme-toggle:hover,
.theme-toggle:focus-visible,
.layout-toggle:hover,
.layout-toggle:focus-visible {
  transform: translateY(-1px);
  filter: brightness(1.04);
}
.theme-toggle-flash {
  animation: theme-flash 0.32s ease;
}
.stat-pill span {
  display: block;
  font-size: 10px;
  color: var(--muted);
}
.stat-pill b {
  display: block;
  margin-top: 3px;
  font-size: 17px;
  color: var(--ink);
  transition: opacity 0.12s ease;
}
.stat-pill small {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  color: var(--muted);
  opacity: .92;
}
.theme-toggle:hover small,
.theme-toggle:focus-visible small {
  color: var(--ink);
}
.dream-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.85fr);
  gap: 14px;
  align-items: start;
}
.hero-hud {
  margin-bottom: 14px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.9fr);
  gap: 14px;
  align-items: stretch;
  background: linear-gradient(180deg, rgba(255,255,255,.95) 0%, rgba(255,248,228,.95) 100%);
}
.hero-copy {
  display: grid;
  gap: 8px;
}
.hero-label {
  display: inline-block;
  width: fit-content;
}
.hero-title {
  margin: 0;
  font-size: clamp(20px, 3vw, 30px);
  line-height: 1.35;
  color: var(--ink);
}
.hero-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.75;
  color: var(--muted);
  max-width: 58ch;
}
.hero-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.hero-metric {
  padding: 10px;
  background: rgba(255,255,255,.82);
  border: 3px solid #8d86cb;
  box-shadow: inset 0 0 0 2px #fff5d8;
}
.hero-metric span {
  display: block;
  font-size: 10px;
  color: var(--muted);
}
.hero-metric b {
  display: block;
  margin-top: 4px;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
}
.hero-metric.emphasis {
  grid-column: 1 / -1;
  background: linear-gradient(180deg, #fff4bf 0%, #ffe58a 100%);
  border-color: #cc9f3d;
  box-shadow: inset 0 0 0 2px #fff9de;
}
.battle-card {
  padding: 12px;
  min-width: 0;
}
.battle-stage {
  position: relative;
  height: 520px;
  overflow: hidden;
  border: 4px solid #7f7cc3;
  background: linear-gradient(180deg, var(--bg1) 0%, var(--bg2) 68%, #d9ffd9 68%, #d9ffd9 100%);
  transition: background 0.28s ease, filter 0.28s ease, box-shadow 0.28s ease;
}
.battle-stage[data-battle-mode="alert-mode"] {
  box-shadow: inset 0 0 24px rgba(216, 93, 147, .22);
}
.battle-stage[data-battle-mode="scan-mode"] {
  filter: saturate(1.04);
}
.battle-stage[data-battle-mode="market-mode"] {
  box-shadow: inset 0 -16px 24px rgba(111, 227, 139, .18);
}
body[data-theme="night"] .battle-stage {
  background: linear-gradient(180deg, #20275f 0%, #4358aa 54%, #2e4b78 54%, #1f3553 100%);
}
body[data-theme="night"] .hero-hud {
  background: linear-gradient(180deg, rgba(252,251,255,.98) 0%, rgba(231,226,255,.98) 100%);
  border-color: #5a53a3;
  box-shadow: inset 0 0 0 2px #fff, 0 6px 0 #3d3875;
}
body[data-theme="night"] .intel-badge {
  background: #56479d;
  border-color: #35285f;
  box-shadow: 0 3px 0 #21183f;
}
body[data-theme="night"] .hero-label {
  background: #fff3bf;
  border-color: #b78f35;
  box-shadow: 0 3px 0 #7a5d1a;
  color: #3a2f12;
}
body[data-theme="night"] .hero-metric {
  background: rgba(255,255,255,.96);
}
body[data-theme="night"] .hero-metric.emphasis {
  background: linear-gradient(180deg, #fff2bf 0%, #ffd56a 100%);
  border-color: #ba8f34;
}
body[data-theme="night"] .moon,
body[data-theme="night"] .star {
  display: block;
}
.battle-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 8px 8px;
  opacity: .32;
}
.cloud,
.hill,
.grass,
.enemy-bubble,
.doggo,
.spark,
.dialog,
.moon,
.star,
.dog-particles {
  position: absolute;
}
.moon {
  right: 110px;
  top: 34px;
  width: 34px;
  height: 34px;
  background: #fff8bb;
  border: 4px solid #d6c36d;
  display: none;
}
.star {
  width: 8px;
  height: 8px;
  background: #fff7cc;
  border: 2px solid #d3b96b;
  display: none;
}
.star.st1 { right: 170px; top: 30px; }
.star.st2 { right: 80px; top: 90px; }
.star.st3 { left: 120px; top: 80px; }
.star.st4 { left: 260px; top: 36px; }
.cloud {
  height: 26px;
  background: var(--cloud);
  border: 4px solid #90b2e6;
}
body[data-theme="night"] .cloud,
body[data-theme="night"] .cloud::before,
body[data-theme="night"] .cloud::after {
  background: #dbe4ff;
  border-color: #7d97d8;
}
.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  background: var(--cloud);
  border: 4px solid #90b2e6;
}
.cloud.c1 { left: 40px; top: 40px; width: 72px; }
.cloud.c1::before { left: 8px; top: -18px; width: 24px; height: 18px; }
.cloud.c1::after { right: 10px; top: -14px; width: 28px; height: 14px; }
.cloud.c2 { right: 80px; top: 58px; width: 84px; }
.cloud.c2::before { left: 10px; top: -16px; width: 22px; height: 16px; }
.cloud.c2::after { right: 16px; top: -18px; width: 26px; height: 18px; }
.cloud.c3 { right: 220px; top: 24px; width: 64px; }
.cloud.c3::before { left: 8px; top: -12px; width: 20px; height: 12px; }
.cloud.c3::after { right: 10px; top: -16px; width: 24px; height: 16px; }
.hill.back {
  left: 40px;
  bottom: 108px;
  width: 220px;
  height: 100px;
  background: #a6f0a8;
  border: 4px solid #5fc77d;
  border-radius: 999px 999px 0 0;
}
.hill.front {
  right: 40px;
  bottom: 108px;
  width: 260px;
  height: 120px;
  background: #84df95;
  border: 4px solid #49b46a;
  border-radius: 999px 999px 0 0;
}
body[data-theme="night"] .hill.back {
  background: #7b9ae6;
  border-color: #4b69be;
}
body[data-theme="night"] .hill.front {
  background: #5f7dd1;
  border-color: #3f58a3;
}
body[data-theme="night"] .grass {
  background: repeating-linear-gradient(90deg, #3ca86d 0 22px, #277a4d 22px 44px);
  border-top-color: #215f40;
}
.grass {
  left: 0;
  right: 0;
  bottom: 0;
  height: 112px;
  background:
    repeating-linear-gradient(90deg, var(--grass1) 0 22px, var(--grass2) 22px 44px);
  border-top: 4px solid #3aa861;
}
.enemy-bubble {
  right: 24px;
  top: 26px;
  width: 280px;
  padding: 12px;
}
.enemy-name,
.player-name,
.command-title,
.side-title {
  color: var(--ink);
  font-size: 16px;
  line-height: 1.3;
}
.battle-hud-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}
.battle-kicker,
.dialog-kicker,
.intel-kicker,
.guestbook-kicker {
  font-size: 10px;
  letter-spacing: .15em;
  color: #8d5c7f;
}
.battle-kicker {
  margin-top: 4px;
}
.dialog-kicker,
.intel-kicker,
.guestbook-kicker {
  margin-bottom: 4px;
}
.battle-chip,
.intel-badge,
.guestbook-stamp,
.hero-label {
  min-width: 72px;
  padding: 6px 8px;
  text-align: center;
  font-size: 11px;
  color: #fffdf7;
  background: #6f67b7;
  border: 3px solid #4f4891;
  box-shadow: 0 3px 0 #2f2b61;
}
.battle-chip {
  min-width: 86px;
}
.battle-focus-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.battle-focus-card {
  padding: 8px;
  background: rgba(255,255,255,.82);
  border: 3px solid #8d86cb;
}
.battle-focus-card span {
  display: block;
  font-size: 10px;
  color: var(--muted);
}
.battle-focus-card b {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
}
.battle-focus-card small {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
}
.battle-broadcast-card {
  position: relative;
  overflow: hidden;
}
.battle-broadcast-card {
  padding-right: 52px;
}
.battle-broadcast-card::after {
  content: "LIVE";
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 6px;
  font-size: 9px;
  letter-spacing: .14em;
  color: #fffdf7;
  background: #ff7f96;
  border: 2px solid #b24768;
}
.quote-list-shell {
  margin-top: 8px;
  max-height: none;
  overflow: visible;
  padding-right: 0;
  position: relative;
  transition: max-height .22s steps(6), padding-right .16s steps(3);
}
.quote-list-shell.is-expanded {
  max-height: 760px;
  overflow: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: #7c74bf #f6efc8;
}
.quote-list-shell.is-expanded::after {
  content: '↓ 可向下捲動查看更多';
  position: sticky;
  bottom: 0;
  display: block;
  margin-top: 6px;
  padding: 4px 8px;
  font-size: 10px;
  letter-spacing: .08em;
  color: #fffdf7;
  background: linear-gradient(180deg, rgba(111,103,183,.95) 0%, rgba(79,72,145,.95) 100%);
  border: 2px solid #4f4891;
}
.quote-shell-animating {
  animation: quote-shell-pop .22s steps(5);
}
.flash-update {
  animation: flash-update .42s steps(4);
}
.mini-trend-refresh {
  animation: mini-trend-refresh .42s steps(4);
}
.step-refresh {
  animation: hud-step-refresh .24s steps(4);
}
.note-wall-pulse {
  animation: note-wall-pulse .28s steps(4);
}
.theme-scene-flash .frame,
.theme-scene-flash .hero-hud,
.theme-scene-flash .battle-card {
  animation: theme-scene-flash .28s steps(4);
}
.battle-stage-refresh .enemy-bubble,
.battle-stage-refresh .battle-focus-card,
.battle-stage-refresh .battle-chip {
  animation: hud-step-refresh .24s steps(4);
}
.quote-expand-btn {
  margin-top: 8px;
  width: 100%;
}
.quote-list-shell.is-expanded::-webkit-scrollbar {
  width: 14px;
}
.quote-list-shell.is-expanded::-webkit-scrollbar-track {
  background: #f6efc8;
  border: 3px solid #8d86cb;
}
.quote-list-shell.is-expanded::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #8d86cb 0%, #645bb2 100%);
  border: 3px solid #4d458f;
}
.quote-trend-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.mini-trend {
  display: inline-flex;
  align-items: end;
  gap: 2px;
  height: 24px;
  padding: 2px 4px;
  background: rgba(255,255,255,.55);
  border: 2px solid #8d86cb;
}
.mini-trend i {
  display: block;
  width: 4px;
  background: linear-gradient(180deg, #8ef0b8 0%, #4abf7b 100%);
  border: 1px solid #2f7f54;
}
.mini-trend-empty {
  color: var(--card-muted);
  font-size: 12px;
}
.quote-price-line {
  display: inline-block;
}
.quote-price-value {
  color: #2f2957;
}
.quote-mini-pattern {
  display: inline-block;
  margin-left: 8px;
  color: #514b7d;
}
.quote-change-badge {
  display: inline-block;
  min-width: 76px;
  padding: 4px 6px;
  text-align: center;
  font-size: 12px;
  letter-spacing: .08em;
  border: 3px solid #8d86cb;
  background: #fffef7;
  box-shadow: inset 0 0 0 2px #fff7d2;
}
.quote-change-badge.ok {
  color: #8b2840;
  background: linear-gradient(180deg, #ffd9e4 0%, #ff9db8 100%);
  border-color: #bf5a78;
}
.quote-change-badge.warn {
  color: #8a5a12;
  background: linear-gradient(180deg, #fff5cf 0%, #ffd97a 100%);
  border-color: #c49a2d;
}
.quote-change-badge.danger {
  color: #155a39;
  background: linear-gradient(180deg, #d7ffe2 0%, #99ecb7 100%);
  border-color: #4b9d67;
}
.weather-panel {
  order: -1;
}
.weather-head-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.weather-toggle-btn {
  padding: 6px 8px;
  font-size: 11px;
  min-width: 98px;
}
.quote-summary,
.weather-summary,
.weather-commute {
  margin-top: 8px;
  margin-bottom: 10px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--card-text);
  border: 3px solid #8d86cb;
}
.quote-summary {
  background: linear-gradient(180deg, #fff7d4 0%, #ffe9a7 100%);
  border-color: #d2a64a;
}
.weather-summary {
  background: linear-gradient(180deg, #f9f6ff 0%, #ebe4ff 100%);
}
.weather-commute {
  border-color: #d39a57;
  background: linear-gradient(180deg, #fff8de 0%, #ffe8b6 100%);
}
.weather-panel-collapsed #weather-list,
.weather-panel-collapsed #weather-summary,
.weather-panel-collapsed #weather-commute {
  display: none;
}
.weather-list {
  margin-top: 2px;
}
.hp-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.hp-wrap span {
  font-size: 12px;
  color: var(--muted);
}
.hp-bar {
  flex: 1;
  height: 16px;
  background: #dddaf8;
  border: 3px solid #6e67b2;
}
.hp-bar i {
  display: block;
  height: 100%;
  position: relative;
}
.hp-bar i::after {
  content: "";
  position: absolute;
  left: 0; top: 2px;
  width: 100%; height: 2px;
  background: rgba(255,255,255,.35);
  pointer-events: none;
}
.hp-bar.pink i {
  width: 74%;
  background: linear-gradient(90deg, var(--pink2) 0 78%, #dddaf8 78% 100%);
}
.hp-bar.green i {
  width: 92%;
  background: linear-gradient(90deg, var(--mint) 0 88%, #dddaf8 88% 100%);
}
.enemy-text {
  margin-top: 10px;
  font-size: 14px;
}
#current-status, #task-bubble {
  transition: opacity 0.12s ease;
}
.doggo {
  left: 92px;
  bottom: 110px;
  width: 188px;
  height: 180px;
  cursor: pointer;
  animation: bob 1.35s ease-in-out infinite;
  transform-origin: center bottom;
}
.dog-particles {
  inset: 0;
  pointer-events: none;
}
.dog-particle {
  position: absolute;
  width: 16px;
  height: 16px;
  opacity: 0;
}
.dog-particle.heart {
  background: #ff8db9;
  border: 3px solid #c55788;
  transform: rotate(45deg);
}
.dog-particle.heart::before,
.dog-particle.heart::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  background: #ff8db9;
  border: 3px solid #c55788;
  border-radius: 999px;
}
.dog-particle.heart::before { left: -10px; top: -1px; }
.dog-particle.heart::after { left: -1px; top: -10px; }
.dog-particle.star {
  background: #ffe67a;
  border: 3px solid #d6a842;
  transform: rotate(45deg);
}
.doggo:focus {
  outline: none;
}
.doggo:focus-visible {
  outline: 3px solid var(--lav2);
  outline-offset: 4px;
}
.doggo .ear,
.doggo .body,
.doggo .face,
.doggo .eye,
.doggo .nose,
.doggo .cheek,
.doggo .paw,
.doggo .tail-mount,
.doggo .tail,
.doggo .sleep-cap,
.doggo .glasses,
.doggo .siren-hat,
.doggo .scarf,
.doggo .pillow {
  position: absolute;
}
.doggo .sleep-cap,
.doggo .glasses,
.doggo .siren-hat,
.doggo .pillow {
  opacity: 0;
  transition: opacity .16s ease;
}
.doggo .sleep-cap {
  left: 52px;
  top: 12px;
  width: 84px;
  height: 24px;
  background: #7d83d8;
  border: 4px solid #555aa8;
}
.doggo .sleep-cap::after {
  content: "";
  position: absolute;
  right: -10px;
  top: 10px;
  width: 12px;
  height: 12px;
  background: #fff8c8;
  border: 3px solid #d6c36d;
  border-radius: 999px;
}
.doggo .glasses {
  left: 50px;
  top: 62px;
  width: 84px;
  height: 20px;
  border-top: 4px solid #414b86;
}
.doggo .glasses::before,
.doggo .glasses::after {
  content: "";
  position: absolute;
  top: 0;
  width: 24px;
  height: 18px;
  border: 4px solid #414b86;
  background: rgba(255,255,255,.2);
}
.doggo .glasses::before { left: 0; }
.doggo .glasses::after { right: 0; }
.doggo .siren-hat {
  left: 74px;
  top: 10px;
  width: 38px;
  height: 20px;
  background: #ffd76d;
  border: 4px solid #c49a2d;
}
.doggo .siren-hat::after {
  content: "";
  position: absolute;
  left: 8px;
  top: -12px;
  width: 14px;
  height: 12px;
  background: #ff6c87;
  border: 4px solid #bf3d5f;
}
.doggo .pillow {
  left: 34px;
  top: 106px;
  width: 120px;
  height: 46px;
  background: #f7f1ff;
  border: 4px solid #b4a4de;
}
.doggo .scarf {
  left: 56px;
  top: 104px;
  width: 72px;
  height: 16px;
  background: #ff8eb4;
  border: 4px solid #d85d93;
  opacity: .92;
}
.doggo .scarf::after {
  content: "";
  position: absolute;
  right: 8px;
  top: 10px;
  width: 16px;
  height: 24px;
  background: #ff8eb4;
  border: 4px solid #d85d93;
}
.doggo .ear {
  top: 18px;
  width: 34px;
  height: 48px;
  background: var(--dog3);
  border: 4px solid #5c321d;
}
.doggo .ear.left { left: 36px; }
.doggo .ear.right { right: 36px; }
.doggo .body {
  left: 42px;
  top: 84px;
  width: 104px;
  height: 58px;
  background: var(--dog1);
  border: 4px solid var(--dog2);
}
.doggo .face {
  left: 34px;
  top: 42px;
  width: 120px;
  height: 74px;
  background: var(--dog1);
  border: 4px solid var(--dog2);
}
.doggo .eye {
  top: 66px;
  width: 10px;
  height: 14px;
  background: #2b1c1c;
  transform-origin: 50% 60%;
}
.doggo .eye.left { left: 68px; }
.doggo .eye.right { right: 68px; }
.doggo .nose {
  left: 86px;
  top: 82px;
  width: 16px;
  height: 12px;
  background: #3b2b2b;
}
.doggo .cheek {
  top: 86px;
  width: 12px;
  height: 8px;
  background: #ffb3c6;
}
.doggo .cheek.left { left: 58px; }
.doggo .cheek.right { right: 58px; }
.doggo .paw {
  top: 136px;
  width: 20px;
  height: 20px;
  background: var(--dog1);
  border: 4px solid var(--dog2);
}
.doggo .p1 { left: 56px; }
.doggo .p2 { right: 56px; }
.doggo .tail-mount {
  right: 24px;
  top: 98px;
  width: 20px;
  height: 38px;
  pointer-events: none;
  perspective: 72px;
  perspective-origin: 2px 55%;
  transform-style: preserve-3d;
}
.doggo .tail {
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: var(--dog3);
  border: 4px solid #5c321d;
  transform-origin: 2px 6px;
  animation: tail-wag-mellow 2.7s cubic-bezier(0.45, 0, 0.55, 1) infinite;
  backface-visibility: hidden;
}
.doggo .bone {
  position: absolute;
  left: 88px;
  top: 92px;
  width: 32px;
  height: 11px;
  background: #fff9ec;
  border: 3px solid #a89878;
  border-radius: 3px;
  opacity: 0;
  z-index: 5;
  transform: rotate(-16deg);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
  pointer-events: none;
}
.doggo .bone::before,
.doggo .bone::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 11px;
  height: 11px;
  background: inherit;
  border: 3px solid #a89878;
  border-radius: 999px;
  transform: translateY(-50%);
}
.doggo .bone::before {
  left: -7px;
}
.doggo .bone::after {
  right: -7px;
}
.spark {
  width: 12px;
  height: 12px;
  background: var(--yellow);
  border: 3px solid var(--yellow2);
  transform: rotate(45deg);
}
.spark.s1 { left: 300px; top: 160px; }
.spark.s2 { left: 260px; top: 110px; }
.spark.s3 { left: 330px; top: 220px; }
.spark { animation: spark-pulse 2.2s ease-in-out infinite; }
.spark.s2 { animation-delay: -0.7s; }
.spark.s3 { animation-delay: -1.4s; }
body[data-theme="night"] .spark {
  background: #fff2a8;
  border-color: #d9ba52;
  box-shadow: 0 0 10px rgba(255, 242, 168, .5);
}
body[data-theme="night"] .enemy-bubble,
body[data-theme="night"] .player-box,
body[data-theme="night"] .main-feed-panel,
body[data-theme="night"] .command-box,
body[data-theme="night"] .dialog,
body[data-theme="night"] .intel-panel {
  background: #fcfbff;
  color: var(--card-text);
  border-color: #6d66b4;
  box-shadow: inset 0 0 0 2px #ffffff, 0 6px 0 #938dd1;
}
body[data-theme="night"] .enemy-name,
body[data-theme="night"] .player-name,
body[data-theme="night"] .command-title,
body[data-theme="night"] .side-title,
body[data-theme="night"] .enemy-text,
body[data-theme="night"] .dialog,
body[data-theme="night"] .meta-grid b,
body[data-theme="night"] .stat-pill b,
body[data-theme="night"] .summary-list b,
body[data-theme="night"] .task-list b,
body[data-theme="night"] .cmd-btn,
body[data-theme="night"] .battle-focus-card b,
body[data-theme="night"] .hero-title,
body[data-theme="night"] .hero-metric b,
body[data-theme="night"] .hero-desc,
body[data-theme="night"] .player-box,
body[data-theme="night"] .command-box,
body[data-theme="night"] .command-box a,
body[data-theme="night"] .command-grid a {
  color: var(--card-text);
}
body[data-theme="night"] .hp-wrap span,
body[data-theme="night"] .meta-grid span,
body[data-theme="night"] .task-list small,
body[data-theme="night"] .hint,
body[data-theme="night"] .stat-pill span,
body[data-theme="night"] .summary-list span,
body[data-theme="night"] .task-list span,
body[data-theme="night"] .side-meta,
body[data-theme="night"] .battle-kicker,
body[data-theme="night"] .dialog-kicker,
body[data-theme="night"] .intel-kicker,
body[data-theme="night"] .battle-focus-card span,
body[data-theme="night"] .hero-metric span {
  color: var(--card-muted);
}
body[data-theme="night"] .headline-list a,
body[data-theme="night"] .task-list a {
  color: var(--card-link);
}
body[data-theme="night"] .candy {
  background: linear-gradient(180deg, #6e5bb1 0%, #52448f 100%);
}
body[data-theme="night"] .game-kicker {
  color: #fef9ff;
  background: #56479d;
  border-color: #35285f;
  box-shadow: 0 3px 0 #21183f;
}
body[data-theme="night"] .game-title,
body[data-theme="night"] .game-sub {
  color: #fff7ff;
  text-shadow: 3px 3px 0 #35285f;
}
body[data-theme="night"] .stat-pill {
  background: rgba(240, 244, 255, .96);
}
body[data-theme="night"] .theme-toggle:hover,
body[data-theme="night"] .theme-toggle:focus-visible {
  background: #fff1b8;
  border-color: #b88927;
  box-shadow: inset 0 0 0 2px #fff9e6, 0 6px 0 #7b5a16;
}
body[data-theme="night"] .theme-toggle:hover span,
body[data-theme="night"] .theme-toggle:hover b,
body[data-theme="night"] .theme-toggle:hover small,
body[data-theme="night"] .theme-toggle:focus-visible span,
body[data-theme="night"] .theme-toggle:focus-visible b,
body[data-theme="night"] .theme-toggle:focus-visible small {
  color: #35290f;
}
body[data-theme="night"] .task-list li,
body[data-theme="night"] .summary-list li {
  background: rgba(252, 250, 255, .98);
  border-color: var(--card-border-soft);
}
body[data-theme="night"] .intel-panel .task-list li,
body[data-theme="night"] .intel-panel .summary-list li,
body[data-theme="night"] .guestbook-note,
body[data-theme="night"] .guestbook-prompt,
body[data-theme="night"] .guestbook-modal-card,
body[data-theme="night"] .guestbook-form input,
body[data-theme="night"] .guestbook-form textarea,
body[data-theme="night"] .guestbook-password-input {
  color: var(--card-text);
}
body[data-theme="night"] .cmd-btn {
  background: linear-gradient(180deg, #fff6bf 0%, #ffd76d 100%);
  border-color: #8a76b9;
  box-shadow: inset 0 0 0 2px #fffdf1, 0 4px 0 #b08d3d;
}
body[data-theme="night"] .frame {
  border-color: #454089;
  box-shadow: inset 0 0 0 2px #dddfff, 0 6px 0 #2e2d60;
}
.dialog {
  left: 22px;
  right: 22px;
  bottom: 18px;
  min-height: 90px;
  padding: 12px;
  font-size: 15px;
  line-height: 1.45;
}
.dialog-kicker {
  margin-bottom: 8px;
}
.bottom-panels {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(220px, 0.6fr);
  gap: 12px;
  margin-top: 12px;
  align-items: start;
}
.player-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.player-box,
.command-box,
.main-feed-panel {
  padding: 12px;
}
.main-feed-panel {
  min-width: 0;
}
.intel-panel {
  padding: 12px;
  min-width: 0;
  position: relative;
  overflow: hidden;
}
.intel-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  border-top: 4px solid rgba(255,255,255,.48);
  pointer-events: none;
}
.intel-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
  margin-bottom: 8px;
}
.intel-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.intel-list li {
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.card-state {
  align-items: center;
}
.card-state strong {
  font-size: 12px;
  color: var(--card-text);
}
.card-state small {
  display: block;
  margin-top: 4px;
  color: var(--card-muted);
}
.card-state.card-state-ok {
  background: var(--status-ok-bg);
}
.card-state.card-state-warn {
  background: var(--status-warn-bg);
}
.card-state.card-state-danger {
  background: var(--status-danger-bg);
}
.intel-panel:hover .intel-list li:first-child {
  transform: translateY(-1px);
  border-color: #6f67b7;
  background: rgba(255,255,255,.92);
}
body[data-theme="night"] .intel-panel:hover .intel-list li:first-child,
body[data-theme="night"] .intel-panel:hover .task-list li:first-child,
body[data-theme="night"] .intel-panel:hover .summary-list li:first-child {
  background: #fff7df;
  border-color: #8a76b9;
}
body[data-theme="night"] .intel-panel:hover .intel-list li:first-child span,
body[data-theme="night"] .intel-panel:hover .intel-list li:first-child small,
body[data-theme="night"] .intel-panel:hover .intel-list li:first-child a,
body[data-theme="night"] .intel-panel:hover .task-list li:first-child span,
body[data-theme="night"] .intel-panel:hover .task-list li:first-child small,
body[data-theme="night"] .intel-panel:hover .summary-list li:first-child span {
  color: #2b2550;
}
.intel-panel.is-focus {
  box-shadow: inset 0 0 0 2px #fff, 0 8px 0 #9f99d6;
  transform: translateY(-2px);
}
.intel-panel.is-focus .intel-badge {
  background: #ff8fb7;
  border-color: #c85386;
  box-shadow: 0 3px 0 #8f355f;
}
.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}
.meta-grid span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}
.meta-grid b {
  font-size: 14px;
}
.command-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.cmd-btn {
  appearance: none;
  border: 3px solid #7c74bf;
  background: linear-gradient(180deg, #fff5bf 0%, #ffd972 100%);
  color: var(--ink);
  padding: 10px 8px;
  font: inherit;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  box-shadow: inset 0 0 0 2px #fff, 0 4px 0 #c9a54d;
}
.cmd-btn:hover { filter: brightness(1.05); }
.cmd-btn:active {
  transform: translateY(2px);
  box-shadow: inset 0 0 0 2px #fff, 0 2px 0 #c9a54d;
}
.side-card, .player-box, .main-feed-panel, .command-box {
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.side-card:hover, .player-box:hover, .main-feed-panel:hover, .command-box:hover {
  transform: translateY(-2px);
  box-shadow: inset 0 0 0 2px #fff, 0 8px 0 #b3afdf;
}
.side-stack {
  display: grid;
  gap: 14px;
}
.side-card {
  padding: 12px;
}
.guestbook-card {
  overflow: hidden;
}
.guestbook-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}
.guestbook-kicker {
  color: #fff9ff;
}
.guestbook-stamp {
  min-width: 84px;
}
.guestbook-scene {
  margin-top: 10px;
  padding: 12px;
  position: relative;
  background: linear-gradient(180deg, #fff9ea 0%, #ffe3a8 100%);
  overflow: hidden;
}
.guestbook-scene::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.15) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 8px 8px;
  opacity: .34;
  pointer-events: none;
}
.guestbook-shelf {
  position: relative;
  z-index: 1;
  margin-bottom: 10px;
  height: 18px;
  background: linear-gradient(180deg, #d9a16f 0%, #9f6840 100%);
  border: 3px solid #6d4630;
  box-shadow: 0 4px 0 rgba(92, 54, 33, .24);
}
.guestbook-toy {
  position: absolute;
  bottom: 4px;
  display: block;
}
.guestbook-toy.star {
  left: 16px;
  width: 10px;
  height: 10px;
  background: #ffe67a;
  border: 3px solid #d6a842;
  transform: rotate(45deg);
}
.guestbook-toy.bone {
  left: 48px;
  width: 24px;
  height: 8px;
  background: #fff9ec;
  border: 3px solid #a89878;
}
.guestbook-toy.bone::before,
.guestbook-toy.bone::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  background: inherit;
  border: 3px solid #a89878;
  border-radius: 999px;
  transform: translateY(-50%);
}
.guestbook-toy.bone::before { left: -7px; }
.guestbook-toy.bone::after { right: -7px; }
.guestbook-toy.heart {
  right: 22px;
  width: 12px;
  height: 12px;
  background: #ff8db9;
  border: 3px solid #c55788;
  transform: rotate(45deg);
}
.guestbook-toy.heart::before,
.guestbook-toy.heart::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  background: #ff8db9;
  border: 3px solid #c55788;
  border-radius: 999px;
}
.guestbook-toy.heart::before { left: -8px; top: -1px; }
.guestbook-toy.heart::after { left: -1px; top: -8px; }
.guestbook-shell {
  margin-top: 0;
  padding: 14px;
  position: relative;
  background: linear-gradient(180deg, #fffef7 0%, #fff0d2 100%);
  box-shadow: inset 0 0 0 2px #fff7dc;
  z-index: 1;
}
.side-card-hidden {
  display: none;
}
.guestbook-shell::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 3px dashed #8f8ac8;
  pointer-events: none;
}
.guestbook-prompt {
  margin-bottom: 12px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink);
  background: linear-gradient(180deg, #fffef9 0%, #fff5d6 100%);
  border: 3px solid #7c74bf;
  padding: 10px 12px;
  box-shadow: inset 0 0 0 2px #fff8e4;
}
.guestbook-form {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}
.guestbook-form-grid {
  display: grid;
  gap: 10px;
}
.guestbook-form-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.guestbook-divider {
  position: relative;
  z-index: 1;
  height: 0;
  border-top: 3px dashed #9b93d2;
  margin: 8px 0 12px;
}
.guestbook-form label {
  display: grid;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
}
.guestbook-form input,
.guestbook-form textarea,
.guestbook-password-input {
  width: 100%;
  appearance: none;
  border: 3px solid #7c74bf;
  background: #fffef8;
  color: var(--ink);
  caret-color: var(--ink);
  padding: 8px 10px;
  font: inherit;
  box-shadow: inset 0 0 0 2px #fff4cc;
}
.guestbook-form input::placeholder,
.guestbook-form textarea::placeholder,
.guestbook-password-input::placeholder {
  color: #7a75a9;
}
.guestbook-form textarea {
  resize: vertical;
  min-height: 92px;
}
.guestbook-submit {
  width: 100%;
}
.guestbook-status {
  position: relative;
  z-index: 1;
  margin-bottom: 10px;
  font-size: 11px;
  color: var(--muted);
}
.guestbook-list {
  position: relative;
  z-index: 1;
  min-height: 120px;
  display: grid;
  gap: 10px;
}
.guestbook-note {
  position: relative;
  padding: 16px 12px 12px;
  background: linear-gradient(180deg, #fffef4 0%, #ffe39b 100%);
  border: 4px solid #7b72c0;
  box-shadow: inset 0 0 0 2px #fff9e6, 0 6px 0 #b6b0e2;
  transform-origin: center bottom;
}
.guestbook-note:hover {
  transform: translateY(-2px) rotate(-1deg);
}
.guestbook-note::after {
  content: attr(data-label);
  position: absolute;
  left: 10px;
  top: -11px;
  padding: 2px 6px;
  font-size: 10px;
  color: #fffdf4;
  background: #6f67b7;
  border: 3px solid #4f4891;
  box-shadow: 0 3px 0 #2f2b61;
}
.guestbook-note::selection,
.guestbook-note *::selection {
  background: rgba(255, 183, 216, .65);
}
.guestbook-note::before {
  content: "";
  position: absolute;
  right: 14px;
  top: -6px;
  width: 24px;
  height: 12px;
  background: #ffb7d8;
  border: 3px solid #d85d93;
  box-shadow: 0 2px 0 rgba(0,0,0,.08);
}
.guestbook-note:nth-child(3n+2) {
  background: linear-gradient(180deg, #f9fcff 0%, #d5ecff 100%);
}
.guestbook-note:nth-child(3n+3) {
  background: linear-gradient(180deg, #fffafc 0%, #ffd7e8 100%);
}
.guestbook-note-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: start;
  margin-bottom: 8px;
}
.guestbook-note-name {
  font-size: 12px;
  color: var(--ink);
}
.guestbook-note-time {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  color: var(--muted);
}
.guestbook-note-text {
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.guestbook-delete {
  min-width: 28px;
  height: 28px;
  appearance: none;
  border: 3px solid #7c74bf;
  background: linear-gradient(180deg, #fff5bf 0%, #ffd972 100%);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  box-shadow: inset 0 0 0 2px #fff, 0 3px 0 #c9a54d;
  border-radius: 2px;
}
.guestbook-empty {
  font-size: 12px;
  color: var(--muted);
  padding: 10px;
  background: rgba(255,255,255,.72);
  border: 3px dashed #8d86cb;
}
.guestbook-modal {
  position: fixed;
  inset: 0;
  background: rgba(36, 31, 70, .55);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 50;
}
.guestbook-modal[hidden] {
  display: none;
}
.guestbook-modal-card {
  width: min(100%, 360px);
  background: linear-gradient(180deg, #fffef6 0%, #ffe7a0 100%);
  border: 4px solid #6e67b2;
  box-shadow: inset 0 0 0 2px #fff, 0 8px 0 #b5afde;
  padding: 14px;
}
.guestbook-modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.guestbook-modal-title {
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 8px;
}
.guestbook-modal-copy {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.side-meta {
  font-size: 11px;
  color: var(--muted);
  margin: 2px 0 8px;
  line-height: 1.55;
}
.headline-list a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.headline-list a:hover {
  filter: brightness(1.06);
}
.task-list a,
.headline-list a {
  word-break: break-word;
  overflow-wrap: anywhere;
}
.task-list li b,
.summary-list li b {
  flex-shrink: 0;
  white-space: nowrap;
}
.task-list,
.summary-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}
.task-list li,
.summary-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  background: rgba(255,255,255,.68);
  border: 3px solid #8d86cb;
  font-size: 12px;
}
.task-list span,
.summary-list span {
  flex: 1;
  line-height: 1.45;
}
.task-list small { color: var(--muted); }
.task-list small.trump-excerpt {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.45;
}
.task-list small.trump-translation {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.55;
  color: #4e4a87;
  background: rgba(255, 244, 204, 0.78);
  border: 2px solid #d8c27a;
  padding: 5px 6px;
}
.task-list b.ok,
.summary-list b.ok {
  color: var(--status-ok-fg);
  background: var(--status-ok-bg);
  border: 2px solid rgba(33, 102, 60, .18);
  padding: 2px 6px;
}
.task-list b.warn,
.summary-list b.warn {
  color: var(--status-warn-fg);
  background: var(--status-warn-bg);
  border: 2px solid rgba(143, 98, 20, .18);
  padding: 2px 6px;
}
.task-list b.danger,
.summary-list b.danger {
  color: var(--status-danger-fg);
  background: var(--status-danger-bg);
  border: 2px solid rgba(158, 53, 85, .18);
  padding: 2px 6px;
}
.hint {
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
}
body[data-theme="night"] .guestbook-scene {
  background: linear-gradient(180deg, #f2ecff 0%, #d7cbff 100%);
}
body[data-theme="night"] .guestbook-shell {
  background: linear-gradient(180deg, #f6f2ff 0%, #dfd8ff 100%);
}
body[data-theme="night"] .guestbook-shelf {
  background: linear-gradient(180deg, #b58ad4 0%, #8257a8 100%);
  border-color: #5b3977;
}
body[data-theme="night"] .guestbook-stamp {
  background: #56479d;
  border-color: #35285f;
  box-shadow: 0 3px 0 #21183f;
}
body[data-theme="night"] .guestbook-prompt {
  color: #241f46;
  border-color: #736bc1;
  box-shadow: inset 0 0 0 2px #fff;
}
body[data-theme="night"] .guestbook-form label,
body[data-theme="night"] .guestbook-status,
body[data-theme="night"] .guestbook-modal-copy,
body[data-theme="night"] .guestbook-note-time {
  color: #514b7d;
}
body[data-theme="night"] .guestbook-form input,
body[data-theme="night"] .guestbook-form textarea,
body[data-theme="night"] .guestbook-password-input {
  background: #fffdf7;
  color: #241f46;
  border-color: #736bc1;
  box-shadow: inset 0 0 0 2px #fff;
}
body[data-theme="night"] .guestbook-form input::placeholder,
body[data-theme="night"] .guestbook-form textarea::placeholder,
body[data-theme="night"] .guestbook-password-input::placeholder {
  color: #6d6796;
}
body[data-theme="night"] .guestbook-note,
body[data-theme="night"] .guestbook-modal-card,
body[data-theme="night"] .guestbook-delete,
body[data-theme="night"] .guestbook-note-name,
body[data-theme="night"] .guestbook-modal-title {
  color: #241f46;
}
body[data-theme="night"] .guestbook-delete {
  background: linear-gradient(180deg, #fff3bf 0%, #ffd467 100%);
  border-color: #736bc1;
  box-shadow: inset 0 0 0 2px #fff9e8, 0 3px 0 #b38d3b;
}
body[data-theme="night"] .guestbook-delete:hover,
body[data-theme="night"] .guestbook-delete:focus-visible {
  filter: brightness(1.03);
  outline: none;
}
body[data-theme="night"] .task-list li,
body[data-theme="night"] .summary-list li {
  background: rgba(255,255,255,.94);
}
body[data-theme="night"] .task-list span,
body[data-theme="night"] .summary-list span,
body[data-theme="night"] .task-list small,
body[data-theme="night"] .summary-list small,
body[data-theme="night"] .side-meta,
body[data-theme="night"] .task-list a,
body[data-theme="night"] .headline-list a,
body[data-theme="night"] .hint {
  color: #3c3768;
}
body[data-theme="night"] .task-list b,
body[data-theme="night"] .summary-list b {
  color: #241f46;
}
@keyframes quote-shell-pop {
  0% { transform: translateY(0); }
  50% { transform: translateY(2px); }
  100% { transform: translateY(0); }
}

@keyframes flash-update {
  0% { filter: brightness(1); transform: translateY(0); }
  50% { filter: brightness(1.18); transform: translateY(-1px); }
  100% { filter: brightness(1); transform: translateY(0); }
}

@keyframes mini-trend-refresh {
  0% { transform: translateY(0); filter: brightness(1); }
  50% { transform: translateY(-1px); filter: brightness(1.12); }
  100% { transform: translateY(0); filter: brightness(1); }
}

@keyframes hud-step-refresh {
  0% { transform: translateY(0); filter: brightness(1); }
  50% { transform: translateY(2px); filter: brightness(1.08); }
  100% { transform: translateY(0); filter: brightness(1); }
}

@keyframes note-wall-pulse {
  0% { transform: translateY(0); filter: brightness(1); }
  50% { transform: translateY(-2px); filter: brightness(1.06); }
  100% { transform: translateY(0); filter: brightness(1); }
}

@keyframes theme-scene-flash {
  0% { filter: brightness(1); }
  50% { filter: brightness(1.05); }
  100% { filter: brightness(1); }
}

@keyframes spark-pulse {
  0%, 100% { transform: rotate(45deg) scale(1); opacity: 1; }
  50%       { transform: rotate(45deg) scale(0.6); opacity: 0.45; }
}
@keyframes theme-flash {
  0% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-1px) scale(1.03); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes bob-big {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-11px); }
}
@keyframes bob-slow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
@keyframes bob-shift {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(5px, -7px); }
}
@keyframes tail-wag-mellow {
  0%, 100% { transform: rotateX(-8deg); }
  25%, 75% { transform: rotateX(0deg); }
  50% { transform: rotateX(10deg); }
}
@keyframes tail-wag-worried {
  0%, 100% { transform: rotateX(-11deg); }
  25%, 75% { transform: rotateX(0deg); }
  50% { transform: rotateX(13deg); }
}
@keyframes tail-wag-bone {
  0%, 100% { transform: rotateX(-14deg); }
  22%, 78% { transform: rotateX(0deg); }
  50% { transform: rotateX(15deg); }
}
@keyframes dog-blink {
  0%, 40%, 44%, 100% { transform: scaleY(1); }
  42% { transform: scaleY(0.12); }
}
@keyframes dog-pet-pop {
  0% { transform: translateY(0) scale(1); }
  45% { transform: translateY(-7px) scale(1.07); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes note-pop-in {
  0% { transform: translateY(12px) scale(0.94); opacity: 0; }
  70% { transform: translateY(-4px) scale(1.03); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes sticker-burst {
  0% { transform: translateY(0) scale(0.7) rotate(0deg); opacity: 0; }
  25% { opacity: 1; }
  100% { transform: translateY(-36px) scale(1.12) rotate(10deg); opacity: 0; }
}
#dog-sprite:not([data-dog-state="sleepy"]) .eye {
  animation: dog-blink 5.8s ease-in-out infinite;
}
#dog-sprite[data-dog-state="excited"] {
  animation: bob-big 0.85s ease-in-out infinite;
}
#dog-sprite[data-dog-state="excited"] .eye {
  box-shadow: 0 0 0 2px #fff6a2;
}
#dog-sprite[data-dog-state="sleepy"] {
  animation: bob-slow 2.7s ease-in-out infinite;
}
#dog-sprite[data-dog-state="sleepy"] .sleep-cap,
#dog-sprite[data-dog-state="sleepy"] .pillow {
  opacity: 1;
}
#dog-sprite[data-dog-state="sleepy"] .scarf {
  opacity: 0;
}
#dog-sprite[data-dog-state="sleepy"] .eye {
  animation: none;
  height: 5px;
  top: 69px;
  border-radius: 2px;
}
#dog-sprite[data-dog-state="sleepy"] .tail {
  animation: none;
}
#dog-sprite[data-dog-state="worried"] {
  animation: bob-slow 2s ease-in-out infinite;
}
#dog-sprite[data-dog-state="worried"] .siren-hat {
  opacity: 1;
}
#dog-sprite[data-dog-state="worried"] .ear {
  transform-origin: 50% 6px;
}
#dog-sprite[data-dog-state="worried"] .ear.left {
  transform: rotate(24deg);
}
#dog-sprite[data-dog-state="worried"] .ear.right {
  transform: rotate(-24deg);
}
#dog-sprite[data-dog-state="worried"] .tail {
  animation: tail-wag-worried 2s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}
#dog-sprite[data-dog-state="bone"] .bone {
  opacity: 1;
}
#dog-sprite[data-dog-state="bone"] {
  animation: bob-shift 0.56s ease-in-out infinite;
}
#dog-sprite[data-dog-state="bone"] .scarf {
  opacity: 1;
}
#dog-sprite[data-dog-state="bone"] .tail {
  animation: tail-wag-bone 1.12s cubic-bezier(0.42, 0, 0.58, 1) infinite;
}
#dog-sprite[data-dog-state="work"] .glasses,
#dog-sprite[data-dog-state="work"] .scarf,
#dog-sprite[data-dog-state="idle"] .scarf,
#dog-sprite[data-dog-state="ok"] .scarf {
  opacity: 1;
}
#dog-sprite:hover .eye {
  transform: translateX(2px);
}
#dog-sprite.dog-pet {
  animation: dog-pet-pop 0.32s ease-out !important;
}
#dog-sprite.dog-super {
  animation: bob-big 0.48s ease-in-out 3;
}
@media (max-width: 980px) {
  .hero-hud,
  .dream-layout,
  .bottom-panels {
    grid-template-columns: 1fr;
  }
}
.layout-modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 44, .58);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
  z-index: 60;
  opacity: 0;
}
.layout-modal.is-open,
.layout-modal.is-closing {
  display: flex;
}
.layout-modal.is-open {
  animation: layout-overlay-in 0.18s steps(5, end) forwards;
}
.layout-modal.is-closing {
  animation: layout-overlay-out 0.16s steps(4, end) forwards;
}
.layout-modal-card {
  width: min(100%, 520px);
  max-height: 80vh;
  overflow: auto;
  padding: 14px;
  background: linear-gradient(180deg, #fffdf6 0%, #ffe8b3 100%);
  transform: translateY(6px) scale(.96);
}
.layout-modal.is-open .layout-modal-card {
  animation: layout-card-in 0.2s steps(5, end) forwards;
}
.layout-modal.is-closing .layout-modal-card {
  animation: layout-card-out 0.16s steps(4, end) forwards;
}
.layout-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}
.layout-section {
  margin-top: 14px;
}
.layout-section-title {
  font-size: 12px;
  color: var(--card-muted);
  margin-bottom: 4px;
}
.layout-section-sub {
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  margin-bottom: 10px;
}
.layout-option-list {
  display: grid;
  gap: 8px;
}
.layout-option {
  position: relative;
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: rgba(255,255,255,.86);
  border: 3px solid #8d86cb;
  box-shadow: inset 0 0 0 2px #fff6d8;
  cursor: pointer;
  transition: transform 0.12s steps(2, end), filter 0.12s steps(2, end);
}
.layout-option:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}
.layout-option.is-checked {
  background: linear-gradient(180deg, #fff2bf 0%, #ffe07e 100%);
  border-color: #cc9f3d;
  box-shadow: inset 0 0 0 2px #fff8d6;
}
.layout-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.layout-option-box {
  font-size: 15px;
  line-height: 1;
  color: #5c49a5;
  text-shadow: 1px 1px 0 #fff;
}
.layout-option.is-checked .layout-option-box {
  color: #a65b1a;
}
.layout-option-label {
  font-size: 12px;
  color: var(--card-text);
}
.layout-option-flash {
  animation: layout-option-flash 0.2s steps(4, end);
}
@keyframes layout-overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes layout-overlay-out {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes layout-card-in {
  from { opacity: 0; transform: translateY(6px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes layout-card-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(6px) scale(.96); }
}
@keyframes layout-option-flash {
  0% { filter: brightness(1.12); }
  100% { filter: brightness(1); }
}

@media (max-width: 720px) {
  .dream-shell {
    padding: 10px;
  }
  .dream-top {
    padding: 12px;
  }
  .top-stats { grid-template-columns: 1fr 1fr; display: grid; }
  .stat-pill { min-width: 0; }
  .meta-grid,
  .command-grid { grid-template-columns: 1fr; display: grid; }
  .battle-stage { height: 620px; }
  .task-list li, .summary-list li { flex-direction: column; }
  .weather-head-actions {
    width: 100%;
    justify-content: space-between;
  }
  .weather-toggle-btn {
    min-width: 0;
  }
  .game-title {
    font-size: 24px;
    line-height: 1.15;
  }
  .game-sub {
    font-size: 11px;
  }
}
