:root {
  --bg: #f7f5ff;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-solid: #ffffff;
  --text: #211b35;
  --muted: #706b83;
  --primary: #7c5cff;
  --secondary: #14c8a8;
  --accent: #ffbd3d;
  --danger: #ff5f7a;
  --line: rgba(91, 80, 140, 0.14);
  --shadow: 0 18px 45px rgba(73, 51, 161, 0.15);
}

body.dark {
  --bg: #11131f;
  --panel: rgba(30, 33, 52, 0.84);
  --panel-solid: #202338;
  --text: #f7f6ff;
  --muted: #aaa8bf;
  --line: rgba(255, 255, 255, 0.12);
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(20, 200, 168, 0.16), transparent 34%),
    linear-gradient(160deg, var(--bg), #eef9ff);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.dark {
  background:
    radial-gradient(circle at top left, rgba(124, 92, 255, 0.2), transparent 36%),
    linear-gradient(160deg, var(--bg), #171a2a);
}

body[data-personality="coder"] {
  --primary: #35dfff;
  --secondary: #7c5cff;
}

body[data-personality="artist"] {
  --primary: #ff7cc8;
  --secondary: #ffbd3d;
}

body[data-personality="athlete"] {
  --primary: #14c8a8;
  --secondary: #ff5f7a;
}

body[data-personality="gamer"] {
  --primary: #8e7cff;
  --secondary: #5ad7ff;
}

body.boy-world .app-content,
body.girl-world .app-content {
  position: relative;
  overflow: hidden;
}

body.boy-world .app-content::before,
body.girl-world .app-content::before {
  position: fixed;
  left: 50%;
  top: 80px;
  z-index: -1;
  width: min(100%, 480px);
  transform: translateX(-50%);
  color: rgba(124, 92, 255, 0.08);
  font-size: 54px;
  line-height: 1.7;
  text-align: center;
  pointer-events: none;
}

body.boy-world .app-content::before {
  content: "🚗 🏎️ 🚙 🏁 🚕";
}

body.girl-world .app-content::before {
  content: "🦄 🌈 ✨ 🌸 🎀";
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  touch-action: manipulation;
}

.hidden {
  display: none !important;
}

.phone-shell {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  position: relative;
  overflow-x: hidden;
}

.app-content {
  min-height: 100vh;
  padding: max(16px, env(safe-area-inset-top)) 16px 98px;
  position: relative;
  isolation: isolate;
}

.loader,
.onboarding {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #7c5cff, #14c8a8);
  color: #fff;
  padding: 20px;
}

.onboarding {
  overflow: hidden;
}

.onboarding::before {
  content: "🚗 🏎️ 🚙 🏁";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.4);
  font-size: clamp(42px, 16vw, 86px);
  line-height: 1.9;
  text-align: center;
  filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.13));
  transform: rotate(-12deg) scale(1.2);
  pointer-events: none;
}

.onboarding.girl-theme {
  background: linear-gradient(145deg, #ff7cc8, #8e7cff 52%, #5ad7ff);
}

.onboarding.girl-theme::before {
  content: "🦄 🌈 🦄 ✨";
}

.onboarding.boy-theme {
  background: linear-gradient(145deg, #5ad7ff, #7c5cff 55%, #14c8a8);
}

.loader {
  text-align: center;
}

.loader-orb {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.loader-orb i {
  font-size: 30px;
}

.onboard-card {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 24px 20px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.88);
  color: #211b35;
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.brand-badge {
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: #fff2b8;
  color: #916200;
  font-size: 26px;
}

.onboard-card h1 {
  margin: 14px 0 4px;
  font-size: 34px;
  font-weight: 900;
}

.onboard-card p,
.onboard-card label {
  color: #5d586f;
}

.onboard-card label {
  display: block;
  margin: 12px 0 7px;
  font-weight: 900;
}

.onboard-card input,
.sheet-card input,
.sheet-card select {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0 14px;
  background: var(--panel-solid);
  color: var(--text);
  outline: 0;
}

.picker-title {
  margin: 16px 0 8px;
  font-weight: 800;
}

.choice-row,
.mood-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.gender-row {
  grid-template-columns: 1fr 1fr;
}

.choice,
.mood-btn {
  min-width: 0;
  aspect-ratio: 1;
  border-radius: 18px;
  background: #f3f0ff;
  font-size: 28px;
  border: 2px solid transparent;
}

.gender-row .choice {
  aspect-ratio: auto;
  min-height: 64px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
}

.gender-row .choice span {
  font-size: 27px;
}

.gender-row .choice small {
  font-size: 12px;
  font-weight: 950;
}

.choice.active,
.mood-btn.active {
  border-color: var(--primary);
  background: #e9e3ff;
}

.auth-message {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--danger) !important;
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}

.topbar,
.section-head,
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar {
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 800;
}

.topbar h2,
.section-head h3,
.sheet-head h3 {
  margin: 0;
  font-size: 21px;
  font-weight: 900;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.icon-btn,
.soft-btn,
.primary-btn,
.text-btn,
.fab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: 16px;
  color: var(--text);
}

.icon-btn,
.soft-btn {
  width: 46px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--line);
}

.primary-btn {
  gap: 8px;
  padding: 0 18px;
  background: linear-gradient(135deg, var(--primary), #9b7bff);
  color: white;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(124, 92, 255, 0.28);
}

.small-btn {
  min-height: 42px;
  border-radius: 14px;
}

.full-btn {
  width: 100%;
  margin-top: 18px;
}

.text-btn {
  min-height: 38px;
  padding: 0 12px;
  background: rgba(124, 92, 255, 0.12);
  color: var(--primary);
  font-weight: 900;
}

.auth-switch-btn {
  width: 100%;
  margin-top: 8px;
}

.personality-setup {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.personality-setup select,
.check-line {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0 14px;
  background: var(--panel-solid);
  color: var(--text);
}

.check-line {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  font-weight: 900;
}

.check-line input {
  width: 18px;
  height: 18px;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.glass,
.stat-card,
.dash-card,
.task-item,
.calendar-summary,
.calendar-help,
.calendar-day,
.planner-card,
.shop-item,
.badge-item,
.task-progress,
.skill-list {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.soft-wide-btn {
  width: 100%;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  border-radius: 17px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  font-weight: 950;
}

.hero-card {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 12px;
  min-width: 0;
  padding: 18px;
  border-radius: 28px;
  overflow: hidden;
}

.level-chip,
.coin-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  padding: 7px 10px;
  border-radius: 999px;
  background: #fff0b9;
  color: #7a5600;
  font-size: 12px;
  font-weight: 900;
}

.hero-main h3 {
  margin: 12px 0 6px;
  font-size: 24px;
  font-weight: 950;
}

.hero-main p {
  min-height: 40px;
  margin: 0 0 12px;
  color: var(--muted);
}

.xp-track,
.mini-bar {
  height: 12px;
  border-radius: 99px;
  background: rgba(124, 92, 255, 0.14);
  overflow: hidden;
}

.xp-fill,
.mini-bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--secondary), var(--accent));
}

.mini-text {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pet-stage {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
}

.world-character {
  position: relative;
  z-index: 1;
  font-size: 48px;
  line-height: 1;
  filter: drop-shadow(0 12px 12px rgba(0, 0, 0, 0.14));
  animation: worldFloat 2.2s ease-in-out infinite;
}

.pet-aura {
  position: absolute;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 189, 61, 0.35), rgba(20, 200, 168, 0.05));
}

