/* Readable studio controls, responsive desktop layout and explicit theme tokens. */
:root {
  --bg: #f5f7f2; --paper: #fff; --panel: #f0f4e9; --sidebar: #edf2e8;
  --ink: #233a30; --muted: #65735f; --line: #dce4d5; --green: #285b43;
  --accent: #315e36; --selected: #dce9d2; --input: #fff; --warm: #f3e9dc;
  --warm-ink: #8b572d; --wave-bg: #f3f0e9; --wave-selection: #f3e4d2;
  --wave-bar: #bd7c42; --wave-muted: #c9c5b9; --shadow: 0 8px 30px #193e3208;
  font-size: 16px; color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #141a18; --paper: #202924; --panel: #26332a; --sidebar: #19221d;
  --ink: #eef4e8; --muted: #acbba7; --line: #38473a; --green: #98c879;
  --accent: #bcdfa5; --selected: #344c32; --input: #18211b; --warm: #423428;
  --warm-ink: #edb780; --wave-bg: #242a24; --wave-selection: #493a2a;
  --wave-bar: #e4ad72; --wave-muted: #64705c; --shadow: 0 8px 30px #0002;
  color-scheme: dark;
}
body { background: var(--bg); color: var(--ink); }
button:disabled { cursor: default; opacity: .45; }
input, select, button { font-size: 15px; }
.sidebar { width: 280px; padding: 36px 22px; background: var(--sidebar); }
.brand { font-size: 20px; gap: 12px; }
.brand small { font-size: 11px; color: var(--muted); }
.brand-icon { width: 42px; height: 42px; background: #285b43; }
.workspace { font-size: 15px; padding: 16px 12px; margin: 36px 0; background: var(--paper); border-color: var(--line); }
.workspace-icon, .profile-avatar { background: var(--selected); color: var(--ink); }
.workspace small, .sidebar-bottom small { font-size: 12px; color: var(--muted); }
.nav-label { font-size: 12px; color: var(--muted); }
.nav-item { font-size: 16px; padding: 14px 12px; color: var(--muted); gap: 12px; }
.nav-item b, .tag-heading>span { font-size: 13px; color: var(--muted); }
.nav-item.selected, .sidebar-tag.selected { background: var(--selected); color: var(--accent); }
.nav-item:hover, .sidebar-tag:hover { background: var(--selected); }
.sidebar-tag { font-size: 15px; color: var(--muted); padding: 12px; }
.sidebar-tag span:last-child { font-size: 13px; color: var(--muted); }
.no-tags, .sidebar-bottom, .sidebar-bottom p { font-size: 13px; color: var(--muted); }
.sidebar-bottom small { font-size: 11px; line-height: 1.5; }
.local-badge { font-size: 12px; background: var(--selected); color: var(--accent); padding: 11px; }
main { margin-left: 280px; }
.topbar { height: 88px; padding: 0 48px; background: var(--paper); font-size: 14px; }
.breadcrumb, .network-badge { color: var(--muted); }
.network-badge { font-size: 13px; }
.topbar-settings { display: flex; align-items: center; gap: 24px; }
.theme-setting { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.theme-setting select { padding: 10px 14px; }
.main-content { max-width: 2000px; padding: 48px 48px 0; }
.page-heading { margin-bottom: 36px; }
.eyebrow { font-size: 12px; color: var(--muted); }
h1 { font-size: 42px; letter-spacing: -1.6px; }
.page-heading p { font-size: 16px; color: var(--muted); line-height: 1.6; }
.button { min-height: 44px; font-size: 15px; padding: 13px 19px; border-radius: 9px; }
.button.primary { background: #285b43; color: #fff; }
.button.primary:hover { background: #1b4932; }
[data-theme="dark"] .button.primary { background: #98c879; color: #172218; }
[data-theme="dark"] .button.primary:hover { background: #b3df97; }
.secondary, select { background: var(--paper); color: var(--ink); border-color: var(--line); }
select { min-height: 44px; font-size: 14px; padding: 12px 30px 12px 14px; }
.overview { background: var(--paper); margin-bottom: 28px; }
.overview>div { padding: 25px; gap: 17px; }
.metric-icon { background: var(--panel); border-color: var(--line); width: 48px; height: 50px; font-size: 25px; color: var(--accent); }
.overview p { font-size: 14px; color: var(--muted); }
.overview strong { font-size: 36px; color: var(--ink); margin-top: 12px; }
.overview .overview-note { background: var(--panel); }
.overview-note p, .overview-note small { font-size: 13px; color: var(--muted); }
.drop-zone { background: var(--panel); border-color: var(--line); padding: 26px; }
.drop-zone:hover, .drop-zone.dragging { background: var(--selected); }
.drop-icon { width: 48px; height: 48px; background: var(--paper); border-color: var(--line); color: var(--accent); }
.drop-zone strong { font-size: 16px; color: var(--ink); }
.drop-zone p { font-size: 14px; color: var(--muted); }
.drop-zone p span { color: var(--accent); }
.format-note { font-size: 12px; color: var(--muted); }
.library-toolbar { margin-bottom: 24px; gap: 20px; flex-wrap: wrap; }
.library-toolbar h2 { font-size: 24px; }
.count-pill { font-size: 13px; background: var(--selected); color: var(--accent); }
.toolbar-controls { gap: 12px!important; }
.search-box { min-height: 46px; padding: 10px 14px; background: var(--input); }
.search-box input { width: 250px; font-size: 15px; color: var(--ink); }
.search-box input::placeholder { color: var(--muted); }
.sound-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 22px; }
.sound-card, .sound-card.inactive { background: var(--paper); padding: 24px; }
.sound-card { min-height: 225px; }
.sound-card.inactive { opacity: .8; }
.sound-card:hover { border-color: var(--green); }
.card-top { gap: 14px; }
.sound-emoji { width: 56px; height: 56px; border-radius: 14px; font-size: 29px; flex-shrink: 0; }
.sound-card:nth-child(n) .sound-emoji { background: var(--panel); }
.card-info h3 { font-size: 18px; line-height: 1.4; margin-bottom: 7px; }
.card-subtitle { font-size: 12px; color: var(--muted); }
.card-menu { color: var(--muted); }
.card-tags { margin: 20px 0; min-height: 27px; gap: 7px; }
.tag-pill { font-size: 12px; padding: 6px 9px; background: var(--panel); color: var(--accent); border-color: var(--line); }
.card-footer { border-color: var(--line); padding-top: 17px; gap: 10px; }
.card-preview { width: 38px; height: 38px; background: var(--input); border-color: var(--line); color: var(--accent); font-size: 13px; }
.card-preview.playing { background: var(--selected); color: var(--ink); }
.card-length { font-size: 14px; color: var(--muted); }
.card-status, .card-status.off { font-size: 12px; color: var(--muted); }
.import-status { font-size: 15px; color: var(--muted); }
.empty-state { background: var(--paper); }
.empty-state p { font-size: 15px; color: var(--muted); }
.pagination { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 20px; margin: 30px 0; color: var(--muted); font-size: 14px; }
.pagination-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; }
.pagination-summary label { display: flex; align-items: center; gap: 10px; }
.page-navigation, .page-numbers { display: flex; align-items: center; gap: 6px; }
.page-number { border: 1px solid var(--line); border-radius: 8px; height: 44px; min-width: 44px; padding: 0 9px; background: var(--paper); font-size: 15px; }
.page-number[aria-current="page"] { background: var(--selected); border-color: var(--green); color: var(--accent); font-weight: 700; }
.page-ellipsis { padding: 0 5px; }
footer { font-size: 12px; color: var(--muted); }
html { scrollbar-gutter: stable; }
html:has(dialog[open]) { overflow: hidden; }
dialog { background: var(--paper); color: var(--ink); width: min(1320px,calc(100vw - 48px)); max-height: calc(100dvh - 48px); overscroll-behavior: contain; }
body:has(#emoji-picker[open]) #editor { overflow: hidden; }
dialog::backdrop { background: #0c1519a0; }
.editor-heading { padding: 27px 32px; }
.editor-heading .eyebrow { font-size: 11px; }
.editor-heading h2 { font-size: 29px; }
.icon-button { width: 42px; height: 42px; background: var(--input); color: var(--muted); border-color: var(--line); }
.editor-body { grid-template-columns: 1.3fr 1fr; }
.editing-section { padding: 32px; background: var(--bg); }
.details-section { padding: 32px; }
.editor-file { gap: 16px; margin-bottom: 38px; }
.large-emoji { background: var(--warm); width: 58px; height: 58px; font-size: 30px; }
.editor-file strong { font-size: 18px; max-width: 290px; }
.editor-file small { font-size: 13px; max-width: 290px; color: var(--muted); }
.original-badge { font-size: 11px; padding: 8px; background: var(--panel); color: var(--accent); border-color: var(--line); }
.section-heading h3, .details-section>h3 { font-size: 18px; }
.duration-badge { font-size: 13px; background: var(--warm); color: var(--warm-ink); }
.field-hint { font-size: 13px; line-height: 1.7; color: var(--muted); }
.waveform-wrap { height: 184px; background: var(--wave-bg); border-color: var(--line); }
.trim-handle { width: 17px; font-size: 14px; background: #bd8249; }
.wave-ticks { font-size: 11px; color: var(--muted); }
.trim-fields { gap: 12px; flex-wrap: wrap; }
.trim-fields>label { width: 115px; font-size: 12px; color: var(--muted); }
.trim-fields label>div { background: var(--input); border-color: var(--line); }
.trim-fields input { font-size: 16px; padding: 12px; color: var(--ink); }
.trim-fields label span { font-size: 13px; color: var(--muted); }
.trim-fields .button { font-size: 13px; min-height: 44px; height: auto; width: auto; }
.volume-section { border-color: var(--line); margin-top: 30px; }
.volume-section output { color: var(--accent); font-size: 16px; }
.volume-control input { min-height: 22px; accent-color: var(--green); }
.range-labels { font-size: 11px; color: var(--muted); }
.safe-note { background: var(--panel); border-color: var(--line); padding: 17px; }
.safe-note p { font-size: 13px; color: var(--muted); }
.safe-note strong { color: var(--accent); }
.field-label { font-size: 15px; color: var(--ink); margin-top: 23px; }
.field-label>span { font-size: 13px; color: var(--muted); }
.text-input { min-height: 46px; font-size: 16px; padding: 12px; background: var(--input); color: var(--ink); border-color: var(--line); }
.text-input::placeholder { color: var(--muted); }
.emoji-field { align-items: stretch; }
.emoji-field>span { min-width: 52px; font-size: 27px; background: var(--panel); border-color: var(--line); }
#open-emoji-picker { flex: 1; justify-content: space-between; gap: 12px; text-align: left; white-space: normal; }
#open-emoji-picker span { font-size: 13px; }
.emoji-options { gap: 8px; }
.emoji-options button { width: 40px; height: 40px; font-size: 24px; background: var(--input); border-color: var(--line); }
.tag-editor { background: var(--input); border-color: var(--line); padding: 12px; }
.tag-editor>input { min-height: 34px; font-size: 14px; background: transparent; color: var(--ink); }
.tag-editor .tag-pill { font-size: 13px; }
.tag-pill button { min-width: 20px; min-height: 20px; font-size: 16px; color: var(--accent); }
.switch-field { padding-top: 23px; }
.switch-field strong { font-size: 15px; }
.switch-field small { font-size: 13px; color: var(--muted); }
.switch-track { width: 42px; height: 24px; background: var(--line); }
.switch-track:after { width: 18px; height: 18px; }
.switch-field input { width: 42px; height: 30px; }
.switch-field input:checked+.switch-track:after { transform: translateX(18px); }
.text-button { font-size: 13px; min-height: 34px; }
.danger { color: #bd7665; }
.editor-footer { padding: 23px 32px; }
.editor-footer>span { font-size: 13px; color: var(--muted); max-width: 380px; }
.editor-footer .button { font-size: 15px; padding: 13px 18px; }
.confirm-dialog { max-width: 520px; }
.confirm-dialog h2 { font-size: 25px; }
.confirm-dialog p { font-size: 15px; color: var(--muted); }
.toast { font-size: 15px; padding: 18px 24px; left: calc(50% + 100px); }
.upload-progress { background: var(--paper); border-color: var(--line); }
.upload-progress strong { font-size: 15px; }
.upload-progress p { font-size: 13px; color: var(--muted); }
#emoji-picker { max-width: 850px; }
.emoji-picker-body { padding: 24px 30px 30px; }
.emoji-tabs { display: flex; padding: 5px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; gap: 6px; }
.emoji-tabs button { border: 0; border-radius: 7px; padding: 12px 18px; background: none; color: var(--muted); flex: 1; }
.emoji-tabs button[aria-pressed="true"] { background: var(--selected); color: var(--accent); font-weight: 600; }
.emoji-filters { display: flex; gap: 12px; margin: 18px 0; }
.emoji-filters input { min-width: 0; flex: 1; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(50px,1fr)); gap: 8px; max-height: 310px; overflow: auto; overscroll-behavior: contain; padding: 4px; }
.emoji-choice { border: 1px solid var(--line); border-radius: 9px; min-height: 52px; background: var(--input); font-size: 29px; }
.emoji-choice:hover, .emoji-choice:focus-visible { background: var(--selected); border-color: var(--green); }
.standard-emoji { display: inline-block; width: 1em; height: 1em; flex: none; vertical-align: -.15em; background-image: url("/emoji-sprite.png"); background-size: 66.9375em 66.9375em; background-repeat: no-repeat; }
.emoji-choice, .emoji-options button { display: grid; place-items: center; }
.emoji-grid.server-grid { grid-template-columns: repeat(auto-fill,minmax(140px,1fr)); }
.server-grid .emoji-choice { font-size: 14px; padding: 12px; overflow-wrap: anywhere; }
.server-emoji-entry { display: flex; gap: 10px; }
.server-emoji-entry input { min-width: 0; }
.emoji-import { border-top: 1px solid var(--line); padding-top: 20px; margin-top: 20px; }
.emoji-import summary { cursor: pointer; font-size: 15px; color: var(--accent); }
.emoji-import textarea { resize: vertical; margin-bottom: 12px; }
.emoji-error { color: var(--warm-ink); background: var(--warm); border-radius: 8px; padding: 12px; font-size: 14px; line-height: 1.6; }
@media(min-width:1800px) { .sound-grid { grid-template-columns: repeat(4,minmax(0,1fr)); } }
@media(min-width:2400px) { .sound-grid { grid-template-columns: repeat(5,minmax(0,1fr)); } }
@media(max-width:1450px) {
  .overview { grid-template-columns: repeat(3,1fr); } .overview .overview-note { display: none; }
  .sound-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .page-heading { align-items: flex-start; flex-wrap: wrap; } h1 { font-size: 36px; }
  .toolbar-controls { width: 100%; } .search-box { flex: 1; } .search-box input { width: 100%; }
  .network-badge { display: none; }
}
@media(max-width:1100px) {
  .sidebar { width: 235px; padding: 28px 16px; } main { margin-left: 235px; }
  .brand { font-size: 17px; } .nav-item { font-size: 14px; }
  .topbar { padding: 0 28px; } .main-content { padding: 34px 28px 0; }
  .sound-card { padding: 20px; } .card-info h3 { font-size: 17px; }
  .editor-body { grid-template-columns: 1.1fr 1fr; } .editing-section, .details-section { padding: 25px; }
  .editor-file strong, .editor-file small { max-width: 190px; }
  .trim-fields .button { width: 100%; margin: 6px 0 0; }
}
@media(max-width:800px) {
  .sidebar { position: relative; width: 100%; padding: 18px 22px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { font-size: 20px; } .brand small { font-size: 10px; }
  .workspace,.nav-label,.tag-heading,.sidebar-tags,.sidebar-bottom { display: none; }
  .sidebar nav { display: flex; margin-top: 18px; gap: 6px; }
  .nav-item { flex: 1; width: auto; justify-content: center; font-size: 14px; padding: 12px 8px; gap: 6px; }
  .nav-item b { margin-left: 2px; } main { margin-left: 0; }
  .topbar { height: 76px; padding: 0 24px; font-size: 12px; }
  .theme-setting { font-size: 12px; } .topbar-settings { gap: 12px; }
  .main-content { padding: 30px 24px 0; } h1 { font-size: 34px; }
  .overview>div { padding: 18px 14px; gap: 10px; } .overview p { font-size: 12px; }
  .overview strong { font-size: 30px; } .metric-icon { width: 36px; height: 40px; font-size: 22px; }
  .format-note { display: none; } .drop-zone { padding: 22px; }
  .editor-body { display: block; } .editing-section { border-right: 0; border-bottom: 1px solid var(--line); }
  .editor-footer { gap: 18px; flex-wrap: wrap; } .editor-footer>span { max-width: none; }
  .editor-footer>div { margin-left: auto; } .toast { left: 50%; }
  .emoji-filters { flex-wrap: wrap; } .emoji-filters input { flex-basis: 100%; }
}
@media(max-width:500px) {
  .topbar { padding: 0 18px; } .theme-setting { gap: 6px; } .theme-setting select { max-width: 105px; }
  .topbar .breadcrumb, .crumb-divider { display: none; } .main-content { padding: 26px 18px 0; }
  h1 { font-size: 29px; } .eyebrow { font-size: 10px; } .page-heading p { font-size: 15px; }
  .overview>div { padding: 17px 10px; } .metric-icon { display: none; }
  .sound-grid { grid-template-columns: 1fr; gap: 16px; } .sound-card { min-height: 200px; }
  .sound-emoji { width: 50px; height: 50px; } .card-info h3 { font-size: 18px; }
  .toolbar-controls { flex-wrap: wrap; } .search-box { flex-basis: 100%; }
  .toolbar-controls select { max-width: none; } .search-box input { font-size: 15px; }
  .drop-zone p { font-size: 13px; } .drop-icon { flex-shrink: 0; }
  .pagination-summary { gap: 12px; } .page-navigation { flex-wrap: wrap; }
  .page-navigation>.button { font-size: 13px; padding: 10px; } .page-number { min-width: 37px; height: 40px; }
  .page-numbers { gap: 4px; } .editor-heading { padding: 20px; } .editor-heading h2 { font-size: 24px; }
  .editor-heading .eyebrow { font-size: 10px; } dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .editing-section,.details-section,.emoji-picker-body { padding: 22px; } .editor-footer { padding: 20px 22px; }
  .editor-footer .button { font-size: 14px; padding: 12px; }
  .emoji-tabs button { padding: 12px 10px; font-size: 14px; }
  .emoji-grid { grid-template-columns: repeat(auto-fill,minmax(45px,1fr)); }
  .server-emoji-entry { flex-wrap: wrap; } .network-badge { display: none; }
  footer { font-size: 11px; } .trim-fields .button { width: 100%; }
}
