:root {
  color-scheme: light;
  --page: #f6f7fb;
  --surface: #ffffff;
  --surface-soft: #f8f9fc;
  --surface-strong: #eef1f7;
  --text: #172033;
  --muted: #687188;
  --faint: #959db0;
  --border: #e1e5ed;
  --border-strong: #cdd3df;
  --primary: #6757d9;
  --primary-hover: #5747c8;
  --primary-soft: #eeeafd;
  --green: #2a9d72;
  --green-soft: #e3f6ef;
  --orange: #e9833e;
  --orange-soft: #fff0e5;
  --blue: #4686e8;
  --blue-soft: #e9f2ff;
  --pink: #db5f97;
  --pink-soft: #fdebf3;
  --shadow-sm: 0 1px 2px rgba(25, 32, 55, 0.05), 0 2px 8px rgba(25, 32, 55, 0.04);
  --shadow-md: 0 14px 40px rgba(28, 34, 58, 0.12);
  --radius: 14px;
  --creature-color: #172033;
  --creature-url: url("svgs/bug.svg");
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body[data-theme="dark"] {
  color-scheme: dark;
  --page: #11131a;
  --surface: #1a1d26;
  --surface-soft: #20242f;
  --surface-strong: #292e3b;
  --text: #f2f3f8;
  --muted: #a5adbf;
  --faint: #777f91;
  --border: #303543;
  --border-strong: #454b5c;
  --primary: #9486ff;
  --primary-hover: #a99eff;
  --primary-soft: #2c2848;
  --green-soft: #17392f;
  --orange-soft: #40291c;
  --blue-soft: #1e3049;
  --pink-soft: #412438;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25), 0 3px 10px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 18px 55px rgba(0, 0, 0, 0.38);
}

body[data-theme="uv"] {
  color-scheme: dark;
  --page: #110822;
  --surface: #1c1033;
  --surface-soft: #251541;
  --surface-strong: #34205a;
  --text: #fbf7ff;
  --muted: #cabce1;
  --faint: #8d7fa9;
  --border: #432b68;
  --border-strong: #654493;
  --primary: #d7ff3f;
  --primary-hover: #e3ff70;
  --primary-soft: #34451c;
  --green: #70ffc8;
  --green-soft: #173e37;
  --orange: #ff9c54;
  --orange-soft: #492419;
  --blue: #60ddff;
  --blue-soft: #143d50;
  --pink: #ff6cce;
  --pink-soft: #4a1740;
  --shadow-sm: 0 0 0 1px rgba(209, 255, 68, 0.03), 0 3px 14px rgba(129, 59, 255, 0.18);
  --shadow-md: 0 18px 65px rgba(5, 0, 15, 0.55), 0 0 35px rgba(190, 76, 255, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background: var(--page);
  transition: color 240ms, background 240ms;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button {
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 38%, transparent);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
}

.site-header {
  position: sticky;
  z-index: 40;
  top: 0;
  display: grid;
  grid-template-columns: auto minmax(220px, 560px) auto auto;
  min-height: 68px;
  align-items: center;
  gap: 22px;
  padding: 10px clamp(16px, 3vw, 36px);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: 0 1px 0 rgba(20, 28, 48, 0.02);
  backdrop-filter: blur(16px);
}

.wordmark {
  display: flex;
  align-items: center;
  color: var(--text);
  text-decoration: none;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.075em;
}

.wordmark strong {
  color: var(--primary);
  font-weight: 900;
}

.header-search {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 9px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--faint);
  background: var(--surface-soft);
  transition: border-color 150ms, box-shadow 150ms;
}

.header-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 13%, transparent);
}

.header-search input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.header-search input::placeholder {
  color: var(--faint);
}

kbd {
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--faint);
  background: var(--surface);
  font-size: 0.65rem;
  white-space: nowrap;
}

.appearance-switcher {
  display: flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
}

.appearance-button {
  display: flex;
  min-height: 34px;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 650;
}