.pet {
  position: relative;
  z-index: 2;
  margin-top: -6px;
  font-size: 62px;
  filter: drop-shadow(0 10px 10px rgba(0, 0, 0, 0.12));
}

.pet-name {
  position: relative;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 900;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 18px;
}

.world-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  padding: 15px;
  border-radius: 24px;
  overflow: hidden;
}

.world-card h3 {
  margin: 0 0 4px;
  font-size: 19px;
  font-weight: 950;
}

.world-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.world-scene {
  width: 104px;
  min-height: 74px;
  display: grid;
  place-items: center;
  padding: 8px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 25% 20%, rgba(255, 255, 255, 0.62), transparent 32%),
    linear-gradient(135deg, rgba(90, 215, 255, 0.24), rgba(255, 189, 61, 0.24));
  font-size: 25px;
  line-height: 1.25;
  text-align: center;
}

body.girl-world .world-scene {
  background:
    radial-gradient(circle at 25% 20%, rgba(255, 255, 255, 0.7), transparent 32%),
    linear-gradient(135deg, rgba(255, 124, 200, 0.24), rgba(142, 124, 255, 0.24));
}

.stat-card {
  min-width: 0;
  padding: 13px 8px;
  border-radius: 20px;
  text-align: center;
}

.stat-card i {
  color: var(--primary);
}

.stat-card span {
  display: block;
  margin-top: 4px;
  font-size: 21px;
  font-weight: 950;
}

.stat-card small,
.dash-card small,
.planner-card span,
.task-meta,
.history-list,
.shop-item p {
  color: var(--muted);
}

.section-head {
  margin: 20px 0 10px;
}

.mission-list,
.task-list,
.planner-stack,
.shop-list,
.history-list,
.badge-list {
  display: grid;
  gap: 10px;
}

.mission-item,
.planner-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.mission-item i,
.planner-card i {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: rgba(20, 200, 168, 0.14);
  color: var(--secondary);
}

.mission-item strong,
.planner-card strong {
  display: block;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(92px, 0.9fr);
  gap: 10px;
}

.dash-card {
  min-width: 0;
  padding: 14px;
  border-radius: 22px;
}

.dash-card.compact {
  display: grid;
  place-items: center;
  text-align: center;
}

.dash-card.compact strong {
  font-size: 38px;
}

.sticky-subhead {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 8px 0;
  background: linear-gradient(var(--bg), rgba(255, 255, 255, 0));
}

.task-progress {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 22px;
}

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

.task-progress strong {
  font-size: 28px;
}

.task-progress span {
  color: var(--muted);
  font-weight: 800;
}

.filter-row {
  display: flex;
  gap: 8px;
  margin: 12px 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--line);
  font-weight: 900;
}

.filter-pill.active {
  color: #fff;
  background: var(--primary);
}

.calendar-controls {
  display: flex;
  gap: 8px;
}

.calendar-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px;
  border-radius: 22px;
}

.calendar-summary div {
  min-width: 0;
  padding: 11px;
  border-radius: 18px;
  background: rgba(124, 92, 255, 0.09);
}

