/* Snapberry — phone app styles (palette A: raspberry & plum) */
:root {
  --plum: #231A2B;
  --plum-2: #3A2C44;
  --berry: #D6306C;
  --berry-dark: #B2255A;
  --blush: #FDEEF3;
  --mist: #FBF8FC;
  --line: #ECE6EE;
  --line-2: #E6DFE8;
  --muted: #8A7F92;
  --text-2: #5E5466;
  --ok: #4ADE80;
  --warn: #F59E0B;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--mist); color: var(--plum); font-family: 'Outfit', system-ui, sans-serif; font-size: 16px; }
body { min-height: 100vh; }
a { color: var(--berry-dark); text-decoration: none; }
button { font: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -0.03em; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* brand */
.brand, .logo-link { display: flex; align-items: center; gap: 8px; }
.brand svg, .logo-link svg { width: 28px; height: 28px; display: block; }
.brand span, .logo-link span { font-size: 20px; font-weight: 700; letter-spacing: -0.03em; color: var(--plum); }

/* auth */
body.auth { display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 24px; padding: 28px 24px 20px; display: flex; flex-direction: column; gap: 14px; border: 1px solid var(--line); }
.auth-card h1 { font-size: 28px; margin-top: 8px; }
.auth-card p { margin: 0; }

/* forms */
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--text-2); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=time], select {
  font: inherit; font-size: 16px; padding: 13px 14px; border: 1.5px solid var(--line-2); border-radius: 14px; background: #fff; color: var(--plum); width: 100%;
}
input:focus, select:focus { outline: none; border-color: var(--berry); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1 1 0; min-width: 0; }
.error { color: var(--berry-dark); font-size: 14px; min-height: 1.2em; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 20px; border-radius: 999px; border: 1.5px solid var(--plum); background: #fff; color: var(--plum); font-weight: 600; font-size: 16px; cursor: pointer; min-height: 48px; }
.btn.primary { background: var(--berry); border-color: var(--berry); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.danger { border-color: transparent; background: transparent; color: var(--berry-dark); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.block { width: 100%; }

/* app shell */
.topbar { position: sticky; top: 0; z-index: 5; background: #fff; border-bottom: 1px solid var(--line); padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 12px; }
.topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 999px; border: 1.5px solid var(--line-2); background: #fff; color: var(--text-2); font-size: 14px; font-weight: 600; cursor: pointer; min-height: 40px; }
.chip.active { background: var(--plum); border-color: var(--plum); color: #fff; }
.chip .dot { width: 7px; height: 7px; border-radius: 999px; background: var(--muted); }
.chip .dot.on { background: var(--ok); }
.chip.add { border-style: dashed; color: var(--berry-dark); }

main.app { padding: 18px 16px 120px; display: flex; flex-direction: column; gap: 12px; max-width: 560px; margin: 0 auto; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; }
.section-head h2 { font-size: 22px; }

/* playlist rows */
.item { display: flex; align-items: center; gap: 12px; padding: 12px; background: #fff; border-radius: 16px; border: 1.5px solid var(--line); cursor: pointer; }
.item.off { opacity: 0.5; }
.thumb { width: 64px; height: 40px; border-radius: 8px; background: var(--plum-2); flex: 0 0 auto; overflow: hidden; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-meta { font-size: 12px; color: var(--muted); }
.order { display: flex; flex-direction: column; gap: 2px; }
.order button { width: 36px; height: 24px; border: none; background: transparent; color: var(--muted); font-size: 14px; cursor: pointer; border-radius: 6px; }
.order button:disabled { opacity: 0.25; }

.empty { padding: 36px 20px; text-align: center; color: var(--text-2); background: #fff; border-radius: 20px; border: 1.5px dashed var(--line-2); line-height: 1.5; }
.empty b { color: var(--plum); }

/* bottom bar */
.bottombar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--mist); padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.bottombar-inner { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tool { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; background: #fff; border: 1.5px solid var(--line-2); border-radius: 14px; font-size: 12px; font-weight: 600; color: var(--plum); cursor: pointer; min-height: 64px; }
.tool.primary { background: var(--berry); border-color: var(--berry); color: #fff; }
.tool:disabled { opacity: 0.45; cursor: default; }
.tool svg { width: 20px; height: 20px; }

/* sheets */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(35,26,43,0.45); display: none; z-index: 20; }
.sheet-backdrop.show { display: block; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-radius: 24px 24px 0 0; padding: 12px 20px calc(24px + env(safe-area-inset-bottom)); display: none; z-index: 21; max-height: 88vh; overflow-y: auto; max-width: 560px; margin: 0 auto; }
.sheet.show { display: block; }
.sheet .grab { width: 40px; height: 4px; border-radius: 999px; background: var(--line-2); margin: 0 auto 16px; }
.sheet h2 { font-size: 22px; margin-bottom: 14px; }
.sheet .stack { gap: 14px; }
.sheet .actions { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }

/* library grid */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tile { aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--plum-2); position: relative; cursor: pointer; border: none; padding: 0; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .tag { position: absolute; left: 6px; bottom: 6px; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #fff; background: rgba(0,0,0,0.5); padding: 3px 6px; border-radius: 6px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%); background: var(--plum); color: #fff; padding: 12px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; display: none; z-index: 30; max-width: 90vw; text-align: center; }
.toast.show { display: block; }

/* progress */
.progress { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--berry); transition: width 200ms; }