.appearance-button.is-active {
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

body[data-theme="uv"] .uv-button.is-active {
  color: #172004;
  background: var(--primary);
  box-shadow: 0 0 16px rgba(215, 255, 63, 0.28);
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.quiet-button,
.secondary-button,
.primary-button,
.icon-button,
.avatar-button,
.small-button {
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  cursor: pointer;
  font-weight: 650;
  transition: translate 120ms, background 120ms, border-color 120ms, box-shadow 120ms;
}

.quiet-button {
  min-height: 38px;
  padding: 7px 11px;
  color: var(--muted);
  font-size: 0.76rem;
}

.quiet-button:hover,
.secondary-button:hover,
.icon-button:hover,
.small-button:hover {
  border-color: var(--border-strong);
  background: var(--surface-strong);
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  color: var(--muted);
  font-size: 1rem;
}

.avatar-button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, #6e60db, #d067a3);
  font-size: 0.68rem;
}

.workspace {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  min-height: calc(100vh - 68px);
}

.sidebar {
  position: sticky;
  top: 68px;
  display: flex;
  height: calc(100vh - 68px);
  flex-direction: column;
  padding: 20px 14px;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.workspace-picker {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-soft);
}

.workspace-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--primary);
  font-size: 0.75rem;
  font-weight: 800;
}