.calendar-summary strong {
  display: block;
  font-size: 24px;
  font-weight: 950;
}

.calendar-summary span,
.calendar-help,
.calendar-day small,
.day-progress-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

.weekday-row {
  margin: 14px 0 7px;
  color: var(--muted);
  text-align: center;
  font-size: 11px;
  font-weight: 950;
}

.calendar-day {
  min-width: 0;
  min-height: 66px;
  display: grid;
  align-content: space-between;
  gap: 5px;
  padding: 8px 5px;
  border-radius: 16px;
  color: var(--text);
  text-align: left;
}

.calendar-day.blank {
  visibility: hidden;
}

.calendar-day.today {
  outline: 2px solid var(--primary);
}

.calendar-day.complete {
  background: rgba(20, 200, 168, 0.18);
}

.calendar-day.partial {
  background: rgba(255, 189, 61, 0.2);
}

.calendar-day.missed {
  background: rgba(255, 95, 122, 0.14);
}

.calendar-day strong {
  font-size: 14px;
  font-weight: 950;
}

.day-dots {
  display: flex;
  gap: 3px;
}

.day-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.35;
}

.day-dots i.done {
  background: var(--secondary);
  opacity: 1;
}

.calendar-help {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 13px;
  border-radius: 20px;
}

.day-sheet {
  max-height: min(82vh, 720px);
  overflow: auto;
}

.day-progress-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(124, 92, 255, 0.09);
}

.day-task-list {
  display: grid;
  gap: 10px;
}

.day-task-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.day-task-row strong {
  display: block;
  overflow-wrap: anywhere;
}

.day-task-row small {
  color: var(--muted);
  font-weight: 800;
}

.catchup-btn {
  min-height: 38px;
  padding: 0 11px;
  border-radius: 14px;
  background: var(--accent);
  color: #3a2500;
  font-weight: 950;
}

.catchup-btn:disabled {
  opacity: 0.45;
}

.task-item {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border-radius: 21px;
  overflow: hidden;
}

.task-check {
  width: 42px;
  height: 42px;
  border-radius: 15px;
  background: rgba(124, 92, 255, 0.12);
  color: var(--primary);
}

.task-item.done {
  opacity: 0.72;
}

.task-item.done .task-title {
  text-decoration: line-through;
}

.task-title {
  margin: 0;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 800;
}

.task-actions {
  display: flex;
  gap: 4px;
}

.task-actions button {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
}

.task-duration {
  grid-column: 1 / -1;
  display: grid;
  gap: 5px;
  margin-top: 8px;
}

.task-duration small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.task-duration-bar {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(124, 92, 255, 0.12);
}

.task-duration-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--secondary), var(--primary), var(--accent));
}

.empty-state {
  padding: 24px 18px;
  border-radius: 24px;
  background: var(--panel);
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
}

.timer-card {
  padding: 20px;
  border-radius: 30px;
  text-align: center;
}

.timer-card h3 {
  margin: 0 0 12px;
  font-size: 24px;
  font-weight: 950;
}

.timer-ring {
  position: relative;
  width: min(76vw, 285px);
  aspect-ratio: 1;
  margin: 0 auto;
}

.timer-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg,
.ring-progress {
  fill: none;
  stroke-width: 10;
}

.ring-bg {
  stroke: rgba(124, 92, 255, 0.13);
}

.ring-progress {
  stroke: url("#");
  stroke: var(--secondary);
  stroke-linecap: round;
  stroke-dasharray: 326.7;
  stroke-dashoffset: 0;
}

.timer-time {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 42px;
  font-weight: 950;
}

.timer-controls,
.timer-presets {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}

.timer-presets button {
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(124, 92, 255, 0.12);
  color: var(--primary);
  font-weight: 900;
}

.timer-presets button.active {
  background: var(--primary);
  color: #fff;
}

.history-list {
  font-size: 14px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.treasure-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border-radius: 28px;
}

.treasure-card h3 {
  margin: 0 0 4px;
  font-weight: 950;
}

.treasure-card span {
  color: var(--muted);
}

.chest-btn {
  width: 88px;
  height: 88px;
  flex: 0 0 auto;
  border-radius: 28px;
  background: linear-gradient(145deg, #ffe082, #ff9d4d);
  font-size: 45px;
  box-shadow: 0 15px 28px rgba(255, 157, 77, 0.28);
}

.shop-item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 13px;
  border-radius: 22px;
}

.shop-icon,
.badge-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: rgba(255, 189, 61, 0.2);
  font-size: 27px;
}

.shop-item h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 950;
}

.shop-item p {
  margin: 2px 0 0;
  font-size: 12px;
}

.buy-btn {
  min-height: 40px;
  padding: 0 12px;
  border-radius: 14px;
  background: var(--secondary);
  color: #062b26;
  font-weight: 950;
}

.buy-btn.owned {
  background: rgba(124, 92, 255, 0.12);
  color: var(--primary);
}

.profile-card {
  padding: 22px 16px;
  border-radius: 30px;
  text-align: center;
}

.avatar-big {
  width: 86px;
  height: 86px;
  display: grid;
  place-items: center;
  margin: 0 auto 8px;
  border-radius: 30px;
  background: rgba(124, 92, 255, 0.12);
  font-size: 44px;
}

.profile-card h3 {
  margin: 0;
  font-weight: 950;
}

