/* ===== Media Tracker — clean, modern theme (mobile-first, same UI on web) ===== */
:root{
  /* DARK (default) */
  --bg:#0f1116; --surface:#171a21; --surface-2:#1f232d; --line:#272c37;
  --text:#eef0f5; --muted:#98a1b2; --faint:#5c6472;
  --accent:#e0a54b; --accent-ink:#1a1206; --link:#5aa0ea;
  --own:#3fbf7f; --miss:#e0655a;
  --radius:18px; --radius-sm:12px; --radius-lg:26px;
  --shadow:0 8px 30px rgba(0,0,0,.28); --shadow-sm:0 2px 10px rgba(0,0,0,.22);
  --rail:#0a0c10;                 /* backdrop behind the app column on wide screens */
  --nav-bg:rgba(23,26,33,.82);
}
:root[data-theme="light"]{
  /* LIGHT — Claude Desktop cream, TARDIS-blue accent */
  --bg:#FAF9F5; --surface:#FFFFFF; --surface-2:#F1EFE8; --line:#E7E4DA;
  --text:#1F1E1D; --muted:#71706A; --faint:#A6A49B;
  --accent:#003B6F; --accent-ink:#FFFFFF; --link:#1565A8;
  --own:#2E9E63; --miss:#C6483E;
  --shadow:0 8px 30px rgba(31,30,29,.08); --shadow-sm:0 2px 10px rgba(31,30,29,.06);
  --rail:#EEECE3;
  --nav-bg:rgba(255,255,255,.82);
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  background:var(--rail); color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Inter,Arial,sans-serif;
  -webkit-font-smoothing:antialiased; text-rendering:optimizeLegibility;
  min-height:100dvh;
}
a{color:inherit;text-decoration:none;-webkit-tap-highlight-color:transparent}
button{font-family:inherit}

/* ===== App column — one clean phone-width layout, centered on desktop ===== */
#app{
  max-width:480px; margin:0 auto; min-height:100dvh;
  background:var(--bg); position:relative;
  padding-bottom:96px;
}
@media(min-width:520px){
  body{background:var(--rail)}
  #app{
    margin:24px auto; min-height:calc(100dvh - 48px);
    border:1px solid var(--line); border-radius:28px; overflow:hidden;
    box-shadow:0 24px 60px rgba(0,0,0,.28);
  }
  :root[data-theme="light"] #app{box-shadow:0 24px 60px rgba(31,30,29,.12)}
}

/* ===== Hero ===== */
.hero{
  position:relative; padding:64px 22px 30px;
  background:
    radial-gradient(140% 80% at 85% -10%, color-mix(in srgb,var(--accent) 26%, transparent), transparent 60%),
    linear-gradient(180deg,var(--surface-2),var(--bg) 92%);
  border-bottom:1px solid var(--line);
}
.hero h1{margin:0;font-size:clamp(34px,9vw,44px);line-height:1;font-weight:800;letter-spacing:-1px}
.hero p{margin:12px 0 0;color:var(--muted);font-size:14.5px;line-height:1.5;max-width:30ch}
.iconbtn{
  position:absolute;top:22px;right:22px;width:42px;height:42px;border-radius:50%;
  background:var(--surface);border:1px solid var(--line);color:var(--text);
  display:grid;place-items:center;box-shadow:var(--shadow-sm);cursor:pointer;
  transition:transform .15s ease, background .15s ease;
}
.iconbtn:active{transform:scale(.94)}
.iconbtn svg{width:19px;height:19px}

