:root {
  color-scheme: dark;
  --bg: #0a171d;
  --panel: rgba(14, 31, 38, 0.92);
  --panel-solid: #10242b;
  --panel-soft: rgba(22, 46, 52, 0.74);
  --text: #eaf4ee;
  --muted: #8fa8a9;
  --muted-2: #607b80;
  --line: rgba(174, 213, 207, 0.14);
  --accent: #79d4c7;
  --accent-dark: #174c4c;
  --gold: #e9c58d;
  --danger: #e58f83;
  --shadow: 0 24px 72px rgba(0, 0, 0, .32);
}

* { box-sizing: border-box; }
html, body, #appShell { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: var(--bg); color: var(--text); font-family: 'DM Sans', sans-serif; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { height: 100%; background: var(--bg); color: var(--text); position: relative; overflow: hidden; transition: background .25s, color .25s; }
.app-shell[data-theme="light"] {
  color-scheme: light;
  --bg: #dce8e4;
  --panel: rgba(247, 251, 246, .93);
  --panel-solid: #f7fbf6;
  --panel-soft: rgba(226, 239, 231, .86);
  --text: #173239;
  --muted: #5c7879;
  --muted-2: #799293;
  --line: rgba(39, 83, 80, .16);
  --accent: #267e76;
  --accent-dark: #d5eeea;
  --gold: #9c7543;
  --danger: #b9584f;
  --shadow: 0 24px 72px rgba(36, 70, 67, .16);
}