.profile-card p {
  color: var(--muted);
}

.profile-world-scene {
  width: fit-content;
  max-width: 100%;
  margin: 10px auto 12px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(124, 92, 255, 0.1);
  font-size: 22px;
  line-height: 1.2;
}

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

.profile-stats span {
  display: grid;
  padding: 10px 4px;
  border-radius: 18px;
  background: rgba(124, 92, 255, 0.09);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.profile-stats b {
  color: var(--text);
  font-size: 20px;
}

.badge-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 20px;
}

.badge-item.locked {
  opacity: 0.45;
}

.badge-item strong {
  display: block;
}

.badge-item small {
  color: var(--muted);
}

.skill-list {
  display: grid;
  gap: 13px;
  padding: 15px;
  border-radius: 22px;
}

.privacy-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.privacy-card strong,
.privacy-card span {
  display: block;
}

.privacy-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.skill-line {
  display: grid;
  grid-template-columns: 86px 1fr;
  align-items: center;
  gap: 12px;
}

.skill-line span {
  font-weight: 900;
}

.skill-line div {
  height: 12px;
  border-radius: 999px;
  background: rgba(124, 92, 255, 0.12);
  overflow: hidden;
}

.skill-line b {
  display: block;
  width: 20%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 20;
  width: min(100%, 480px);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  padding: 9px 8px max(9px, env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.86);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

body.dark .bottom-nav {
  background: rgba(24, 26, 42, 0.9);
}

.bottom-nav button {
  min-width: 0;
  min-height: 58px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  border-radius: 18px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.bottom-nav i {
  font-size: 17px;
}

.bottom-nav button.active {
  background: rgba(124, 92, 255, 0.13);
  color: var(--primary);
}

.fab {
  position: fixed;
  right: max(18px, calc((100vw - 480px) / 2 + 18px));
  bottom: 88px;
  z-index: 19;
  width: 58px;
  height: 58px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--accent), #ff7c7c);
  color: #3b2400;
  box-shadow: 0 16px 35px rgba(255, 128, 71, 0.32);
}

.modal-sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  align-items: end;
  justify-items: center;
  padding: 12px;
  background: rgba(19, 18, 33, 0.42);
}