/* ===== Module list ===== */
.modules{padding:18px 16px 6px;display:flex;flex-direction:column;gap:12px}
.module{
  display:flex;align-items:center;gap:14px;padding:15px 16px;border-radius:var(--radius);
  background:var(--surface);border:1px solid var(--line);box-shadow:var(--shadow-sm);
  transition:transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.module:active{transform:scale(.985)}
@media(hover:hover){.module:hover{box-shadow:var(--shadow);border-color:color-mix(in srgb,var(--accent) 40%,var(--line))}}
.module .tile{
  width:46px;height:46px;border-radius:14px;display:grid;place-items:center;
  color:#fff;font-weight:800;font-size:18px;flex:0 0 auto;box-shadow:var(--shadow-sm);
}
.module .tile svg{width:24px;height:24px}
.module .name{font-size:18px;font-weight:650;letter-spacing:-.2px;flex:1}
.module .count{color:var(--faint);font-size:13px;font-weight:600;margin-right:2px}
.module .chev{color:var(--faint);display:grid;place-items:center}
.module .chev svg{width:18px;height:18px}
.empty{
  color:var(--muted);text-align:center;padding:34px 22px;font-size:14px;line-height:1.6;
  background:var(--surface);border:1px dashed var(--line);border-radius:var(--radius);margin:6px 0;
}

/* ===== Section header ===== */
.head{padding:26px 20px 8px;display:flex;align-items:flex-end;justify-content:space-between;gap:12px}
.head h2{margin:0;font-size:26px;font-weight:800;letter-spacing:-.6px}
.head .back{color:var(--link);font-size:14px;font-weight:600;display:inline-flex;align-items:center;gap:4px}

/* ===== Item grid ===== */
.grid{padding:14px 16px 24px;display:grid;grid-template-columns:repeat(2,1fr);gap:14px}
@media(min-width:400px){.grid{grid-template-columns:repeat(3,1fr)}}
.card{
  background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-sm);
  overflow:hidden;display:flex;flex-direction:column;box-shadow:var(--shadow-sm);
  transition:transform .15s ease, box-shadow .15s ease;
}
.card:active{transform:scale(.97)}
@media(hover:hover){.card:hover{box-shadow:var(--shadow);transform:translateY(-2px)}}
.cover{
  aspect-ratio:2/3;display:grid;place-items:center;padding:12px;text-align:center;position:relative;
  background:linear-gradient(155deg,var(--surface-2),var(--surface));
}
.cover .ph{font-size:13px;line-height:1.3;color:var(--text);font-weight:700;letter-spacing:-.2px}
.cover .yr{position:absolute;bottom:8px;right:9px;font-size:10px;color:var(--faint);font-weight:600}
.badge{
  position:absolute;top:8px;left:8px;font-size:9.5px;font-weight:800;letter-spacing:.4px;
  padding:4px 8px;border-radius:20px;backdrop-filter:blur(6px);
}
.badge.own{background:color-mix(in srgb,var(--own) 90%,transparent);color:#04140b}
.badge.want{background:color-mix(in srgb,var(--accent) 92%,transparent);color:var(--accent-ink)}
.card .meta{padding:10px 11px 12px}
.card .t{font-size:13px;font-weight:700;line-height:1.25;letter-spacing:-.2px}
.card .s{font-size:11px;color:var(--muted);margin-top:3px}

/* ===== Item detail ===== */
.detail{padding:6px 20px 20px}
.detail .big{display:flex;gap:18px;align-items:flex-start}
.detail .big .cover{width:118px;flex:0 0 118px;border-radius:var(--radius-sm);border:1px solid var(--line)}
.detail h2{margin:2px 0 6px;font-size:23px;font-weight:800;letter-spacing:-.5px;line-height:1.1}
.detail .sub{color:var(--muted);font-size:13px;line-height:1.5}
.row{display:flex;gap:9px;flex-wrap:wrap;margin-top:18px}
.toggle{
  padding:10px 15px;border-radius:22px;border:1px solid var(--line);background:var(--surface);
  color:var(--text);font-size:13px;font-weight:650;cursor:pointer;
  transition:transform .12s ease, background .15s ease, border-color .15s ease;
}
.toggle:active{transform:scale(.95)}
.toggle.on{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.toggle.own.on{background:var(--own);color:#04140b;border-color:var(--own)}
.note{color:var(--faint);font-size:12px;margin-top:20px}

/* ===== Stats ===== */
.statgrid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;padding:8px 16px}
.stat{
  background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-sm);
  padding:18px 12px;text-align:center;box-shadow:var(--shadow-sm);
}
.stat .n{font-size:30px;font-weight:800;letter-spacing:-1px;line-height:1}
.stat .l{font-size:10.5px;color:var(--muted);margin-top:6px;text-transform:uppercase;letter-spacing:.6px;font-weight:700}

/* ===== Profile / panels ===== */
.panelbox{
  margin:16px;padding:6px 18px;background:var(--surface);border:1px solid var(--line);
  border-radius:var(--radius);box-shadow:var(--shadow-sm);
}
.field{display:flex;align-items:center;justify-content:space-between;padding:15px 0;border-bottom:1px solid var(--line);font-size:14px}
.field:last-child{border-bottom:0}
.field span{color:var(--muted)}
.switch{display:inline-flex;gap:4px;background:var(--surface-2);border:1px solid var(--line);border-radius:22px;padding:4px}
.switch button{
  border:0;background:transparent;color:var(--muted);font-size:12.5px;font-weight:700;
  padding:7px 15px;border-radius:18px;cursor:pointer;transition:background .15s ease,color .15s ease;
}
.switch button.on{background:var(--accent);color:var(--accent-ink)}

/* ===== Bottom tab bar (frosted, matches app width) ===== */
#tabbar{
  position:fixed;left:50%;transform:translateX(-50%);bottom:0;
  width:100%;max-width:480px;height:66px;display:flex;align-items:center;justify-content:space-around;
  background:var(--nav-bg);backdrop-filter:saturate(160%) blur(18px);-webkit-backdrop-filter:saturate(160%) blur(18px);
  border-top:1px solid var(--line);padding-bottom:env(safe-area-inset-bottom);z-index:20;
}
@media(min-width:520px){
  #tabbar{bottom:24px;border:1px solid var(--line);border-radius:0 0 28px 28px}
}
#tabbar a{
  display:flex;flex-direction:column;align-items:center;gap:3px;color:var(--faint);
  font-size:10px;font-weight:650;flex:1;padding:9px 0;transition:color .15s ease;
}
#tabbar a.active{color:var(--accent)}
#tabbar a svg{width:22px;height:22px}
#tabbar a.add{flex:0 0 auto}
#tabbar .fab{
  width:52px;height:52px;border-radius:50%;background:var(--accent);color:var(--accent-ink);
  display:grid;place-items:center;margin-top:-20px;box-shadow:0 8px 22px color-mix(in srgb,var(--accent) 45%,transparent);
  transition:transform .15s ease;
}
#tabbar .fab svg{width:26px;height:26px}
#tabbar a.add:active .fab{transform:scale(.92)}
