:root {
  color-scheme: dark;
  --bg: #080d14;
  --bg-2: #0d141d;
  --panel: #111a24;
  --panel-2: #17222e;
  --line: rgba(255,255,255,.09);
  --line-2: rgba(255,255,255,.15);
  --ink: #f5f8fb;
  --muted: #8e9cab;
  --gold: #d8b36a;
  --gold-2: #f2d28c;
  --danger: #e05b5b;
  --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif; }
body { padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
.hidden, [hidden] { display: none !important; }
.app-shell { width: min(1100px, 100%); margin: 0 auto; padding: 14px 14px 40px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 5px 2px 13px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-icon { width: 38px; height: 38px; border-radius: 11px; object-fit: contain; background: #0b121a; border: 1px solid var(--line); }
.brand strong { display: block; font-size: 18px; letter-spacing: .4px; }
.brand span { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; letter-spacing: 1.6px; }
.top-actions { display: flex; gap: 7px; }
.ghost-btn, .danger-ghost, .primary-btn { border: 1px solid var(--line); border-radius: 11px; background: var(--panel); color: var(--ink); padding: 9px 12px; font-size: 12px; white-space: nowrap; }
.ghost-btn:active { background: var(--panel-2); }
.danger-ghost { border-color: rgba(224,91,91,.35); color: #ffb4b4; background: rgba(224,91,91,.08); }
.primary-btn { border-color: var(--gold); background: var(--gold); color: #1c1509; font-weight: 800; }
.mode-tabs { display: flex; gap: 5px; background: var(--panel); border: 1px solid var(--line); border-radius: 13px; padding: 4px; margin-bottom: 14px; }
.mode-tab { flex: 1; border: 0; border-radius: 9px; background: transparent; color: var(--muted); padding: 9px 8px; font-size: 12px; font-weight: 700; }
.mode-tab.active { background: var(--gold); color: #1c1509; }
.view { display: flex; flex-direction: column; gap: 10px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.search-row { display: flex; align-items: center; gap: 10px; }
.search { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); color: var(--ink); padding: 11px 12px; outline: none; font-size: 13px; }
.search:focus, .input:focus { border-color: rgba(216,179,106,.65); }
.volume-label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.volume-label input { width: 92px; accent-color: var(--gold); }
.category-tabs, .section-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 1px 0; }
.category-tabs::-webkit-scrollbar, .section-tabs::-webkit-scrollbar { display: none; }
.category-tab, .section-tab { flex: 0 0 auto; border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--muted); padding: 7px 10px; font-size: 11px; }
.category-tab.active { border-color: var(--line); background: var(--panel-2); color: var(--gold-2); }
.section-tab { border-color: var(--line); background: var(--panel); }
.section-tab.active { border-color: var(--gold); background: var(--gold); color: #1c1509; font-weight: 800; }
.sound-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.sound-card { min-height: 72px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; padding: 11px 11px 10px 14px; }
.sound-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--card-color, var(--gold)); }
.sound-card.playing { border-color: rgba(216,179,106,.7); background: #1a2531; }
.sound-card .card-play { position: absolute; inset: 0; border: 0; background: transparent; color: inherit; text-align: left; padding: 0; z-index: 1; }
.sound-name { position: relative; z-index: 2; pointer-events: none; font-size: 13px; font-weight: 700; line-height: 1.45; word-break: break-word; padding-right: 18px; }
.sound-meta { position: relative; z-index: 2; pointer-events: none; margin-top: 5px; color: var(--muted); font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-delete { position: absolute; z-index: 3; top: 5px; right: 5px; width: 25px; height: 25px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 16px; line-height: 1; }
.card-delete:active { color: #ffb4b4; background: rgba(224,91,91,.15); }
.empty { padding: 40px 10px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.empty strong { color: var(--ink); font-size: 14px; }
.empty span { font-size: 11px; line-height: 1.7; }
.storage-note { margin: 4px 2px 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.remote-connect { width: min(430px, 100%); margin: 12px auto; border: 1px solid var(--line); border-radius: 20px; background: linear-gradient(180deg, #121c27, #0c131b); padding: 22px; }
.remote-hero { text-align: center; margin-bottom: 18px; }
.remote-icon { width: 48px; height: 48px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 15px; color: var(--gold-2); background: rgba(216,179,106,.1); font-size: 28px; }
.remote-hero h1 { font-size: 23px; margin: 0 0 7px; }
.remote-hero p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.field span { color: var(--muted); font-size: 10px; }
.input { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #090f16; color: var(--ink); padding: 12px; outline: none; font-size: 13px; }
.code-input { font-size: 22px; letter-spacing: 7px; text-align: center; }
.wide { width: 100%; margin-top: 14px; }
.error { margin-top: 11px; padding: 9px 11px; border-radius: 9px; background: rgba(224,91,91,.1); color: #ffb1b1; font-size: 11px; }
.tiny { margin: 13px 0 0; color: var(--muted); font-size: 9px; line-height: 1.7; }
.remote-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); padding: 11px 12px; }
.remote-head strong { display: block; font-size: 13px; }
.remote-head span { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.remote-head-actions { display: flex; gap: 6px; }
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 100; width: max-content; max-width: calc(100% - 32px); padding: 9px 14px; border: 1px solid var(--line-2); border-radius: 10px; background: rgba(16,24,34,.96); color: var(--ink); font-size: 11px; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.toast.error { color: #ffb0b0; border-color: rgba(224,91,91,.4); }
@media (min-width: 620px) {
  .sound-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .app-shell { padding-left: 20px; padding-right: 20px; }
}
@media (min-width: 900px) {
  .sound-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .view { gap: 12px; }
  .sound-card { min-height: 80px; }
}
@media (orientation: landscape) and (min-width: 700px) {
  .remote-connect { margin-top: 30px; }
}