.sheet-card {
  width: min(100%, 456px);
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 26px 26px 20px 20px;
  background: var(--panel-solid);
  box-shadow: var(--shadow);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.toast-pop {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 45;
  width: min(calc(100% - 28px), 430px);
  transform: translateX(-50%);
  padding: 13px 16px;
  border-radius: 18px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-weight: 900;
  text-align: center;
}

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

.float-pop {
  position: fixed;
  font-weight: 950;
  color: var(--primary);
  text-shadow: 0 2px 8px rgba(255, 255, 255, 0.8);
}

.confetti {
  position: fixed;
  width: 9px;
  height: 14px;
  border-radius: 4px;
}

@media (max-width: 360px) {
  .app-content {
    padding-left: 12px;
    padding-right: 12px;
  }

  .hero-card {
    grid-template-columns: 1fr 92px;
    padding: 15px;
  }

  .pet {
    font-size: 50px;
  }

  .bottom-nav span {
    font-size: 9px;
  }

  .timer-time {
    font-size: 34px;
  }
}

/* CSS additions: AI Chat Assistant */
.questly-ai-fab {
  position: fixed;
  right: max(18px, calc((100vw - 480px) / 2 + 18px));
  bottom: 156px;
  z-index: 31;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: linear-gradient(135deg, #5ad7ff, var(--primary), #ff7cc8);
  color: #fff;
  box-shadow: 0 16px 35px rgba(124, 92, 255, 0.36);
  animation: questlyAiGlow 2.5s ease-in-out infinite;
}

.questly-ai-fab i {
  font-size: 22px;
}

.questly-ai-panel {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 70;
  width: min(calc(100% - 18px), 462px);
  height: min(78vh, 680px);
  max-height: calc(100dvh - 22px);
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.88), rgba(247, 245, 255, 0.78)),
    var(--panel-solid);
  box-shadow: 0 26px 70px rgba(37, 28, 86, 0.28);
  backdrop-filter: blur(22px);
  transform: translate(-50%, 24px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.24s ease, opacity 0.24s ease;
}

body.dark .questly-ai-panel {
  background:
    linear-gradient(145deg, rgba(30, 33, 52, 0.92), rgba(17, 19, 31, 0.82)),
    var(--panel-solid);
}

.questly-ai-panel.open {
  transform: translate(-50%, 0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.questly-ai-header {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 13px;
  border-bottom: 1px solid var(--line);
}

.questly-ai-avatar {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
}

.questly-ai-header strong,
.questly-ai-header span {
  display: block;
}

.questly-ai-header strong {
  font-size: 16px;
  font-weight: 950;
}

.questly-ai-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.questly-ai-icon {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: rgba(124, 92, 255, 0.11);
  color: var(--primary);
}

.questly-ai-messages {
  min-width: 0;
  overflow-y: auto;
  padding: 14px 12px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

.questly-ai-row {
  display: grid;
  gap: 5px;
  margin-bottom: 12px;
  animation: questlyAiBubbleIn 0.2s ease both;
}

.questly-ai-row.user {
  justify-items: end;
}

.questly-ai-row.ai {
  justify-items: start;
}

.questly-ai-bubble {
  max-width: min(82%, 340px);
  padding: 11px 12px;
  border-radius: 18px;
  color: var(--text);
  background: rgba(124, 92, 255, 0.11);
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  line-height: 1.38;
  font-size: 14px;
}

.questly-ai-row.user .questly-ai-bubble {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #9b7bff);
  border-color: transparent;
  border-bottom-right-radius: 7px;
}

.questly-ai-row.ai .questly-ai-bubble {
  border-bottom-left-radius: 7px;
}

.questly-ai-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.questly-ai-copy {
  min-height: 26px;
  padding: 0 8px;
  border-radius: 10px;
  background: rgba(20, 200, 168, 0.12);
  color: var(--secondary);
  font-size: 11px;
  font-weight: 950;
}

.questly-ai-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.questly-ai-typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  animation: questlyAiTyping 0.9s ease-in-out infinite;
}

.questly-ai-typing i:nth-child(2) {
  animation-delay: 0.12s;
}

.questly-ai-typing i:nth-child(3) {
  animation-delay: 0.24s;
}

.questly-ai-prompts {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  scrollbar-width: none;
}

.questly-ai-prompts::-webkit-scrollbar {
  display: none;
}

.questly-ai-prompts button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 189, 61, 0.18);
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}

.questly-ai-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
  align-items: end;
  padding: 11px 12px max(11px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}

.questly-ai-form textarea {
  width: 100%;
  max-height: 104px;
  min-height: 46px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 12px 13px;
  outline: 0;
  background: var(--panel-solid);
  color: var(--text);
  line-height: 1.25;
}

.questly-ai-form button {
  width: 46px;
  height: 46px;
  border-radius: 17px;
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  color: #fff;
  box-shadow: 0 10px 24px rgba(20, 200, 168, 0.24);
}

@keyframes questlyAiGlow {
  0%, 100% {
    transform: translateY(0);
    box-shadow: 0 16px 35px rgba(124, 92, 255, 0.32);
  }
  50% {
    transform: translateY(-4px);
    box-shadow: 0 20px 42px rgba(124, 92, 255, 0.46);
  }
}

@keyframes questlyAiBubbleIn {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes questlyAiTyping {
  0%, 100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  50% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

@keyframes worldFloat {
  0%, 100% {
    transform: translateY(0) rotate(-2deg);
  }
  50% {
    transform: translateY(-6px) rotate(2deg);
  }
}

@keyframes themeDrift {
  0%, 100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -10px;
  }
}

/* Bigger logged-in cartoon picture background */
.topbar,
.screen,
.fab,
.bottom-nav {
  position: relative;
  z-index: 2;
}

.theme-backdrop {
  position: fixed;
  left: 50%;
  top: 0;
  z-index: 0;
  width: min(100%, 480px);
  height: 100dvh;
  transform: translateX(-50%);
  overflow: hidden;
  pointer-events: none;
}

.theme-float {
  position: absolute;
  display: grid;
  place-items: center;
  width: 104px;
  height: 104px;
  border-radius: 34px;
  background:
    radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.72), transparent 32%),
    linear-gradient(135deg, rgba(90, 215, 255, 0.22), rgba(255, 189, 61, 0.16));
  box-shadow: 0 22px 48px rgba(124, 92, 255, 0.12);
  font-size: 54px;
  opacity: 0.42;
  animation: themeDrift 5s ease-in-out infinite;
}

body.girl-world .theme-float {
  background:
    radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.76), transparent 32%),
    linear-gradient(135deg, rgba(255, 124, 200, 0.2), rgba(142, 124, 255, 0.17));
}

.float-1 {
  top: 92px;
  left: -26px;
  transform: rotate(-13deg);
}

.float-2 {
  top: 178px;
  right: -28px;
  transform: rotate(12deg);
  animation-delay: 0.4s;
}

.float-3 {
  top: 374px;
  left: -34px;
  transform: rotate(10deg);
  animation-delay: 0.9s;
}

.float-4 {
  top: 492px;
  right: -32px;
  transform: rotate(-9deg);
  animation-delay: 1.2s;
}

.float-5 {
  bottom: 118px;
  left: 18px;
  width: 78px;
  height: 78px;
  font-size: 42px;
  animation-delay: 1.5s;
}

.float-6 {
  bottom: 176px;
  right: 20px;
  width: 84px;
  height: 84px;
  font-size: 43px;
  animation-delay: 1.9s;
}

.world-card {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.72)),
    var(--panel);
}

body.dark .world-card {
  background:
    linear-gradient(135deg, rgba(32, 35, 56, 0.92), rgba(32, 35, 56, 0.72)),
    var(--panel);
}

.world-scene {
  width: 132px;
  min-height: 118px;
  font-size: 34px;
  border-radius: 30px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28), 0 14px 28px rgba(124, 92, 255, 0.12);
}

.world-character {
  font-size: 58px;
  margin-bottom: -10px;
}

@media (max-width: 360px) {
  .world-scene {
    width: 102px;
    min-height: 96px;
    font-size: 28px;
  }

  .theme-float {
    opacity: 0.34;
  }
}

@media (max-width: 360px) {
  .questly-ai-panel {
    width: calc(100% - 12px);
    height: min(80vh, 660px);
    border-radius: 24px;
  }

  .questly-ai-bubble {
    max-width: 88%;
  }
}