.workspace-picker strong,
.workspace-picker small {
  display: block;
  overflow: hidden;
  max-width: 120px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-picker strong { font-size: 0.76rem; }
.workspace-picker small { margin-top: 2px; color: var(--muted); font-size: 0.62rem; }
.workspace-picker > button { border: 0; color: var(--muted); background: transparent; cursor: pointer; }

.side-nav {
  margin-top: 22px;
}

.side-nav p {
  margin: 18px 10px 7px;
  color: var(--faint);
  font-size: 0.62rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.side-nav button {
  display: grid;
  width: 100%;
  min-height: 40px;
  grid-template-columns: 23px 1fr auto;
  align-items: center;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 550;
}

.side-nav button:hover,
.side-nav button.is-active {
  color: var(--primary);
  background: var(--primary-soft);
}

.side-nav button small {
  display: grid;
  min-width: 21px;
  height: 19px;
  place-items: center;
  border-radius: 10px;
  color: var(--muted);
  background: var(--surface-strong);
  font-size: 0.58rem;
}

.sidebar-tip {
  margin-top: auto;
  padding: 13px;
  border-radius: 11px;
  color: var(--muted);
  background: linear-gradient(145deg, var(--primary-soft), var(--surface-soft));
  font-size: 0.68rem;
  line-height: 1.45;
}

.sidebar-tip strong { display: block; margin: 5px 0 3px; color: var(--text); }
.sidebar-tip p { margin: 0; }
.tip-spark { color: var(--primary); font-size: 1.1rem; }

.page-content {
  min-width: 0;
  padding: clamp(22px, 3vw, 42px);
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 27px;
}

.breadcrumb {
  margin: 0 0 7px;
  color: var(--faint);
  font-size: 0.68rem;
}

.breadcrumb span { color: var(--primary); }

.page-heading h1 {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  letter-spacing: -0.045em;
}

.page-heading > div:first-child > p:last-child {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.game-status {
  display: flex;
  align-items: stretch;
  gap: 9px;
}

.game-status > div {
  display: flex;
  min-height: 48px;
  flex-direction: column;
  justify-content: center;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.game-status span { color: var(--faint); font-size: 0.59rem; font-weight: 650; text-transform: uppercase; }
.game-status output { margin-top: 3px; font: 700 0.82rem ui-monospace, SFMono-Regular, Consolas, monospace; font-variant-numeric: tabular-nums; }

.game-status .target-chip {
  min-width: 126px;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.target-chip .creature-glyph { width: 25px; height: 25px; }
.target-chip span:last-child { color: var(--text); font-size: 0.68rem; text-transform: none; }

.dashboard-grid {
  display: grid;
  grid-auto-flow: dense;
  grid-auto-rows: minmax(150px, auto);
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 15px;
}

.component {
  position: relative;
  min-width: 0;
  overflow: visible;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.component.span-3 { grid-column: span 3; }
.component.span-4 { grid-column: span 4; }
.component.span-5 { grid-column: span 5; }
.component.span-6 { grid-column: span 6; }
.component.span-7 { grid-column: span 7; }
.component.span-8 { grid-column: span 8; }
.component.tall { grid-row: span 2; }

.card-head {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--border);
}

.card-head h2 {
  margin: 0;
  font-size: 0.83rem;
  letter-spacing: -0.01em;
}

.card-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.64rem;
}

.card-body {
  position: relative;
  min-height: 96px;
  padding: 15px;
}

.more-button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
}

.more-button:hover { background: var(--surface-strong); }

.metric-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.metric-value { display: block; font-size: 1.85rem; font-weight: 750; letter-spacing: -0.055em; }
.metric-change { padding: 4px 7px; border-radius: 12px; color: var(--green); background: var(--green-soft); font-size: 0.63rem; font-weight: 700; }
.mini-bars { display: flex; height: 43px; align-items: end; gap: 5px; margin-top: 15px; }
.mini-bars i { flex: 1; min-width: 6px; border-radius: 3px 3px 1px 1px; background: color-mix(in srgb, var(--primary) 62%, var(--surface)); }
.mini-bars i:last-child { background: var(--primary); }

.avatar-stack { display: flex; align-items: center; }
.person-avatar { display: grid; width: 34px; height: 34px; margin-left: -7px; place-items: center; border: 3px solid var(--surface); border-radius: 50%; color: #fff; font-size: 0.57rem; font-weight: 750; }
.person-avatar:first-child { margin-left: 0; }
.person-avatar.purple { background: #7467d9; }
.person-avatar.orange { background: #ec9364; }
.person-avatar.green { background: #4eb58d; }
.person-avatar.blue { background: #5590dd; }
.person-avatar.more { color: var(--muted); background: var(--surface-strong); }
.member-copy { margin-top: 13px; color: var(--muted); font-size: 0.7rem; line-height: 1.5; }

.toggle-list { display: grid; gap: 12px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.toggle-row strong { display: block; font-size: 0.74rem; }
.toggle-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 0.62rem; }

.switch-control {
  position: relative;
  width: 42px;
  height: 24px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 20px;
  background: var(--border-strong);
  cursor: pointer;
  transition: background 180ms;
}

.switch-control::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
  content: "";
  transition: transform 180ms;
}

.switch-control[aria-pressed="true"] { background: var(--primary); }
.switch-control[aria-pressed="true"]::after { transform: translateX(18px); }

.toggle-secret {
  display: none;
}

.component.feature-enabled .toggle-secret {
  display: block;
}

.range-group + .range-group { margin-top: 18px; }
.range-label { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 0.68rem; }
.range-label strong { color: var(--text); font-family: ui-monospace, monospace; }
.range-input { width: 100%; height: 22px; margin: 8px 0 0; accent-color: var(--primary); cursor: ew-resize; }

.range-secret {
  display: none;
}

.component.range-used .range-secret {
  display: block;
}

.tab-list { display: flex; gap: 3px; padding: 5px; border-radius: 9px; background: var(--surface-soft); }
.tab-button { flex: 1; min-height: 34px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; cursor: pointer; font-size: 0.68rem; font-weight: 650; }
.tab-button.is-active { color: var(--primary); background: var(--surface); box-shadow: var(--shadow-sm); }
.tab-panel { position: relative; display: none; min-height: 88px; padding-top: 16px; }
.tab-panel.is-active { display: block; }
.task-line { display: flex; align-items: center; gap: 9px; padding: 7px 2px; color: var(--muted); font-size: 0.68rem; }
.task-line span { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.task-line:nth-child(2) span { background: var(--orange); }

.accordion-item { border-bottom: 1px solid var(--border); }
.accordion-item:last-child { border-bottom: 0; }
.accordion-button { display: flex; width: 100%; min-height: 48px; align-items: center; justify-content: space-between; padding: 10px 15px; border: 0; color: var(--text); background: transparent; cursor: pointer; text-align: left; font-size: 0.72rem; font-weight: 650; }
.accordion-content { position: relative; display: none; padding: 0 15px 15px; color: var(--muted); font-size: 0.68rem; line-height: 1.55; }
.accordion-item.is-open .accordion-content { display: block; }

.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.action-tile { display: flex; min-height: 62px; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-soft); cursor: pointer; text-align: left; }
.action-tile:hover { border-color: var(--primary); background: var(--primary-soft); }
.action-tile > span:first-child { display: grid; width: 30px; height: 30px; flex: 0 0 auto; place-items: center; border-radius: 8px; color: var(--primary); background: var(--surface); }
.action-tile > span:last-child { min-width: 0; flex: 1; }
.action-tile strong { display: block; font-size: 0.68rem; }
.action-tile small { display: block; margin-top: 2px; color: var(--muted); font-size: 0.57rem; }

.dropdown-wrap { position: relative; }
.dropdown-button { display: flex; width: 100%; min-height: 42px; align-items: center; justify-content: space-between; padding: 8px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); cursor: pointer; font-size: 0.7rem; }
.dropdown-menu { position: absolute; z-index: 20; top: calc(100% + 5px); right: 0; left: 0; display: none; padding: 5px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-md); }
.component.dropdown-open .dropdown-menu { display: block; }
.dropdown-menu button { position: relative; width: 100%; min-height: 36px; padding: 7px 9px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; cursor: pointer; text-align: left; font-size: 0.67rem; }
.dropdown-menu button:hover { color: var(--text); background: var(--surface-soft); }

.progress-list { display: grid; gap: 13px; }
.progress-row > div:first-child { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.65rem; }
.progress-track { height: 8px; margin-top: 6px; overflow: hidden; border-radius: 8px; background: var(--surface-strong); }
.progress-track i { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.progress-row:nth-child(2) i { background: var(--green); }
.progress-row:nth-child(3) i { background: var(--orange); }

.search-box { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 10px; border: 1px solid var(--border); border-radius: 9px; color: var(--faint); }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 0.7rem; }
.search-results { position: relative; display: none; margin-top: 10px; padding: 10px; border-radius: 9px; color: var(--muted); background: var(--surface-soft); font-size: 0.65rem; }
.component.has-search .search-results { display: block; }

.calendar-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.calendar-day { display: grid; min-height: 44px; place-items: center; border: 1px solid var(--border); border-radius: 8px; color: var(--muted); background: var(--surface-soft); font-size: 0.65rem; }
.calendar-day strong { display: block; color: var(--text); font-size: 0.72rem; }
.calendar-day.is-today { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

.mode-clue { padding: 9px 11px; border-radius: 9px; color: var(--muted); background: var(--surface-soft); font-size: 0.65rem; line-height: 1.45; }
.mode-clue strong { color: var(--text); }
.theme-demo-row { display: flex; gap: 8px; margin-top: 12px; }
.theme-demo-row button { flex: 1; min-height: 38px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; font-size: 0.66rem; }
.theme-demo-row button:hover { border-color: var(--primary); color: var(--primary); }

.button-menu { position: absolute; z-index: 15; top: 47px; right: 10px; display: none; min-width: 155px; padding: 5px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-md); }
.component.menu-open .button-menu { display: block; }
.button-menu button { width: 100%; padding: 8px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; cursor: pointer; text-align: left; font-size: 0.65rem; }
.button-menu button:hover { background: var(--surface-soft); }

.field-label { display: block; margin: 13px 0 6px; color: var(--muted); font-size: 0.66rem; font-weight: 650; }
.text-field { width: 100%; min-height: 42px; padding: 8px 11px; border: 1px solid var(--border); border-radius: 9px; outline: 0; color: var(--text); background: var(--surface); font-size: 0.72rem; }
.text-field:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent); }

.primary-button,
.secondary-button {
  min-height: 44px;
  padding: 9px 14px;
  font-size: 0.74rem;
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border-color: var(--primary);
  color: #fff;
  background: var(--primary);
  box-shadow: 0 5px 13px color-mix(in srgb, var(--primary) 22%, transparent);
}

body[data-theme="uv"] .primary-button { color: #151c05; }
.primary-button:hover { border-color: var(--primary-hover); background: var(--primary-hover); }
.primary-button:active, .secondary-button:active, .quiet-button:active { translate: 0 1px; }
.primary-button.compact { min-height: 40px; }
.secondary-button { color: var(--text); background: var(--surface); }
.small-button { min-height: 34px; padding: 6px 10px; color: var(--muted); font-size: 0.65rem; }

.hide-slot {
  position: absolute;
  z-index: 60;
  width: 56px;
  height: 56px;
  pointer-events: none;
}

.slot-top-right { top: 1px; right: 1px; }
.slot-bottom-right { right: 2px; bottom: 1px; }
.slot-bottom-left { bottom: 1px; left: 2px; }
.slot-center { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.slot-inline-right { top: 50%; right: -5px; transform: translateY(-50%); }

.hide-slot.has-creature {
  pointer-events: auto;
}

.the-creature {
  position: absolute;
  z-index: 999;
  inset: 0;
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--creature-color);
  background: transparent;
  cursor: pointer;
  pointer-events: auto !important;
  touch-action: manipulation;
  transition: opacity 220ms, filter 160ms, scale 160ms;
}

.creature-glyph {
  display: block;
  width: 31px;
  height: 31px;
  background: var(--creature-color);
  -webkit-mask: var(--creature-url) center / contain no-repeat;
  mask: var(--creature-url) center / contain no-repeat;
}

.the-creature:hover,
.the-creature:focus-visible {
  scale: 1.15;
  filter: drop-shadow(0 2px 3px color-mix(in srgb, var(--creature-color) 55%, transparent));
}

.the-creature::after {
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  content: "";
}

.hide-slot[data-condition="dark"].has-creature,
.hide-slot[data-condition="uv"].has-creature {
  pointer-events: none;
}

.hide-slot[data-condition="dark"] .the-creature,
.hide-slot[data-condition="uv"] .the-creature {
  opacity: 0;
  pointer-events: none !important;
}

body[data-theme="dark"] .hide-slot[data-condition="dark"].has-creature,
body[data-theme="uv"] .hide-slot[data-condition="uv"].has-creature {
  pointer-events: auto;
}

body[data-theme="dark"] .hide-slot[data-condition="dark"] .the-creature,
body[data-theme="uv"] .hide-slot[data-condition="uv"] .the-creature {
  opacity: 1;
  pointer-events: auto !important;
}

body[data-theme="uv"] .the-creature {
  filter: drop-shadow(0 0 5px var(--creature-color));
}

body[data-theme="dark"] .the-creature .creature-glyph,
body[data-theme="uv"] .the-creature .creature-glyph {
  background: color-mix(in srgb, var(--creature-color) 66%, white);
}

.the-creature.is-caught {
  animation: creature-caught 720ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  pointer-events: none !important;
}

.component.is-poked {
  animation: dormant-poke 480ms ease;
}

@keyframes dormant-poke {
  0%, 100% { transform: translate(0); }
  25% { transform: translate(-3px, 1px); }
  50% { transform: translate(3px, -1px); }
  75% { transform: translate(-1px, 1px); }
}

@keyframes creature-caught {
  0% { transform: scale(1) rotate(0); }
  32% { transform: scale(1.45) rotate(-9deg); }
  68% { transform: scale(1.05) rotate(12deg); }
  100% { transform: scale(0.2) rotate(28deg); opacity: 0; }
}

.overlay {
  position: fixed;
  z-index: 200;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  visibility: hidden;
  opacity: 0;
  background: rgba(22, 25, 40, 0.52);
  backdrop-filter: blur(10px);
  transition: opacity 220ms, visibility 220ms;
}

.overlay.is-open { visibility: visible; opacity: 1; }

.intro-card,
.result-card {
  position: relative;
  width: min(520px, 100%);
  padding: clamp(28px, 5vw, 48px);
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.intro-kicker,
.success-kicker,
.creator-kicker {
  color: var(--primary);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.intro-card h2 {
  margin: 12px 0;
  font-size: clamp(2.5rem, 8vw, 4.6rem);
  letter-spacing: -0.075em;
  line-height: 0.88;
}

.intro-card h2 em { color: var(--primary); font-style: normal; }
.intro-card > p { color: var(--muted); font-size: 0.85rem; line-height: 1.55; }

.target-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 22px 0;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-soft);
}

.target-preview-art { width: 56px; height: 56px; }
.target-preview small, .target-preview strong { display: block; }
.target-preview small { color: var(--muted); font-size: 0.62rem; }
.target-preview strong { margin-top: 2px; font-size: 1.05rem; text-transform: capitalize; }

.intro-rules { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 0 0 22px; padding: 0; list-style: none; }
.intro-rules li { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.62rem; }
.intro-rules span { display: grid; width: 20px; height: 20px; flex: 0 0 auto; place-items: center; border-radius: 50%; color: var(--primary); background: var(--primary-soft); font-size: 0.56rem; font-weight: 750; }
.intro-card > .primary-button { width: 100%; }
.intro-note { margin: 13px 0 0; text-align: center; font-size: 0.62rem !important; }

.result-card { text-align: center; }
.success-creature { width: 74px; height: 74px; margin: 0 auto 12px; }
.result-card h2 { margin: 7px 0; font-size: 2.4rem; letter-spacing: -0.055em; }
.result-note { margin: 0; color: var(--muted); font-size: 0.82rem; }
.result-times { display: grid; grid-template-columns: 1fr 1fr; margin: 24px 0; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; }
.result-times div { padding: 13px; text-align: left; }
.result-times div + div { border-left: 1px solid var(--border); }
.result-times span, .result-times strong { display: block; }
.result-times span { color: var(--muted); font-size: 0.62rem; }
.result-times strong { margin-top: 4px; font: 750 0.96rem ui-monospace, monospace; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.result-actions .primary-button { grid-column: 1 / -1; }

.dialog-backdrop,
.prompt-backdrop {
  position: fixed;
  z-index: 150;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  visibility: hidden;
  opacity: 0;
  background: rgba(19, 23, 37, 0.43);
  backdrop-filter: blur(5px);
  transition: opacity 180ms, visibility 180ms;
}

.dialog-backdrop.is-open,
.prompt-backdrop.is-open { visibility: visible; opacity: 1; }

.demo-dialog,
.prompt-card {
  position: relative;
  width: min(430px, 100%);
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.dialog-close { position: absolute; top: 12px; right: 12px; }
.dialog-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 50%; color: var(--green); background: var(--green-soft); font-weight: 800; }
.demo-dialog h2, .prompt-card h2 { margin: 15px 0 7px; font-size: 1.25rem; }
.demo-dialog p, .prompt-card p { margin: 0; color: var(--muted); font-size: 0.74rem; line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 19px; }

.notification-drawer {
  position: fixed;
  z-index: 160;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(390px, calc(100% - 25px));
  padding: 22px;
  border-left: 1px solid var(--border);
  background: var(--surface);
  box-shadow: -20px 0 60px rgba(20, 24, 41, 0.18);
  transform: translateX(105%);
  transition: transform 260ms ease;
}

.notification-drawer.is-open { transform: translateX(0); }
.notification-drawer header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.notification-drawer h2 { margin: 3px 0 0; font-size: 1.25rem; }
.notification-drawer header small { color: var(--primary); font-size: 0.62rem; font-weight: 750; text-transform: uppercase; }
.notification-item { display: flex; gap: 11px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.notice-avatar { display: grid; width: 36px; height: 36px; flex: 0 0 auto; place-items: center; border-radius: 50%; font-size: 0.58rem; font-weight: 750; }
.notice-avatar.blue { color: var(--blue); background: var(--blue-soft); }
.notice-avatar.peach { color: var(--orange); background: var(--orange-soft); }
.notice-avatar.green { color: var(--green); background: var(--green-soft); }
.notification-item p { margin: 0; }
.notification-item strong, .notification-item small { display: block; }
.notification-item strong { font-size: 0.72rem; }
.notification-item small { margin-top: 4px; color: var(--muted); font-size: 0.62rem; }

.creator-bar {
  position: fixed;
  z-index: 300;
  right: 18px;
  bottom: 18px;
  left: 18px;
  display: none;
  grid-template-columns: minmax(220px, 1fr) auto auto auto;
  align-items: center;
  gap: 13px;
  padding: 13px;
  border: 1px solid var(--primary);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.creator-bar.is-open { display: grid; }
.creator-bar strong { display: block; margin-top: 3px; font-size: 0.72rem; }
.color-picker { display: flex; gap: 7px; }
.color-swatch { width: 31px; height: 31px; border: 3px solid var(--surface); border-radius: 50%; background: var(--swatch); box-shadow: 0 0 0 1px var(--border-strong); cursor: pointer; }
.color-swatch.is-selected { box-shadow: 0 0 0 2px var(--text); }
body.placement-mode { padding-bottom: 90px; }
body.placement-mode .hide-slot { pointer-events: auto; cursor: copy; }
body.placement-mode .hide-slot::after { position: absolute; inset: 7px; border: 2px dashed var(--primary); border-radius: 9px; background: color-mix(in srgb, var(--primary) 9%, transparent); content: ""; }
body.placement-mode .hide-slot:hover::after,
body.placement-mode .hide-slot.is-selected::after { border-style: solid; background: color-mix(in srgb, var(--primary) 20%, transparent); }

.toast {
  position: fixed;
  z-index: 400;
  right: 20px;
  bottom: 20px;
  display: flex;
  min-width: 230px;
  max-width: min(360px, calc(100% - 40px));
  min-height: 48px;
  align-items: center;
  padding: 11px 15px;
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  transform: translateY(18px);
  visibility: hidden;
  opacity: 0;
  font-size: 0.7rem;
  font-weight: 650;
  transition: transform 180ms, opacity 180ms, visibility 180ms;
}

.toast.is-open { transform: translateY(0); visibility: visible; opacity: 1; }

.debug-panel {
  position: fixed;
  z-index: 500;
  top: 75px;
  right: 8px;
  max-width: 310px;
  padding: 9px;
  border: 1px solid #e900c6;
  border-radius: 7px;
  color: #ff4ee4;
  background: rgba(28, 0, 26, 0.92);
  font: 10px/1.4 ui-monospace, monospace;
  pointer-events: none;
}

body.debug .hide-slot { outline: 1px solid rgba(233, 0, 198, 0.35); background: rgba(233, 0, 198, 0.07); }
body.debug .hide-slot::before { position: absolute; right: 0; bottom: 0; color: #e900c6; content: attr(data-slot); font: 8px ui-monospace, monospace; }

@media (max-width: 1120px) {
  .site-header { grid-template-columns: auto minmax(190px, 1fr) auto; }
  .appearance-switcher { grid-row: 2; grid-column: 2 / 4; justify-self: end; margin-top: -4px; }
  .appearance-switcher + .header-actions { grid-column: 3; }
  .workspace { grid-template-columns: 210px minmax(0, 1fr); }
  .component.span-3 { grid-column: span 4; }
  .component.span-4, .component.span-5 { grid-column: span 6; }
  .component.span-6, .component.span-7, .component.span-8 { grid-column: span 12; }
}

@media (max-width: 760px) {
  .site-header { position: static; grid-template-columns: 1fr auto; gap: 10px; padding: 10px 13px; }
  .wordmark { font-size: 1.35rem; }
  .header-search { grid-row: 2; grid-column: 1 / -1; }
  .appearance-switcher { grid-row: 3; grid-column: 1 / -1; width: 100%; justify-self: stretch; }
  .appearance-button { flex: 1; justify-content: center; }
  .header-actions { grid-row: 1; grid-column: 2; }
  .quiet-button { width: 38px; overflow: hidden; padding-inline: 10px; white-space: nowrap; }
  .quiet-button span { margin-right: 20px; }
  .workspace { display: block; }
  .sidebar { position: static; height: auto; padding: 10px 13px; border-right: 0; border-bottom: 1px solid var(--border); }
  .workspace-picker, .sidebar-tip { display: none; }
  .side-nav { display: flex; margin: 0; overflow-x: auto; scrollbar-width: none; }
  .side-nav p, .side-nav button:nth-of-type(n + 5) { display: none; }
  .side-nav button { width: auto; min-width: max-content; grid-template-columns: auto auto auto; gap: 5px; }
  .page-content { padding: 20px 13px 32px; }
  .page-heading { display: block; }
  .game-status { margin-top: 16px; }
  .dashboard-grid { grid-auto-rows: auto; grid-template-columns: 1fr; gap: 11px; }
  .component.span-3, .component.span-4, .component.span-5, .component.span-6, .component.span-7, .component.span-8 { grid-column: 1; }
  .component.tall { grid-row: auto; }
  .intro-card h2 { font-size: clamp(2.35rem, 13vw, 3.5rem); }
  .intro-rules { grid-template-columns: 1fr; }
  .creator-bar { right: 8px; bottom: 8px; left: 8px; grid-template-columns: 1fr auto; }
  .creator-bar > div:first-child, .creator-bar .secondary-button { grid-column: 1 / -1; }
  body.placement-mode { padding-bottom: 175px; }
}

@media (max-width: 430px) {
  .avatar-button, .header-actions .icon-button { display: none; }
  .game-status { display: grid; grid-template-columns: 1fr 1fr; }
  .game-status .target-chip { min-width: 0; }
  .action-grid { grid-template-columns: 1fr; }
  .result-times { grid-template-columns: 1fr; }
  .result-times div + div { border-top: 1px solid var(--border); border-left: 0; }
  .result-actions { grid-template-columns: 1fr; }
  .result-actions .primary-button { grid-column: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
