/* Earth Kin - Space Jam — shared design system. Feature views add their own css/<view>.css using these tokens. */
:root {
  color-scheme: dark;
  /* Cosmic palette: deep space purple, magenta, sunrise orange, electric blue, plus a rainbow prism */
  --bg: #06030d; --bg2: #0c0718; --panel: #110a1f; --panel2: #191028; --raise: #231735; --line: #2b1e42; --line2: #3e2c5c;
  --text: #f6ecdf; --muted: #b29fc6; --dim: #78688e;
  --ochre: #ff9a3c; --ember: #ff5a7a; --red: #ff3d5a; --green: #3ee08f; --teal: #2fc6b5; --blue: #2ec5ff; --violet: #9b5cff;
  --magenta: #ff3d9a; --eblue: #2ec5ff; --gold: #ffe14d;
  --prism: linear-gradient(90deg, #ff3d5a, #ff9a3c, #ffe14d, #3ee08f, #2ec5ff, #9b5cff, #ff3d9a);
  --neon: linear-gradient(135deg, #ff9a3c, #ff3d9a);
  --accent: var(--ochre); --rec: #ff3b30; --meter-lo: #3fbf8f; --meter-mid: #ff9a3c; --meter-hi: #ff3b30;
  --r: 8px; --r2: 12px; --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --top-h: 58px; --tabs-h: 38px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 13px/1.4 var(--font); overflow: hidden; -webkit-font-smoothing: antialiased; }
button, select, input, textarea { font: inherit; color: inherit; }
::selection { background: #ff9a3c55; }
::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 6px; border: 2px solid var(--bg2); } ::-webkit-scrollbar-track { background: var(--bg2); }

/* ---------- controls ---------- */
.btn { background: var(--raise); border: 1px solid var(--line2); border-radius: var(--r); padding: 5px 10px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; transition: background .12s, border-color .12s; }
.btn:hover { background: #30303d; border-color: #4a4a5c; } .btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, #ffb05a, #ff3d9a); color: #1a0618; border-color: #ffb05a; font-weight: 600; }
.btn.danger { border-color: #8a3227; color: #ffb4a6; } .btn.ghost { background: transparent; border-color: transparent; } .btn.ghost:hover { background: var(--raise); }
.btn.on, .btn[aria-pressed="true"] { background: #2e1745; border-color: var(--ochre); color: var(--ochre); }
.btn.sm { padding: 2px 7px; font-size: 12px; } .btn.icon { padding: 5px 8px; min-width: 32px; justify-content: center; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.tog { width: 22px; height: 20px; border-radius: 5px; border: 1px solid var(--line2); background: var(--panel2); font-size: 11px; font-weight: 700; cursor: pointer; padding: 0; color: var(--muted); }
.tog.m.on { background: #3d6fd9; color: #fff; border-color: #3d6fd9; } .tog.s.on { background: #e8c547; color: #1b1300; border-color: #e8c547; } .tog.r.on { background: var(--rec); color: #fff; border-color: var(--rec); } .tog.i.on { background: var(--green); color: #00140d; border-color: var(--green); }
select, input[type=text], input[type=number], input[type=url], input[type=password], textarea { background: var(--bg2); border: 1px solid var(--line2); border-radius: 6px; padding: 4px 7px; }
textarea { width: 100%; resize: vertical; line-height: 1.45; }
input[type=range] { accent-color: var(--ochre); }
label.field { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .col { display: flex; flex-direction: column; gap: 8px; } .grow { flex: 1; min-width: 0; } .spacer { flex: 1; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .mono { font-family: var(--mono); } .small { font-size: 11px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r2); padding: 12px; }
.card h3, .panel-title { margin: 0 0 8px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ochre); font-weight: 700; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; background: var(--raise); border: 1px solid var(--line2); font-size: 11px; color: var(--muted); }
.pill.ok { color: var(--green); border-color: #2a6b52; } .pill.warn { color: var(--ochre); border-color: #7a5a24; } .pill.bad { color: #ff8a7a; border-color: #7a2f25; }
.note { background: #ff9a3c12; border: 1px solid #ff9a3c40; border-radius: var(--r); padding: 8px 10px; color: #e9d6b4; font-size: 12px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 10px 0; }
kbd { background: #0006; border: 1px solid var(--line2); border-radius: 4px; padding: 0 4px; font-size: 11px; font-family: var(--mono); }

/* knob */
.knob { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; width: 58px; user-select: none; touch-action: none; }
.knob .dial { width: 38px; height: 38px; border-radius: 50%; background: radial-gradient(circle at 50% 35%, #3a3a48, #17171e 70%); border: 1px solid #4a4a5c; position: relative; cursor: ns-resize; box-shadow: 0 2px 6px #0008, inset 0 1px 0 #ffffff14; }
.knob .dial::after { content: ""; position: absolute; left: 50%; top: 4px; width: 3px; height: 11px; margin-left: -1.5px; background: var(--ochre); border-radius: 2px; transform-origin: 50% 15px; transform: rotate(var(--rot, 0deg)); box-shadow: 0 0 6px #ff9a3c99; }
.knob .arc { position: absolute; inset: -4px; border-radius: 50%; background: conic-gradient(from 225deg, var(--ochre) var(--pct, 0%), transparent 0); -webkit-mask: radial-gradient(circle, transparent 60%, #000 61%); mask: radial-gradient(circle, transparent 60%, #000 61%); opacity: .55; pointer-events: none; }
.knob .lbl { font-size: 10px; color: var(--muted); text-align: center; line-height: 1.1; max-width: 62px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.knob .val { font-size: 10px; font-family: var(--mono); color: var(--text); }
.knob.learn .dial { outline: 2px dashed var(--ochre); }

/* ---------- header ---------- */
.top { height: var(--top-h); display: flex; align-items: center; gap: 14px; padding: 0 12px; background: linear-gradient(180deg, #14141b, #0d0d12); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.brand .logo { width: 38px; height: 38px; flex: none; border-radius: 8px; }
.brand h1.brand-wm { background: none; -webkit-background-clip: initial; background-clip: initial; color: inherit; line-height: 0; }
.brand h1.brand-wm img { height: 44px; width: auto; display: block; }
.start-overlay .start-logo { width: min(620px, 92vw); height: auto; border-radius: 14px; box-shadow: 0 20px 60px #000c, 0 0 80px #ff9a3c22; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.brand h1 { margin: 0; font-size: 15px; letter-spacing: .12em; text-transform: uppercase; font-weight: 800; white-space: nowrap; background: linear-gradient(90deg, var(--ochre), var(--ember)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand small { display: block; font-size: 10px; letter-spacing: .1em; color: var(--muted); -webkit-text-fill-color: var(--muted); font-weight: 600; }
.transport { display: flex; gap: 4px; }
.transport .btn { padding: 6px 9px; min-width: 34px; justify-content: center; }
.transport .play.on { background: #123a2a; border-color: var(--green); color: var(--green); }
.transport .rec.on { background: #4a0f0b; border-color: var(--rec); color: #ff6b62; animation: pulse 1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 3px #ff3b3033; } }
.lcd { display: flex; align-items: stretch; gap: 1px; background: #0a0f0c; border: 1px solid #22322a; border-radius: var(--r); overflow: hidden; font-family: var(--mono); }
.lcd > div { padding: 3px 10px; display: flex; flex-direction: column; justify-content: center; background: #0b1410; }
.lcd .big { font-size: 17px; color: #9ff0c9; letter-spacing: .04em; } .lcd .cap { font-size: 9px; color: #4f7d68; text-transform: uppercase; letter-spacing: .1em; }
.lcd input { background: transparent; border: 0; color: #9ff0c9; font: 17px var(--mono); width: 62px; padding: 0; }
.lcd select { background: transparent; border: 0; color: #9ff0c9; padding: 0; font-family: var(--mono); }
.hdr-right { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.meter-h { width: 90px; height: 8px; background: #111; border-radius: 3px; overflow: hidden; position: relative; }
.meter-h i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, var(--meter-lo) 70%, var(--meter-mid) 88%, var(--meter-hi)); }

.tabs { height: var(--tabs-h); display: flex; gap: 2px; padding: 0 8px; align-items: flex-end; background: var(--bg2); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { background: transparent; border: 1px solid transparent; border-bottom: 0; padding: 7px 12px; border-radius: 8px 8px 0 0; color: var(--muted); cursor: pointer; white-space: nowrap; font-weight: 600; font-size: 12px; }
.tabs button:hover { color: var(--text); } .tabs button.on { background: var(--panel); border-color: var(--line); color: var(--ochre); }
.tabs .ico { margin-right: 5px; }
.tabs { gap: 10px; }
.tab-groups { display: flex; gap: 2px; align-self: center; background: #0006; border: 1px solid var(--line); border-radius: 9px; padding: 2px; flex: none; }
.tabs .tab-group { border: 0; border-radius: 7px; padding: 5px 10px; color: var(--muted); }
.tabs .tab-group.on { background: linear-gradient(180deg, #ffb05a, #ff3d9a); color: #1a0618; border: 0; }
.tab-views { display: flex; gap: 2px; align-items: flex-end; align-self: stretch; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tab-views::-webkit-scrollbar { display: none; }
.tabs .tab-devices { margin-left: auto; flex: none; }
@media (max-width: 1100px) { .tab-group .tg-label { display: none; } .tabs .tab-group .ico { margin-right: 0; font-size: 15px; } }
@media (max-width: 600px) {
  .tab-devices .tg-label { display: none; }
  .tabs { flex-wrap: wrap; gap: 4px; padding: 4px 4px 0; height: auto; min-height: var(--tabs-h); }
  .tab-groups { flex: 1 1 auto; margin-right: 0; } .tabs .tab-group { flex: 1; padding: 6px 4px; }
  .tabs .tab-group .ico { font-size: 15px; margin: 0; }
  .tabs .tab-devices { margin-left: 0; align-self: center; padding: 6px 10px; border-radius: 8px; }
  .tab-views { flex: 1 0 100%; order: 3; } .tab-views > button { padding: 7px 9px; }
}

#views { position: absolute; top: var(--chrome-h, calc(var(--top-h) + var(--tabs-h))); left: 0; right: 0; bottom: 0; }
.view { position: absolute; inset: 0; display: none; overflow: auto; background: var(--panel); }
.view.on { display: block; }
.view.flexv.on { display: flex; flex-direction: column; overflow: hidden; }
.view.keep-live:not(.on) { display: flex; flex-direction: column; position: fixed; left: -30000px; top: 0; width: 1280px; height: 860px; pointer-events: none; }
.view-pad { padding: 14px; }
.view-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel2); }
.view-head h2 { margin: 0; font-size: 14px; letter-spacing: .06em; text-transform: uppercase; color: var(--ochre); }

/* dialogs & menus */
.modal-back { position: fixed; inset: 0; background: #000a; display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; padding: 18px; width: min(560px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px #000c; }
.modal h2 { margin: 0 0 10px; font-size: 16px; color: var(--ochre); }
.menu { position: fixed; z-index: 60; background: var(--panel2); border: 1px solid var(--line2); border-radius: 10px; padding: 5px; min-width: 220px; box-shadow: 0 12px 40px #000c; }
.menu button { display: flex; width: 100%; text-align: left; background: transparent; border: 0; padding: 7px 10px; border-radius: 6px; cursor: pointer; gap: 8px; }
.menu button:hover { background: var(--raise); } .menu .sep { height: 1px; background: var(--line); margin: 4px 0; } .menu .hint { margin-left: auto; color: var(--dim); font-size: 11px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1c1030; border: 1px solid var(--ochre); color: var(--text); padding: 9px 16px; border-radius: 10px; z-index: 99; box-shadow: 0 8px 30px #000a; transition: opacity .3s; max-width: 90vw; }
.toast.out { opacity: 0; }
.start-overlay { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 40%, #1e0d33, #050507 70%); }
.start-overlay .inner { text-align: center; max-width: 520px; padding: 20px; }
.start-overlay h1 { font-size: 34px; letter-spacing: .14em; margin: 14px 0 4px; text-transform: uppercase; background: linear-gradient(90deg, var(--ochre), var(--ember)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.start-overlay p { color: var(--muted); }

/* piano keyboard (play surface) */
.pkeys { position: relative; height: 70px; display: flex; user-select: none; touch-action: none; }
.pkeys .w { flex: 1; background: linear-gradient(180deg, #eee6d6, #d9cfbd); border: 1px solid #444; border-radius: 0 0 4px 4px; position: relative; cursor: pointer; }
.pkeys .w.on { background: var(--ochre); } .pkeys .b { position: absolute; top: 0; height: 60%; background: #111; border-radius: 0 0 3px 3px; z-index: 2; cursor: pointer; border: 1px solid #000; }
.pkeys .b.on { background: var(--ember); } .pkeys .w span { position: absolute; bottom: 3px; left: 3px; font-size: 9px; color: #6a604f; }

.avatar { display: inline-grid; place-items: center; border-radius: 50%; color: #1a0618; font-weight: 800; flex: none; box-shadow: inset 0 0 0 2px #0003; }
/* profile chip (top right): avatar + username */
#acct-slot { display: inline-flex; margin-left: 4px; }
.acct-btn { display: inline-flex; align-items: center; gap: 8px; padding: 3px 12px 3px 3px; border-radius: 99px; cursor: pointer; color: var(--text); font-weight: 600; font-size: 13px;
  background: linear-gradient(180deg, #24133b, #150b26); border: 1px solid #ff3d9a66; box-shadow: 0 0 10px #ff3d9a2a, inset 0 1px 0 #ffffff12; transition: border-color .15s, box-shadow .15s; }
.acct-btn:hover { border-color: var(--magenta); box-shadow: 0 0 16px #ff3d9a55; }
.acct-btn .avatar { box-shadow: 0 0 0 2px #ff9a3c, 0 0 8px #ff3d9a88; flex: none; }
.acct-btn .acct-ghost { width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 50%; background: #2a1a40; font-size: 15px; }
.acct-name { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1050px) { .acct-name { max-width: 90px; } }
@media (max-width: 600px) { .acct-name { display: none; } .acct-btn { padding: 2px; } }
.lcd .cap { white-space: nowrap; } .top { min-width: 0; } .brand { flex-shrink: 1; overflow: hidden; }
@media (max-width: 1480px) { .brand h1 { display: none; } }
@media (max-width: 1280px) { .lcd .big, .lcd input { font-size: 15px; } .lcd > div { padding: 3px 7px; } }
@media (max-width: 1050px) { .lcd > div:nth-child(2), .lcd > div:nth-child(4) { display: none; } .hdr-right .optional { display: none; } .top { gap: 8px; } }
@media (max-width: 760px) {
  :root { --top-h: 96px; }
  .top { flex-wrap: wrap; height: auto; min-height: var(--top-h); padding: 6px 10px; gap: 8px; }
  .brand h1 { font-size: 12px; } .hdr-right .optional { display: none; }
}

.tabs .tab-home { flex: none; border-radius: 8px; padding: 6px 10px; align-self: center; border: 1px solid var(--line); background: #0006; }
.tabs .tab-home.on { border-color: var(--ochre); color: var(--ochre); }
.tabs .tab-home { padding: 3px 5px; line-height: 0; }
.tabs .tab-home img { width: 30px; height: 30px; display: block; border-radius: 7px; filter: drop-shadow(0 0 4px #ff3d9a66); transition: transform .12s, filter .12s; }
.tabs .tab-home:hover img, .tabs .tab-home.on img { transform: scale(1.06); filter: drop-shadow(0 0 7px #ff9a3caa); }

/* ---------- Cosmic theme: starfield, sacred geometry, neon prism, dotted Country waves ---------- */
body { background: radial-gradient(ellipse 70% 50% at 12% 0%, #3b136155, transparent 70%), radial-gradient(ellipse 60% 50% at 95% 100%, #ff3d9a1c, transparent 70%), var(--bg); }
:root { --stars:
  radial-gradient(1px 1px at 20px 30px, #fff9, transparent), radial-gradient(1px 1px at 120px 80px, #fff7, transparent), radial-gradient(1.5px 1.5px at 210px 150px, #c9e9ffcc, transparent),
  radial-gradient(1px 1px at 330px 40px, #fff8, transparent), radial-gradient(1.5px 1.5px at 60px 210px, #ffd6f0bb, transparent), radial-gradient(1px 1px at 270px 260px, #fff6, transparent),
  radial-gradient(1px 1px at 380px 190px, #fff9, transparent), radial-gradient(2px 2px at 160px 300px, #ffffffaa, transparent); }
.stars { background-image: var(--stars); background-size: 400px 320px; }
.cosmic:not(.view) { position: relative; }
.cosmic { isolation: isolate; background-color: var(--bg); background-attachment: local;
  background-image: var(--stars), radial-gradient(ellipse 80% 50% at 50% 0%, #4a1a7a66, transparent 70%), radial-gradient(ellipse 50% 40% at 0% 100%, #ff9a3c14, transparent 70%), radial-gradient(ellipse 50% 40% at 100% 60%, #2ec5ff12, transparent 70%);
  background-size: 400px 320px, 400px 320px, 400px 320px, 400px 320px, 400px 320px, 400px 320px, 400px 320px, 400px 320px, 100% 100%, 100% 100%, 100% 100%; background-repeat: repeat, repeat, repeat, repeat, repeat, repeat, repeat, repeat, no-repeat, no-repeat, no-repeat; }
.cosmic::after { content: ""; position: absolute; z-index: -1; pointer-events: none; width: min(900px, 100%); aspect-ratio: 1; left: 50%; top: 40px; translate: -50% 0; background: url(../brand/sacred-geometry.svg) center / contain no-repeat; opacity: .09; animation: geo-spin 240s linear infinite; }
@keyframes geo-spin { to { rotate: 360deg; } }
@media (prefers-reduced-motion: reduce) { .cosmic::after { animation: none; } }
.dot-wave { height: 46px; background: url(../brand/dot-wave.svg) center / 100% 100% no-repeat; opacity: .9; }
.prism-line { height: 2px; background: var(--prism); box-shadow: 0 0 12px #ff3d9a66; }

/* header & tabs */
.top { position: relative; background: linear-gradient(180deg, #170c2c, #0b0617); border-bottom: 0; }
.top::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--prism); opacity: .85; box-shadow: 0 0 10px #9b5cff88; }
.brand h1.brand-wm img { height: 40px; filter: drop-shadow(0 0 8px #ff3d9a55); }
.tabs { background: linear-gradient(180deg, #0f0820, #0c0718); }
.tabs button.on { color: var(--ochre); box-shadow: inset 0 -2px 0 var(--magenta); }
.tabs .tab-group.on { background: var(--neon); color: #1a0618; box-shadow: 0 0 14px #ff3d9a55; }
.tabs .tab-home.on { border-color: var(--magenta); color: #fff; box-shadow: 0 0 10px #ff3d9a44; }
/* bigger category & view tabs (easier to read and tap) */
:root { --tabs-h: 48px; }
.tabs button { font-size: 14px; padding: 10px 15px; }
.tabs .ico { font-size: 16px; margin-right: 6px; }
.tab-groups { padding: 3px; border-radius: 11px; }
.tabs .tab-group { padding: 7px 14px; border-radius: 8px; }
@media (max-width: 1100px) { .tabs .tab-group { padding: 7px 11px; } .tabs .tab-group .ico { font-size: 18px; } }
@media (max-width: 600px) {
  .tabs .tab-group { padding: 8px 4px; } .tabs .tab-group .ico { font-size: 19px; }
  .tab-views > button { padding: 9px 12px; font-size: 13.5px; }
  .tabs .tab-devices { padding: 8px 12px; }
}
.lcd { background: #070a1a; border-color: #23305a; } .lcd > div { background: #0a0f24; }
.lcd .big, .lcd input, .lcd select { color: #8fe3ff; text-shadow: 0 0 8px #2ec5ff66; } .lcd .cap { color: #5f78b0; }

/* controls */
.btn { background: var(--raise); border-color: var(--line2); }
.btn:hover { background: #2e1f46; border-color: #5a3f86; }
.btn.primary { background: var(--neon); color: #1a0618; border-color: #ffb05a; box-shadow: 0 0 14px #ff3d9a44; }
.btn.primary:hover { filter: brightness(1.08); box-shadow: 0 0 20px #ff3d9a77; }
.btn.on, .btn[aria-pressed="true"] { background: #2e1745; border-color: var(--magenta); color: #ffb05a; box-shadow: 0 0 10px #ff3d9a33; }
.card { background: linear-gradient(180deg, #160d29ee, #100a1ded); border-color: var(--line); box-shadow: 0 1px 0 #ffffff08 inset; }
.card h3, .panel-title { color: var(--ochre); text-shadow: 0 0 10px #ff9a3c55; }
.view-head { background: linear-gradient(180deg, #1a1030, #150c26); }
.view-head h2 { background: var(--neon); -webkit-background-clip: text; background-clip: text; color: transparent; }
.knob .dial { background: radial-gradient(circle at 50% 35%, #3b2a58, #150d24 70%); border-color: #4f3a72; }
.knob .arc { background: conic-gradient(from 225deg, var(--ochre), var(--magenta) var(--pct, 0%), transparent 0); }
.modal { background: linear-gradient(180deg, #1a1030, #120a22); border-color: var(--line2); }
.modal h2 { color: var(--ochre); }
.menu { background: #1a1030; }
.toast { border-color: var(--magenta); box-shadow: 0 8px 30px #000a, 0 0 18px #ff3d9a44; }
input[type=range] { accent-color: var(--magenta); }
::selection { background: #ff3d9a55; }

/* start screen */
.start-overlay { background: radial-gradient(ellipse at 50% 45%, #2a0f4a, #06030d 75%); overflow: hidden; }
.start-overlay::before { content: ""; position: absolute; inset: -40px; background: url(../brand/cosmic-banner.webp) center / cover; filter: blur(24px) saturate(1.3) brightness(.6); opacity: .5; }
.start-overlay .inner { max-width: 800px; position: relative; }
.start-overlay .start-logo { width: min(760px, 94vw); border-radius: 0; box-shadow: none; filter: drop-shadow(0 0 30px #9b5cff66); }

/* ---------- Joining: Home create-profile card and profile setup step ---------- */
.join-card { display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; border-color: #5a3f86; box-shadow: 0 0 30px #9b5cff33; }
.join-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--prism); }
.join-card h3 { font-size: 15px; } .join-head p { margin: 0; }
.join-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.join-fields input { width: 100%; padding: 7px 9px; }
.home-welcome { gap: 12px; }
.onb { width: min(520px, 100%); }
.onb-steps { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.onb-steps span { padding: 2px 9px; border-radius: 99px; border: 1px solid var(--line2); color: var(--dim); }
.onb-steps .done { color: var(--green); border-color: #2a6b52; } .onb-steps .on { color: #1a0618; background: var(--neon); border-color: transparent; font-weight: 700; }
.onb-who { gap: 14px; margin-bottom: 10px; } .onb-avatar { filter: drop-shadow(0 0 12px #9b5cff88); }
.onb-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.onb-swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #0008; cursor: pointer; padding: 0; }
.onb-swatch.on { outline: 2px solid #fff; outline-offset: 2px; }
.onb input, .onb textarea { width: 100%; }
@media (max-width: 700px) { .join-fields { grid-template-columns: minmax(0, 1fr); } }

/* Header logo: the Earth Kin: Space Jam wordmark replaces the old EK icon, at every screen size, never cropped */
.brand .logo { display: none; }
.brand { flex-shrink: 0; overflow: visible; }
.brand h1.brand-wm { display: block !important; flex: none; }
.brand h1.brand-wm img { height: 44px; width: auto; max-width: none; object-fit: contain; }
@media (max-width: 1400px) { .brand h1.brand-wm img { height: 38px; } }
/* tablets and phones: the logo gets its own centred row so it is never squeezed */
@media (max-width: 1180px) {
  .top { flex-wrap: wrap; height: auto; min-height: var(--top-h); padding: 6px 10px; row-gap: 6px; }
  .brand { flex-basis: 100%; justify-content: center; }
  .brand h1.brand-wm img { height: 40px; }
}
@media (max-width: 760px) { .brand h1.brand-wm img { height: 36px; } }

/* Built-in instrument apps (Phoenix, Vibe) */
.app-wrap { flex: 1; min-height: 0; display: flex; background: #000; }
.app-frame { flex: 1; width: 100%; border: 0; display: block; background: #000; }
.app-head { gap: 8px; } .app-blurb { max-width: 520px; }
.rec-app.on { background: #4a0f0b; border-color: var(--rec); color: #ff6b62; animation: pulse 1s infinite; }
@media (max-width: 760px) { .app-blurb { display: none; } }
.view-head h2.app-logo { line-height: 0; background: none; -webkit-background-clip: initial; background-clip: initial; }
.view-head h2.app-logo img { height: 34px; width: auto; display: block; filter: drop-shadow(0 0 8px #ff3d9a55); }

/* Live Co-Design bar + chat */
.cd-bar { position: fixed; left: 12px; bottom: 12px; z-index: 70; display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-radius: 99px; background: linear-gradient(180deg, #24123fee, #160b2bee); border: 1px solid var(--magenta); box-shadow: 0 0 24px #ff3d9a55, 0 10px 30px #000a; max-width: calc(100vw - 24px); backdrop-filter: blur(8px); }
.cd-bar[hidden], .cd-chat[hidden] { display: none; }
.cd-dot { width: 9px; height: 9px; border-radius: 50%; background: #ff3d5a; box-shadow: 0 0 8px #ff3d5a; animation: pulse 1.4s infinite; flex: none; }
.cd-title { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-people { display: flex; } .cd-people .avatar { margin-left: -6px; box-shadow: 0 0 0 2px #160b2b; } .cd-people .avatar:first-child { margin-left: 0; }
.cd-chat { position: fixed; left: 12px; bottom: 62px; z-index: 70; width: min(340px, calc(100vw - 24px)); display: flex; flex-direction: column; gap: 8px; box-shadow: 0 12px 40px #000c, 0 0 20px #9b5cff44; }
.cd-msgs { max-height: 260px; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.cd-msg { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; } .cd-chat input { width: 100%; }
@media (max-width: 600px) { .cd-bar .small, .cd-title { display: none; } }
.avatar { position: relative; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-edit { display: flex; align-items: center; gap: 12px; }

/* Anything marked hidden stays hidden, even when a class gives it a display style (pills, fields, flex rows). */
[hidden] { display: none !important; }

/* Downloads & Play boxes (Home, Dashboard) and the start-screen game strip */
.dl-row h3 { margin: 4px 0 8px; }
.dl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 12px; }
.dl-box { padding: 0 !important; overflow: hidden; display: flex; flex-direction: column; border-color: #5a3f86; }
.dl-art { height: 120px; background: #120a22 50% 40% / cover no-repeat; display: flex; align-items: flex-end; padding: 10px; box-shadow: inset 0 -40px 40px -20px #06030dcc; }
.dl-art img { width: 56px; height: 56px; object-fit: contain; filter: drop-shadow(0 0 10px #000c); }
.dl-body { padding: 12px; gap: 8px; flex: 1; }
.dl-body .row { margin-top: auto; flex-wrap: wrap; gap: 8px; }
.dl-box a.btn, .dl-strip a.btn { color: inherit; text-decoration: none; }
.dl-strip { display: flex; align-items: center; gap: 10px; margin: 18px auto 0; max-width: 460px; padding: 8px 12px; border: 1px solid #5a3f86; border-radius: 12px; background: #120a22cc; text-align: left; flex-wrap: wrap; }
.dl-strip img { width: 40px; height: 40px; object-fit: contain; }

/* The time / BPM / key display is never squeezed: between ~1180 and 1500 px wide it used to shrink and cut off
   its own text (BEAT, TAP, SIG and KEY disappeared). Now the account buttons move to a second row instead. */
.lcd { flex-shrink: 0; max-width: 100%; }
.top { flex-wrap: wrap; height: auto; min-height: var(--top-h); row-gap: 6px; }

.start-overlay .start-getapp { font-size: 16px; padding: 10px 22px; margin: 10px 0 0 8px; }
.start-overlay .start-invite { color: #ffd9a8; font-weight: 600; margin-top: 12px; }
/* Box art shows the whole banner (titles included); the logo sits beside the name instead of over the art. */
.dl-art { height: auto !important; aspect-ratio: 2 / 1; background-position: center !important; background-size: cover !important; box-shadow: none !important; }
.dl-title { display: flex; align-items: center; gap: 10px; }
.dl-title img { width: 40px; height: 40px; border-radius: 9px; object-fit: contain; flex: none; }

/* Readouts that change many times a second keep a fixed width, so nothing beside them (your account box,
   the meters, the buttons) jiggles side to side as the numbers change. */
#lufs { display: inline-flex; justify-content: center; box-sizing: border-box; width: 14ch; flex: none; overflow: hidden; text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
#lcd-pos { display: inline-block; min-width: 10.5ch; font-variant-numeric: tabular-nums; white-space: nowrap; }
#lcd-time { display: inline-block; min-width: 11ch; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* screen reader */
.reader-panel { position: fixed; z-index: 400; width: min(340px, calc(100vw - 16px)); display: flex; flex-direction: column; gap: 8px; box-shadow: 0 12px 40px #000c; }
.reader-panel h3 { margin: 0; } .reader-panel select { width: 100%; } .reader-panel input[type=range] { width: 100%; }
.reader-panel .row { gap: 6px; }
.start-overlay .start-reader { margin-top: 8px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.knob:focus-visible .dial { outline: 2px solid var(--gold); outline-offset: 2px; }
/* count-in */
#t-countin[data-n]:not([data-n=""])::after { content: attr(data-n); font-size: 9px; margin-left: 1px; vertical-align: super; }
.countin { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; pointer-events: none; font: 900 min(40vw, 260px)/1 var(--font); color: #ffffffd0; text-shadow: 0 0 40px #ff3d9a, 0 0 90px #ff9a3c; background: radial-gradient(circle, #0008, transparent 60%); }
.countin.bar { color: #ffe14d; }
/* song templates */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; max-height: 60vh; overflow-y: auto; }
.tpl-card { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line2); background: linear-gradient(180deg, #221536, #150c24); color: var(--text); cursor: pointer; }
.tpl-card:hover, .tpl-card:focus-visible { border-color: var(--magenta); box-shadow: 0 0 14px #ff3d9a44; }
.tpl-ico { font-size: 22px; }
/* ---------- menu bar: drop-down categories (Audio · Video · Learning · Jam Spot · Sharing & Connecting) ---------- */
.tabs { align-items: center; gap: 8px; }
.tab-menus { display: flex; gap: 4px; align-items: center; flex: 1; min-width: 0; flex-wrap: wrap; padding: 3px 0; }
.tabs .tab-menu { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; background: #0006; color: var(--muted); font-size: 14px; font-weight: 600; box-shadow: none; line-height: 1.1; }
.tabs .tab-menu:hover, .tabs .tab-menu[aria-expanded="true"] { color: var(--text); border-color: #ff3d9a88; background: #1d1030; }
.tabs .tab-menu.on { background: var(--neon); color: #1a0618; border-color: transparent; box-shadow: 0 0 14px #ff3d9a55; }
.tab-menu .tm-text { display: flex; flex-direction: column; align-items: flex-start; }
.tab-menu .tm-short { display: none; }
.tab-menu .tm-cur { font-size: 11px; font-weight: 700; opacity: .85; }
.tab-menu .tm-caret { font-size: 11px; opacity: .8; }
.tab-dd { position: fixed; z-index: 450; min-width: 230px; max-width: calc(100vw - 12px); max-height: calc(100vh - 140px); overflow-y: auto; padding: 6px; border-radius: 12px;
  background: linear-gradient(180deg, #1d1030, #120a20); border: 1px solid #ff3d9a66; box-shadow: 0 16px 40px #000c, 0 0 20px #ff3d9a33; }
.tab-dd-sec { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 8px 10px 4px; }
.tab-dd-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font-size: 14px; font-weight: 600; cursor: pointer; }
.tab-dd-item .ico { width: 20px; text-align: center; font-size: 16px; }
.tab-dd-item:hover, .tab-dd-item:focus-visible { background: #2e1745; outline: none; }
.tab-dd-item.on { background: var(--neon); color: #1a0618; }
@media (max-width: 1100px) { .tabs .tab-menu { padding: 6px 9px; font-size: 13px; } }
@media (max-width: 760px) {
  .tab-menu .tm-label { display: none; } .tab-menu .tm-short { display: inline; }
  .tabs { flex-wrap: nowrap; } .tab-menus { gap: 3px; }
}
@media (max-width: 600px) {
  .tabs { padding: 4px; } .tabs .tab-menu { padding: 6px 7px; gap: 4px; font-size: 12.5px; } .tab-menu .tm-cur { display: none; }
  .tabs .tab-devices { padding: 6px 8px; }
}

/* ---------- Master stereo bar (bottom of every screen) ---------- */
#views { bottom: var(--mbar-h, 0px); }
.toast { bottom: calc(var(--mbar-h, 0px) + 18px); } .cd-bar { bottom: calc(var(--mbar-h, 0px) + 12px); }
.master-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 5px 10px; min-height: 44px;
  background: linear-gradient(180deg, #170c2c, #0b0617); border-top: 1px solid #3a2560; box-shadow: 0 -6px 20px #0008; }
.master-bar::before { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 1px; background: var(--prism); opacity: .8; }
.master-bar .mb-title { font-size: 11px; letter-spacing: .14em; background: var(--neon); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mb-main, .mb-more { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mb-more { flex: 1; min-width: 0; }
.master-bar .knob { transform: scale(.78); margin: -8px -6px; }
.mb-fader { width: 150px; accent-color: #ff9a3c; }
.mb-db { min-width: 7.5ch; text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }
.mb-lufs { min-width: 9.5ch; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mb-meters { display: flex; flex-direction: column; gap: 2px; }
.mb-meter { width: 120px; height: 6px; border-radius: 2px; }
.mb-clip { font: 700 9px var(--mono); padding: 2px 4px; border-radius: 3px; background: #2a1020; color: #6b4a5a; cursor: pointer; letter-spacing: .05em; }
.mb-clip.on { background: #ff3b30; color: #fff; box-shadow: 0 0 8px #ff3b30; }
.mb-tog.on { background: #2a1840; border-color: #ff9a3c; color: #ffd9a8; }
.mb-sep { width: 1px; height: 22px; background: #3a2560; }
.mb-len, .mb-preset { max-width: 210px; }
.mb-fold { margin-left: auto; }
.master-bar.min .mb-more, .master-bar.min .mb-lufs { display: none; }
.master-bar.muted .mb-title { color: #ff6b62; -webkit-text-fill-color: #ff6b62; }
@media (max-width: 760px) {
  .master-bar { gap: 6px; padding: 4px 8px; } .mb-fader { width: 110px; } .mb-meter { width: 70px; }
  .mb-more { gap: 6px; } .mb-sep { display: none; } .mb-preset { max-width: 100%; }
}
/* Mix & Master panel (Arrange) and Jam Spot mix card */
.mix-panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 10px; padding: 8px; }
.mp-col { display: flex; flex-direction: column; gap: 8px; }
.mp-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.mp-chips .btn.on { border-color: #ff9a3c; background: #2a1840; }
.master-tools { display: flex; flex-direction: column; gap: 6px; align-items: center; } .master-tools select { max-width: 100%; }
.jam-mix .field { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; } .jam-mix select { width: 100%; }
.jam-panrow { gap: 6px; align-items: center; color: var(--muted); } .jam-pan { flex: 1; min-width: 0; }
/* VST plugin setup */
.modal.wide { max-width: min(760px, 96vw); }
.vst-wiz { gap: 8px; } .vst-step { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px !important; }
.vst-step .row { flex-wrap: wrap; gap: 6px; } .vst-step input[type=text] { flex: 1; min-width: 200px; } .vst-step select { max-width: 100%; }
.vst-hosts { margin: 2px 0 0 16px; } .vst-hosts a { color: var(--ochre); }
/* phones: the header's right-hand buttons wrap instead of pushing the page sideways */
@media (max-width: 760px) { .hdr-right { flex-wrap: wrap; justify-content: flex-end; max-width: 100%; min-width: 0; row-gap: 4px; } }

/* timeline comments (js/comments.js) */
.cmt-pop { position: fixed; z-index: 70; width: min(330px, calc(100vw - 16px)); background: #1a1030; border: 1px solid #ff5fd266; border-radius: 12px; padding: 10px; box-shadow: 0 14px 44px #000d; display: flex; flex-direction: column; gap: 8px; }
.cmt-pop textarea { width: 100%; resize: vertical; min-height: 64px; }
.cmt-msg { background: var(--raise); border-radius: 8px; padding: 6px 8px; } .cmt-msg.reply { margin-left: 14px; background: var(--panel2); }
.cmt-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.cmt-list { display: flex; flex-direction: column; gap: 6px; padding: 8px 12px; overflow: auto; height: 100%; }
.cmt-row { display: flex; align-items: center; gap: 8px; text-align: left; background: var(--panel2); border: 1px solid var(--line); border-left: 3px solid #ff5fd2; border-radius: 8px; padding: 6px 10px; color: inherit; cursor: pointer; font: inherit; }
.cmt-row:hover { border-color: var(--line2); } .cmt-row.done { opacity: .55; border-left-color: #6d6a78; }
.cmt-bar { color: #ff9be6; white-space: nowrap; font-size: 11px; } .cmt-snip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jam-tile .seat-art video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; background: #000; }
.jam-tile .seat-art video.mirror { transform: scaleX(-1); }