/* CSS additions: Treasure Ocean Adventure Mini-Game */
.ocean-game-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
  background:
    radial-gradient(circle at 92% 18%, rgba(90, 215, 255, 0.35), transparent 34%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(222, 247, 255, 0.74)),
    var(--panel);
}

body.dark .ocean-game-card {
  background:
    radial-gradient(circle at 92% 18%, rgba(90, 215, 255, 0.18), transparent 34%),
    linear-gradient(135deg, rgba(32, 35, 56, 0.96), rgba(23, 40, 62, 0.82)),
    var(--panel);
}

.ocean-game-card h3 {
  margin: 2px 0 5px;
  font-size: 19px;
  font-weight: 950;
}

.ocean-game-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.ocean-game-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  overflow: hidden;
  background: #042b54;
  color: #fff;
}

.ocean-game-shell {
  position: relative;
  width: min(100%, 480px);
  min-height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 15% 18%, rgba(255, 255, 255, 0.28), transparent 16%),
    radial-gradient(circle at 78% 6%, rgba(255, 221, 101, 0.18), transparent 18%),
    linear-gradient(180deg, #4cd6ff 0%, #1780c9 42%, #06416f 100%);
}

.ocean-game-shell::before,
.ocean-game-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ocean-game-shell::before {
  opacity: 0.2;
  background:
    radial-gradient(circle at 18% 88%, #fff 0 4px, transparent 5px),
    radial-gradient(circle at 58% 76%, #fff 0 3px, transparent 4px),
    radial-gradient(circle at 84% 58%, #fff 0 5px, transparent 6px);
  animation: oceanBubbles 5s linear infinite;
}

.ocean-game-shell::after {
  background:
    linear-gradient(110deg, transparent 0 32%, rgba(255, 255, 255, 0.12) 36%, transparent 44%),
    linear-gradient(70deg, transparent 0 56%, rgba(255, 255, 255, 0.08) 62%, transparent 70%);
  animation: oceanLightMove 7s ease-in-out infinite;
}

.ocean-game-top,
.ocean-hud,
.ocean-mission-strip,
.ocean-control-pad,
.ocean-canvas-wrap {
  position: relative;
  z-index: 1;
}

.ocean-game-top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(16px);
}

.ocean-game-top strong,
.ocean-game-top span {
  display: block;
}

.ocean-game-top strong {
  font-size: 15px;
  font-weight: 950;
}

.ocean-game-top span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 11px;
  font-weight: 850;
}

.ocean-icon-btn,
.ocean-control-pad button {
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.ocean-icon-btn {
  width: 42px;
  height: 42px;
}

.ocean-hud {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  margin: 9px 0;
}

.ocean-hud span,
.ocean-mission-strip div,
.ocean-menu-stats span,
.ocean-drawer-card {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.16);
  box-shadow: 0 14px 28px rgba(0, 25, 70, 0.14);
  backdrop-filter: blur(16px);
}

.ocean-hud span {
  min-width: 0;
  min-height: 44px;
  display: grid;
  place-items: center;
  gap: 1px;
  border-radius: 17px;
  font-size: 11px;
}

.ocean-hud b {
  max-width: 100%;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ocean-canvas-wrap {
  min-height: 0;
  overflow: hidden;
  border-radius: 26px;
  box-shadow: 0 24px 54px rgba(0, 19, 54, 0.28);
}

#oceanGameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 390px;
  max-height: calc(100dvh - 252px);
  touch-action: none;
  background: linear-gradient(180deg, #66e4ff, #0f8bd6 48%, #05345f);
}

.ocean-game-menu {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 50%;
  z-index: 3;
  display: grid;
  gap: 12px;
  justify-items: center;
  padding: 20px 16px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 26px;
  background: rgba(5, 31, 66, 0.66);
  text-align: center;
  backdrop-filter: blur(18px);
  transform: translateY(-50%);
}

.ocean-game-menu h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 950;
}

.ocean-game-menu p {
  max-width: 320px;
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 750;
}

.ocean-logo-fish {
  position: relative;
  width: 104px;
  height: 70px;
  animation: oceanFishBob 1.8s ease-in-out infinite;
}

.ocean-logo-fish span,
.ocean-logo-fish::before,
.ocean-logo-fish::after {
  position: absolute;
  content: "";
  display: block;
}

.ocean-logo-fish span {
  inset: 13px 22px 9px 0;
  border-radius: 58% 48% 48% 58%;
  background: linear-gradient(135deg, #ffcb4f, #ff7a59);
  box-shadow: inset 8px -8px 0 rgba(255, 255, 255, 0.2);
}

.ocean-logo-fish span::before {
  content: "";
  position: absolute;
  right: 12px;
  top: 13px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16324f;
}

.ocean-logo-fish::before {
  right: 0;
  top: 20px;
  border-top: 17px solid transparent;
  border-bottom: 17px solid transparent;
  border-left: 30px solid #ff7a59;
}

.ocean-logo-fish::after {
  left: 22px;
  top: 0;
  width: 28px;
  height: 26px;
  border-radius: 50% 50% 6px 6px;
  background: #ffd56a;
  transform: rotate(-12deg);
}

.ocean-menu-stats {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.ocean-menu-stats span {
  display: grid;
  gap: 2px;
  min-height: 54px;
  align-content: center;
  border-radius: 17px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: 850;
}

.ocean-menu-stats b {
  color: #fff;
  font-size: 14px;
}

.ocean-primary-btn,
.ocean-soft-btn,
.ocean-mini-actions button,
.ocean-drawer-card button {
  min-height: 44px;
  border-radius: 16px;
  padding: 0 14px;
  color: #fff;
  font-weight: 950;
}

.ocean-primary-btn {
  width: min(100%, 260px);
  background: linear-gradient(135deg, #ffcf5c, #ff7b69);
  box-shadow: 0 14px 30px rgba(255, 123, 105, 0.28);
}

.ocean-soft-btn,
.ocean-mini-actions button {
  background: rgba(255, 255, 255, 0.18);
}

.ocean-mini-actions {
  width: min(100%, 260px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.ocean-mission-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 9px 0;
}

.ocean-mission-strip div {
  display: grid;
  gap: 2px;
  min-height: 48px;
  align-content: center;
  border-radius: 17px;
  padding: 0 8px;
}

.ocean-mission-strip span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 10px;
  font-weight: 850;
}

.ocean-mission-strip b {
  font-size: 12px;
}

.ocean-control-pad {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
}

.ocean-control-pad button {
  height: 52px;
  font-size: 18px;
}

.ocean-drawer {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 5;
  max-height: min(62dvh, 520px);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 26px;
  background: rgba(6, 38, 76, 0.82);
  backdrop-filter: blur(20px);
  box-shadow: 0 24px 60px rgba(0, 19, 54, 0.34);
}

.ocean-drawer .sheet-head {
  padding: 12px;
}

.ocean-drawer-list {
  display: grid;
  gap: 10px;
  overflow-y: auto;
  padding: 0 12px 12px;
}

.ocean-drawer-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 74px;
  border-radius: 20px;
  padding: 10px;
}

.ocean-drawer-icon {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: linear-gradient(135deg, #69e8ff, #ffcf5c);
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.08);
}

.ocean-drawer-card strong,
.ocean-drawer-card small {
  display: block;
}

.ocean-drawer-card strong {
  font-size: 14px;
}

.ocean-drawer-card small {
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: 750;
}

.ocean-drawer-card button {
  min-width: 74px;
  background: linear-gradient(135deg, #20d7ac, #4ecaff);
}

.ocean-drawer-card button:disabled {
  opacity: 0.58;
}

@keyframes oceanBubbles {
  from {
    transform: translateY(18px);
  }
  to {
    transform: translateY(-34px);
  }
}

@keyframes oceanLightMove {
  0%, 100% {
    transform: translateX(-18px);
  }
  50% {
    transform: translateX(22px);
  }
}

@keyframes oceanFishBob {
  0%, 100% {
    transform: translateY(0) rotate(-2deg);
  }
  50% {
    transform: translateY(-8px) rotate(2deg);
  }
}

@media (max-width: 360px) {
  .ocean-game-shell {
    padding-left: 7px;
    padding-right: 7px;
  }

  .ocean-hud,
  .ocean-mission-strip {
    gap: 5px;
  }

  .ocean-hud span {
    min-height: 40px;
    border-radius: 14px;
    font-size: 10px;
  }

  .ocean-hud b,
  .ocean-mission-strip b {
    font-size: 10px;
  }

  .ocean-game-menu {
    left: 8px;
    right: 8px;
    padding: 16px 12px;
  }
}

/* CSS additions: Dream Car Collector Mini-Game */
.dream-car-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
  background:
    radial-gradient(circle at 88% 14%, rgba(255, 207, 92, 0.34), transparent 34%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(240, 237, 255, 0.76)),
    var(--panel);
}

body.dark .dream-car-card {
  background:
    radial-gradient(circle at 88% 14%, rgba(255, 207, 92, 0.18), transparent 34%),
    linear-gradient(135deg, rgba(32, 35, 56, 0.96), rgba(42, 25, 70, 0.84)),
    var(--panel);
}

.dream-car-card h3 {
  margin: 2px 0 5px;
  font-size: 19px;
  font-weight: 950;
}

.dream-car-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.car-game-overlay {
  position: fixed;
  inset: 0;
  z-index: 94;
  overflow: hidden;
  color: #fff;
  background: #08091a;
}

.car-game-shell {
  position: relative;
  width: min(100%, 480px);
  min-height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 14% 18%, rgba(255, 92, 150, 0.24), transparent 24%),
    radial-gradient(circle at 88% 8%, rgba(64, 225, 255, 0.22), transparent 26%),
    linear-gradient(180deg, #1b1a55, #11132f 42%, #070814);
}

.car-game-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 38px 38px;
  opacity: 0.45;
  animation: carGridMove 4s linear infinite;
  pointer-events: none;
}

.car-game-top,
.car-hud,
.car-stage,
.car-mission-strip,
.car-control-pad {
  position: relative;
  z-index: 1;
}

.car-game-top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(16px);
}

.car-game-top strong,
.car-game-top span {
  display: block;
}

.car-game-top strong {
  font-size: 15px;
  font-weight: 950;
}

.car-game-top span {
  color: rgba(255, 255, 255, 0.76);
  font-size: 11px;
  font-weight: 850;
}

.car-icon-btn,
.car-control-pad button {
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.17);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.car-icon-btn {
  width: 42px;
  height: 42px;
}

.car-hud {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  margin: 9px 0;
}

.car-hud span,
.car-stat-grid span,
.car-mission-strip div,
.car-drawer-card {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.13);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(16px);
}