.topbar { height: 76px; position: absolute; z-index: 20; inset: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 0 30px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, rgba(8, 21, 27, .76), rgba(8, 21, 27, .28)); backdrop-filter: blur(14px); }
[data-theme="light"] .topbar { background: linear-gradient(180deg, rgba(242, 249, 243, .9), rgba(242, 249, 243, .48)); }
.brand-lockup { display: flex; align-items: center; gap: 11px; min-width: 260px; }
.brand-mark { width: 39px; height: 39px; border-radius: 13px; display: grid; place-items: center; color: #83d6c9; background: rgba(76, 154, 143, .14); border: 1px solid rgba(121, 212, 199, .2); }
.brand-mark svg { width: 31px; height: 31px; }
.brand-title { font: 800 12px 'Manrope', sans-serif; letter-spacing: .16em; }
.brand-subtitle { font-size: 8px; letter-spacing: .15em; color: var(--muted); margin-top: 3px; }
.topbar-center { display: flex; align-items: center; gap: 9px; font-size: 9px; font-weight: 700; letter-spacing: .13em; color: var(--muted); }
.live-dot, .editor-status i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #7bd4a4; box-shadow: 0 0 10px rgba(123, 212, 164, .75); }
.topbar-divider { height: 13px; width: 1px; background: var(--line); margin: 0 5px; }
.topbar-actions { min-width: 260px; display: flex; justify-content: flex-end; align-items: center; gap: 9px; }
.icon-button, .close-button, .mini-close { display: grid; place-items: center; border: 1px solid var(--line); background: rgba(255,255,255,.035); color: var(--muted); width: 37px; height: 37px; border-radius: 12px; cursor: pointer; transition: .18s ease; }
.icon-button:hover, .close-button:hover, .mini-close:hover { border-color: var(--accent); color: var(--text); background: var(--panel-soft); }
.icon-glyph { font-family: Georgia, serif; font-size: 23px; line-height: 1; }
#themeGlyph { font-size: 19px; }
.primary-button { border: 1px solid rgba(124, 215, 201, .36); border-radius: 11px; background: #79cdbf; color: #102c31; font-size: 11px; font-weight: 700; padding: 11px 16px; cursor: pointer; box-shadow: 0 7px 20px rgba(77, 177, 162, .15); transition: transform .16s, filter .16s; }
.primary-button:hover { transform: translateY(-1px); filter: brightness(1.08); }
.primary-button.compact { display: flex; gap: 6px; align-items: center; }
.button-icon { font-size: 17px; line-height: 10px; }
.experience { position: absolute; inset: 0; overflow: hidden; }
.scene-host { position: absolute; inset: 0; z-index: 0; }
.aquarium-canvas { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }
.scene-vignette { pointer-events: none; position: absolute; inset: 0; z-index: 1; background: radial-gradient(ellipse at 53% 51%, transparent 35%, rgba(3, 12, 17, .17) 100%); }
[data-theme="light"] .scene-vignette { background: radial-gradient(ellipse at 53% 51%, transparent 38%, rgba(48, 78, 70, .11) 100%); }
.scene-stats { position: absolute; top: 102px; right: 31px; z-index: 3; display: flex; gap: 8px; pointer-events: none; }
.stat-pill { height: 34px; min-width: 77px; display: flex; align-items: center; gap: 6px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(10, 28, 34, .54); backdrop-filter: blur(12px); color: var(--text); }
[data-theme="light"] .stat-pill { background: rgba(247, 251, 246, .62); }
.stat-icon { font-size: 12px; color: var(--accent); }
.stat-pill span:nth-child(2) { font: 700 12px 'Manrope', sans-serif; font-variant-numeric: tabular-nums; }
.stat-pill small { color: var(--muted); font-size: 7px; letter-spacing: .12em; }
.editor-panel { position: absolute; z-index: 8; top: 89px; left: 22px; bottom: 24px; width: 310px; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: var(--shadow); backdrop-filter: blur(20px); overflow: hidden; transition: transform .26s ease, opacity .22s ease; }
.editor-panel.is-hidden { transform: translateX(calc(-100% - 28px)); opacity: 0; pointer-events: none; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; padding: 19px 19px 14px; }
.eyebrow, .selected-overline { display: block; color: var(--accent); font-size: 8px; font-weight: 700; letter-spacing: .17em; }
.panel-heading h1 { margin: 4px 0 0; font: 800 21px 'Manrope', sans-serif; letter-spacing: -.04em; }
.close-button { width: 28px; height: 28px; border-radius: 9px; font-size: 20px; }
.tab-switcher { margin: 0 17px 15px; display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border: 1px solid var(--line); background: rgba(0,0,0,.08); border-radius: 11px; }
.tab-button { border: 0; background: transparent; color: var(--muted); padding: 8px; font-size: 10px; font-weight: 700; border-radius: 8px; cursor: pointer; transition: .18s; }
.tab-button span { margin-right: 5px; }
.tab-button.active { background: var(--panel-soft); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.tab-panel { overflow-y: auto; padding: 0 18px 12px; scrollbar-width: thin; scrollbar-color: var(--muted-2) transparent; flex: 1; }
.tab-panel.hidden { display: none; }
.section-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section-row h2 { font: 700 12px 'Manrope', sans-serif; margin: 0; letter-spacing: -.01em; }
.section-row p { font-size: 9px; color: var(--muted); margin: 4px 0 0; }
.section-count { white-space: nowrap; color: var(--muted-2); font-size: 7px; font-weight: 700; letter-spacing: .13em; }
.asset-grid { margin-top: 14px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.asset-card { min-width: 0; min-height: 100px; padding: 9px 5px 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.025); cursor: pointer; transition: transform .16s, border-color .16s, background .16s; }
.asset-card:hover { transform: translateY(-2px); border-color: rgba(121, 212, 199, .55); background: var(--panel-soft); }
.asset-art { width: 40px; height: 37px; display: grid; place-items: center; border-radius: 12px; font-size: 27px; margin-bottom: 6px; }
.coral-art { color: #e99b83; background: rgba(206, 119, 103, .12); }
.fan-art { color: #d6a0bd; background: rgba(194, 129, 167, .13); }
.rock-art { color: #b3b9a7; background: rgba(162, 169, 152, .13); }
.pebble-art { color: #aeb9b3; background: rgba(162, 185, 179, .12); }
.grass-art { color: #7ac28b; background: rgba(94, 174, 114, .13); }
.air-art { color: #7dc5d5; background: rgba(92, 174, 197, .13); }
.asset-name { font-size: 9px; font-weight: 700; text-align: center; white-space: nowrap; }
.asset-sub { font-size: 7px; color: var(--muted); margin-top: 3px; }
.panel-divider { height: 1px; background: var(--line); margin: 17px 0; }
.water-value { color: var(--accent); font: 700 12px 'Manrope', sans-serif; }
.range-slider { width: 100%; appearance: none; background: transparent; height: 22px; margin: 10px 0 0; cursor: pointer; }
.range-slider::-webkit-slider-runnable-track { height: 4px; border-radius: 5px; background: linear-gradient(90deg, var(--accent) 0%, rgba(121,212,199,.25) 100%); }
.range-slider::-moz-range-track { height: 4px; border-radius: 5px; background: rgba(121,212,199,.3); }
.range-slider::-webkit-slider-thumb { appearance: none; width: 13px; height: 13px; margin-top: -4.5px; border-radius: 50%; border: 2px solid var(--panel-solid); background: var(--accent); box-shadow: 0 0 0 3px rgba(121,212,199,.2); }
.range-slider::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--panel-solid); background: var(--accent); }
.range-labels { display: flex; justify-content: space-between; color: var(--muted-2); font-size: 7px; letter-spacing: .11em; }
.panel-tip { margin-top: 17px; display: flex; gap: 8px; padding: 10px 11px; border-radius: 10px; background: var(--panel-soft); color: var(--muted); font-size: 8px; line-height: 1.55; }
.panel-tip strong { color: var(--text); }
.tip-icon { color: var(--gold); font-size: 15px; }
.panel-footer { display: flex; justify-content: space-between; align-items: center; gap: 7px; padding: 10px 12px; border-top: 1px solid var(--line); background: rgba(0,0,0,.05); }
.keyboard-hint { font-size: 6px; color: var(--muted-2); letter-spacing: .08em; white-space: nowrap; }
kbd { font: inherit; color: var(--muted); }
.keyboard-hint i { font-style: normal; margin: 0 3px; }
.editor-status { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 6px; letter-spacing: .08em; white-space: nowrap; }
.editor-status i { width: 5px; height: 5px; }
.fish-list { margin-top: 14px; display: flex; flex-direction: column; gap: 7px; }
.fish-choice { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; background: rgba(255,255,255,.025); border: 1px solid var(--line); border-radius: 11px; text-align: left; cursor: pointer; transition: .16s; }
.fish-choice:hover { border-color: rgba(121,212,199,.55); background: var(--panel-soft); }
.fish-swatch { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 10px; position: relative; }
.fish-swatch::before { content: ''; position: absolute; width: 18px; height: 11px; left: 6px; top: 10px; border-radius: 70% 55% 55% 70%; background: currentColor; box-shadow: inset -3px -2px 0 rgba(0,0,0,.12); }
.fish-swatch::after { content: ''; position: absolute; left: 22px; top: 10px; border-left: 7px solid currentColor; border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.clown-swatch { color: #ed9149; background: rgba(227,128,67,.14); }
.tang-swatch { color: #2b8bd4; background: rgba(57,137,202,.14); }
.gold-swatch { color: #e7b94c; background: rgba(227,184,72,.14); }
.fish-choice-copy { flex: 1; }
.fish-choice-copy strong { display: block; font-size: 10px; }
.fish-choice-copy small { display: block; font-size: 8px; color: var(--muted); margin-top: 3px; }
.add-mark { color: var(--accent); font-size: 18px; }
.behavior-note { display: flex; gap: 10px; align-items: flex-start; padding: 11px; border-radius: 10px; background: var(--panel-soft); }
.behavior-icon { color: var(--accent); font-size: 19px; }
.behavior-note strong { font-size: 9px; }
.behavior-note p { font-size: 8px; color: var(--muted); line-height: 1.55; margin: 4px 0 0; }
.action-dock { position: absolute; z-index: 5; right: 28px; bottom: 46px; display: flex; align-items: center; gap: 8px; }
.feed-button { display: flex; align-items: center; gap: 10px; padding: 10px 14px 10px 11px; border: 1px solid rgba(121,212,199,.4); border-radius: 13px; color: #102b31; background: #83d9ca; box-shadow: 0 10px 28px rgba(50, 163, 149, .22); cursor: pointer; text-align: left; transition: .18s; }
.feed-button:hover { transform: translateY(-2px); filter: brightness(1.06); }
.feed-button.active { color: #17333a; background: #f1cc8f; border-color: #f1cc8f; }
.feed-icon { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 10px; background: rgba(0,0,0,.08); font-size: 16px; }
.feed-button strong { display: block; font-size: 10px; }
.feed-button small { display: block; margin-top: 3px; font-size: 8px; opacity: .7; }
.camera-hint { position: absolute; z-index: 3; right: 30px; bottom: 13px; color: var(--muted); font-size: 7px; letter-spacing: .15em; pointer-events: none; }
.camera-hint span { font-size: 12px; margin-right: 5px; color: var(--accent); }
.camera-hint i { font-style: normal; margin: 0 5px; color: var(--muted-2); }
.selected-card, .fish-card { position: absolute; z-index: 9; right: 27px; bottom: 98px; width: 212px; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); backdrop-filter: blur(18px); box-shadow: var(--shadow); }
.selected-card.hidden, .fish-card.hidden { display: none; }
.selected-top { display: flex; align-items: center; justify-content: space-between; }
.selected-overline { font-size: 7px; }
.mini-close { width: 21px; height: 21px; border-radius: 7px; font-size: 16px; }
.selected-card > strong, .fish-card > strong { display: block; font: 700 13px 'Manrope', sans-serif; margin: 4px 0 9px; }
.scale-control { margin: 2px 0 11px; }
.scale-control label { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 9px; margin-bottom: 5px; }
.scale-control output { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.scale-control .range-slider { width: 100%; }
.selected-actions { display: flex; gap: 7px; }
.selected-actions button, .release-button { flex: 1; border: 1px solid var(--line); background: var(--panel-soft); border-radius: 8px; padding: 7px 5px; font-size: 9px; cursor: pointer; }
.undo-panel-button { border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; background: var(--panel-soft); color: var(--text); cursor: pointer; font: 600 8px 'DM Sans', sans-serif; white-space: nowrap; }
.undo-panel-button:hover:not(:disabled) { border-color: var(--accent); }
.undo-panel-button:disabled { opacity: .4; }
.selected-actions button:hover { border-color: var(--accent); }
.selected-actions .danger-action { color: var(--danger); }
.fish-card { bottom: 132px; }
.fish-state-row { display: flex; align-items: center; gap: 6px; font-size: 8px; color: var(--muted); }
.state-dot { width: 6px; height: 6px; border-radius: 50%; background: #8ed2a2; }
.satiety-label { margin-left: auto; }
.satiety-track { height: 4px; margin: 9px 0 11px; overflow: hidden; border-radius: 5px; background: var(--line); }
.satiety-track i { display: block; width: 72%; height: 100%; background: var(--accent); border-radius: inherit; transition: width .2s; }
.release-button { width: 100%; color: var(--danger); }
.feed-instruction { position: absolute; z-index: 12; left: 50%; transform: translateX(-50%); bottom: 75px; display: flex; align-items: center; gap: 9px; padding: 11px 15px; border: 1px solid rgba(241,204,143,.38); border-radius: 11px; background: rgba(25, 38, 37, .93); color: #f1cc8f; box-shadow: var(--shadow); font-size: 8px; font-weight: 700; letter-spacing: .1em; white-space: nowrap; }
.feed-instruction.hidden { display: none; }
.feed-instruction button { border: 0; background: transparent; color: #fff0d0; font-size: 8px; font-weight: 700; cursor: pointer; padding: 4px; }
.feed-pulse { width: 7px; height: 7px; border-radius: 50%; background: #f1cc8f; box-shadow: 0 0 0 5px rgba(241,204,143,.13); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(241,204,143,0); } }
.toast { position: absolute; z-index: 18; left: 50%; top: 88px; transform: translate(-50%, -10px); opacity: 0; pointer-events: none; padding: 9px 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); color: var(--text); backdrop-filter: blur(14px); font-size: 9px; box-shadow: var(--shadow); transition: .2s; white-space: nowrap; }
.toast.visible { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 900px) {
  .topbar { padding: 0 18px; }
  .topbar-center { display: none; }
  .brand-lockup, .topbar-actions { min-width: 0; }
  .editor-panel { left: 14px; bottom: 20px; width: 284px; }
  .scene-stats { right: 18px; }
  .action-dock { right: 17px; bottom: 36px; }
  .selected-card, .fish-card { right: 17px; bottom: 88px; }
  .camera-hint { right: 18px; bottom: 12px; }
}
@media (max-width: 600px) {
  .topbar { height: 64px; padding: 0 12px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-title { font-size: 10px; }
  .brand-subtitle { font-size: 6px; }
  .topbar-actions { gap: 6px; }
  .icon-button { width: 33px; height: 33px; border-radius: 10px; }
  .primary-button.compact { padding: 9px 10px; font-size: 9px; }
  .scene-stats { top: 76px; right: 12px; gap: 5px; }
  .stat-pill { min-width: 65px; height: 29px; padding: 0 7px; gap: 4px; }
  .stat-pill small { font-size: 6px; }
  .editor-panel { top: auto; bottom: 12px; left: 9px; width: min(290px, calc(100vw - 18px)); max-height: 66vh; border-radius: 15px; }
  .editor-panel.is-hidden { transform: translateY(calc(100% + 60px)); }
  .panel-heading { padding: 13px 15px 10px; }
  .panel-heading h1 { font-size: 17px; }
  .tab-switcher { margin-bottom: 11px; }
  .asset-grid { gap: 6px; }
  .asset-card { min-height: 85px; }
  .asset-art { width: 34px; height: 30px; font-size: 23px; }
  .asset-name { font-size: 8px; }
  .panel-tip { margin-top: 11px; }
  .panel-divider { margin: 12px 0; }
  .panel-footer { padding: 8px 11px; }
  .keyboard-hint { font-size: 5px; }
  .editor-status { font-size: 5px; }
  .undo-panel-button { padding: 5px 6px; font-size: 7px; }
  .action-dock { right: 12px; bottom: 36px; }
  .feed-button { padding: 8px 10px; gap: 7px; }
  .feed-icon { width: 27px; height: 27px; }
  .camera-hint { left: 50%; right: auto; transform: translateX(-50%); bottom: 9px; font-size: 6px; white-space: nowrap; }
  .selected-card, .fish-card { right: 10px; bottom: 82px; width: 190px; }
  .feed-instruction { bottom: 78px; font-size: 7px; max-width: calc(100vw - 24px); white-space: normal; text-align: center; }
  .toast { top: 72px; max-width: calc(100vw - 24px); font-size: 8px; }
}
.webgl-error { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; background: radial-gradient(ellipse at 50% 44%, #173941, #09151b 75%); }
.webgl-error-card { max-width: 430px; padding: 34px; border: 1px solid rgba(174,213,207,.2); border-radius: 20px; background: rgba(13,31,38,.92); text-align: center; box-shadow: var(--shadow); }
.webgl-error-icon { color: var(--accent); font-size: 30px; }
.webgl-error-card h2 { font: 800 21px 'Manrope', sans-serif; }
.webgl-error-card p { color: #a2b9b7; font-size: 12px; line-height: 1.7; }
.webgl-error-card small { color: #668087; font-size: 9px; }
button:disabled { cursor: default; }