.car-hud span {
  min-width: 0;
  min-height: 44px;
  display: grid;
  place-items: center;
  gap: 1px;
  border-radius: 17px;
  font-size: 11px;
}

.car-hud b {
  max-width: 100%;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.car-stage {
  min-height: 0;
  overflow: hidden;
  border-radius: 26px;
  background: #121631;
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.38);
}

#carRaceCanvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 390px;
  max-height: calc(100dvh - 252px);
  touch-action: none;
  background: linear-gradient(180deg, #242567, #0b0e24);
}

.car-menu-panel {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 50%;
  z-index: 3;
  display: grid;
  gap: 12px;
  justify-items: center;
  padding: 18px 14px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 26px;
  background: rgba(9, 10, 30, 0.74);
  text-align: center;
  backdrop-filter: blur(18px);
  transform: translateY(-50%);
}

.car-menu-panel h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 950;
}

.car-menu-panel p {
  max-width: 330px;
  margin: 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  font-weight: 750;
}

.car-garage-scene {
  position: relative;
  width: min(100%, 300px);
  min-height: 184px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 12%, rgba(255, 255, 255, 0.25), transparent 22%),
    linear-gradient(180deg, rgba(124, 92, 255, 0.35), rgba(10, 11, 34, 0.86));
}

.garage-lights {
  position: absolute;
  inset: -20%;
  background:
    conic-gradient(from 0deg, rgba(255, 92, 150, 0.22), rgba(64, 225, 255, 0.2), rgba(255, 207, 92, 0.2), rgba(255, 92, 150, 0.22));
  animation: carNeonSpin 4s linear infinite;
}

#carGarageCanvas {
  position: relative;
  z-index: 1;
  width: min(100%, 280px);
  height: 170px;
}

.car-stat-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.car-stat-grid span {
  display: grid;
  gap: 2px;
  min-height: 54px;
  align-content: center;
  border-radius: 17px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 10px;
  font-weight: 850;
}

.car-stat-grid b {
  color: #fff;
  font-size: 13px;
}

.car-primary-btn,
.car-soft-btn,
.car-menu-actions button,
.car-drawer-card button {
  min-height: 44px;
  border-radius: 16px;
  padding: 0 13px;
  color: #fff;
  font-weight: 950;
}

.car-primary-btn {
  width: min(100%, 260px);
  background: linear-gradient(135deg, #ffcf5c, #ff5f96, #7c5cff);
  box-shadow: 0 14px 30px rgba(255, 95, 150, 0.28);
}

.car-soft-btn,
.car-menu-actions button {
  background: rgba(255, 255, 255, 0.17);
}

.car-menu-actions {
  width: min(100%, 310px);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

.car-menu-actions button {
  min-height: 48px;
  padding: 0 6px;
  font-size: 11px;
}

.car-mission-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 9px 0;
}

.car-mission-strip div {
  display: grid;
  gap: 2px;
  min-height: 48px;
  align-content: center;
  border-radius: 17px;
  padding: 0 8px;
}

.car-mission-strip span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 10px;
  font-weight: 850;
}

.car-mission-strip b {
  font-size: 12px;
}

.car-control-pad {
  display: grid;
  grid-template-columns: 1fr auto auto 1fr;
  gap: 9px;
}

.car-control-pad button {
  height: 52px;
  font-size: 18px;
}

.car-drawer {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 6;
  max-height: min(66dvh, 540px);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 26px;
  background: rgba(9, 10, 30, 0.88);
  backdrop-filter: blur(20px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
}

.car-drawer .sheet-head {
  padding: 12px;
}

.car-drawer-list {
  display: grid;
  gap: 10px;
  overflow-y: auto;
  padding: 0 12px 12px;
}

.car-drawer-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 78px;
  border-radius: 20px;
  padding: 10px;
}

.car-drawer-icon {
  width: 52px;
  height: 36px;
  border-radius: 18px 18px 8px 8px;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.22), inset 0 -8px 0 rgba(0, 0, 0, 0.12);
}

.car-drawer-card strong,
.car-drawer-card small {
  display: block;
}

.car-drawer-card strong {
  font-size: 14px;
}

.car-drawer-card small {
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: 750;
}

.car-drawer-card button {
  min-width: 74px;
  background: linear-gradient(135deg, #35dfff, #8e7cff);
}

.car-drawer-card button:disabled {
  opacity: 0.58;
}

@keyframes carGridMove {
  from {
    background-position: 0 0, 0 0;
  }
  to {
    background-position: 38px 38px, 0 38px;
  }
}

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

@media (max-width: 360px) {
  .car-game-shell {
    padding-left: 7px;
    padding-right: 7px;
  }

  .car-hud,
  .car-mission-strip,
  .car-menu-actions {
    gap: 5px;
  }

  .car-hud span {
    min-height: 40px;
    border-radius: 14px;
    font-size: 10px;
  }

  .car-hud b,
  .car-mission-strip b {
    font-size: 10px;
  }

  .car-menu-panel {
    left: 8px;
    right: 8px;
    padding: 15px 10px;
  }
}
