/* Metashare Tracker: the redesigned look, the settings panel and the
   optional extras. Everything for the new look is scoped to
   html[data-look="new"], so turning "New look" off in settings leaves
   css/style.css exactly as it was. */

/* ---- Settings panel (shared across the mazzen.dev sites) ---- */
.mz-gear {
  position: fixed; z-index: 900; top: var(--mz-gear-top, calc(12px + env(safe-area-inset-top))); right: var(--mz-gear-right, 12px);
  bottom: var(--mz-gear-bottom, auto);
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; padding: 0;
  color: var(--mz-fg); background: var(--mz-bg); border: 1px solid var(--mz-line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 6px 20px -8px rgba(0,0,0,.35);
  transition: transform .2s ease, border-color .2s;
}
.mz-gear:hover { transform: rotate(45deg); border-color: var(--mz-accent); }
.mz-prefs, .mz-gear { --mz-bg: rgba(255,255,255,.82); --mz-card: #ffffff; --mz-fg: #15171c; --mz-muted: #6b7180; --mz-line: rgba(20,20,30,.12); --mz-accent: #5b6cff; }
@media (prefers-color-scheme: dark) {
  .mz-prefs, .mz-gear { --mz-bg: rgba(20,22,30,.78); --mz-card: #12141b; --mz-fg: #eef0f6; --mz-muted: #8d93a3; --mz-line: rgba(255,255,255,.12); }
}
.mz-prefs[hidden] { display: none; }
.mz-prefs { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif; }
.mz-prefs-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: mz-fade .2s ease; }
.mz-prefs-card {
  position: relative; width: min(440px, 100%); max-height: calc(100% - 24px); overflow: auto; color: var(--mz-fg);
  background: var(--mz-card); border: 1px solid var(--mz-line); border-radius: 22px; padding: 18px 18px 12px;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.6); animation: mz-in .3s cubic-bezier(.2,1.2,.3,1);
}
@media (max-width: 520px) {
  .mz-prefs { align-items: flex-end; padding: 0; }
  .mz-prefs-card { width: 100%; border-radius: 22px 22px 0 0; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
}
.mz-prefs-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.mz-prefs-head b { font-size: 1.15rem; letter-spacing: -0.01em; }
.mz-prefs-x { width: 34px; height: 34px; border-radius: 10px; border: 0; cursor: pointer; font-size: 1.3rem; line-height: 1; color: var(--mz-fg); background: var(--mz-line); padding: 0; }
.mz-prefs-sec { margin: 14px 0 2px; font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--mz-muted); }
.mz-prefs-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-top: 1px solid var(--mz-line); cursor: pointer; margin: 0; }
.mz-prefs-sec + .mz-prefs-row { border-top: 0; }
.mz-prefs-row > span { display: flex; flex-direction: column; min-width: 0; }
.mz-prefs-row b { font-size: .95rem; font-weight: 600; }
.mz-prefs-row small { color: var(--mz-muted); font-size: .8rem; line-height: 1.35; margin-top: 2px; }
.mz-prefs-foot { color: var(--mz-muted); font-size: .75rem; margin: 10px 0 4px; text-align: center; }
.mz-switch {
  appearance: none; -webkit-appearance: none; flex: none; width: 46px; height: 28px; border-radius: 99px; margin: 0; cursor: pointer;
  background: var(--mz-line); position: relative; transition: background .25s; border: 0;
}
.mz-switch::before { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.3); transition: transform .3s cubic-bezier(.3,1.5,.5,1); }
.mz-switch:checked { background: var(--mz-accent); }
.mz-switch:checked::before { transform: translateX(18px); }
.mz-switch:focus-visible { outline: 2px solid var(--mz-accent); outline-offset: 2px; }
@keyframes mz-fade { from { opacity: 0; } }
@keyframes mz-in { from { opacity: 0; transform: translateY(20px) scale(.97); } }

/* ---------- new look ---------- */
html[data-look="new"] {
  --accent: #6d4aff;
  --accent-wash: rgba(109, 74, 255, 0.12);
  --radius: 16px;
  --mana: linear-gradient(100deg, #e9c46a, #3a86ff 30%, #8f5cff 52%, #ef476f 74%, #06d6a0);
}
@media (prefers-color-scheme: dark) {
  html[data-look="new"]:not([data-theme="light"]) { --accent: #8b6dff; --accent-wash: rgba(139, 109, 255, 0.16); --bg: #08080c; --surface: #121219; --surface-2: #1b1b24; --border: #24242f; --border-strong: #33333f; }
}
html[data-look="new"][data-theme="dark"] { --accent: #8b6dff; --accent-wash: rgba(139, 109, 255, 0.16); --bg: #08080c; --surface: #121219; --surface-2: #1b1b24; --border: #24242f; --border-strong: #33333f; }

html[data-look="new"] body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(600px 380px at 0% -5%, rgba(58, 134, 255, .14), transparent 70%),
    radial-gradient(600px 380px at 100% 0%, rgba(239, 71, 111, .12), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  padding-bottom: 96px;
}
html[data-look="new"] .app-header { padding: 26px 18px 10px; max-width: 900px; margin: 0 auto; padding-right: 64px; }
html[data-look="new"] .app-header h1 {
  font-size: clamp(1.7rem, 6vw, 2.3rem); font-weight: 800; letter-spacing: -0.035em;
  background: var(--mana); -webkit-background-clip: text; background-clip: text; color: transparent;
}
html[data-look="new"] .app-header .subtitle a { text-decoration: none; color: var(--text-secondary); font-weight: 600; }
html[data-look="new"] .app-header .title-row h1 { color: var(--text); background: none; -webkit-text-fill-color: currentColor; }
html[data-look="new"] .app-main { padding: 8px 18px 28px; }

/* nav: floating pill with icons on phones, tabs on wide screens */
html[data-look="new"] .app-nav {
  left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); padding: 6px; border-radius: 20px;
  border: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: 0 16px 40px -16px rgba(0, 0, 0, .55);
}
html[data-look="new"] .nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 4px; border-radius: 14px;
  font-size: .7rem; font-weight: 600; transition: color .2s, background .2s;
}
html[data-look="new"] .nav-item::before {
  content: ""; width: 22px; height: 22px; background: currentColor;
  -webkit-mask: var(--ic) center / contain no-repeat; mask: var(--ic) center / contain no-repeat;
}
html[data-look="new"] .nav-item:nth-child(1) { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 3v18h18'/%3E%3Cpath d='M7 15l4-5 3 3 5-7'/%3E%3C/svg%3E"); }
html[data-look="new"] .nav-item:nth-child(2) { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='5'/%3E%3Cpath d='M12 8v8M8 12h8'/%3E%3C/svg%3E"); }
html[data-look="new"] .nav-item:nth-child(3) { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9H4.5a2.5 2.5 0 0 1 0-5H6M18 9h1.5a2.5 2.5 0 0 0 0-5H18M4 22h16M10 14.7V17c0 .6-.5 1-1 1.2C7.9 18.8 7 20.2 7 22M14 14.7V17c0 .6.5 1 1 1.2 1.1.5 2 2 2 3.8M18 2H6v7a6 6 0 0 0 12 0V2z'/%3E%3C/svg%3E"); }
html[data-look="new"] .nav-item:nth-child(4) { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M2 21v-1a6 6 0 0 1 12 0v1M16 3.1a4 4 0 0 1 0 7.8M22 21v-1a6 6 0 0 0-4-5.6'/%3E%3C/svg%3E"); }
html[data-look="new"] .nav-item.active { color: #fff; background: linear-gradient(135deg, var(--accent), #c04cff); box-shadow: 0 8px 20px -8px var(--accent); }
@media (min-width: 768px) {
  html[data-look="new"] body { padding-bottom: 0; }
  html[data-look="new"] .app-nav { position: sticky; top: 10px; max-width: 900px; margin: 4px auto 6px; left: auto; right: auto; bottom: auto; border-bottom: 1px solid var(--border); justify-content: flex-start; }
  html[data-look="new"] .nav-item { flex: 0 0 auto; flex-direction: row; gap: 8px; font-size: .88rem; padding: 9px 16px; }
  html[data-look="new"] .nav-item::before { width: 18px; height: 18px; }
}

/* cards, tiles, buttons */
html[data-look="new"] .card { border-radius: var(--radius); padding: 18px; box-shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 20px 40px -32px rgba(0,0,0,.6); }
html[data-look="new"] .card + .card { margin-top: 14px; }
html[data-look="new"] .card h2 { font-size: 1.08rem; letter-spacing: -0.01em; }
html[data-look="new"] .stat-grid { gap: 12px; margin-bottom: 14px; }
html[data-look="new"] .stat-tile { border-radius: var(--radius); padding: 14px 16px; position: relative; overflow: hidden; }
html[data-look="new"] .stat-tile::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--mana); opacity: .85; }
html[data-look="new"] .stat-tile .label { text-transform: uppercase; letter-spacing: .08em; font-size: .68rem; font-weight: 700; color: var(--text-muted); }
html[data-look="new"] .stat-tile .value { font-size: 1.85rem; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
html[data-look="new"] button:not(.chip):not(.icon-btn):not(.secondary):not(.remove-btn):not(.mz-prefs-x):not(.mz-gear),
html[data-look="new"] .btn:not(.secondary) {
  background: linear-gradient(135deg, var(--accent), #c04cff); border-radius: 12px; font-weight: 700; box-shadow: 0 10px 24px -12px var(--accent);
  transition: transform .12s, filter .2s;
}
html[data-look="new"] .combo-list button { background: none !important; box-shadow: none !important; font-weight: 400 !important; border-radius: 0 !important; }
html[data-look="new"] .combo-list button:hover, html[data-look="new"] .combo-list button.hl { background: var(--accent-wash) !important; }
html[data-look="new"] button:active, html[data-look="new"] .btn:active { transform: scale(.97); }
html[data-look="new"] .btn { display: inline-block; text-decoration: none; padding: 12px 20px; }
html[data-look="new"] input[type="text"], html[data-look="new"] input[type="date"], html[data-look="new"] input[type="number"], html[data-look="new"] input[type="url"], html[data-look="new"] select {
  border-radius: 12px; padding: 11px 12px; transition: border-color .2s, box-shadow .2s;
}
html[data-look="new"] input:focus, html[data-look="new"] select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
html[data-look="new"] .chip { padding: 7px 14px; font-weight: 600; transition: all .2s; }
html[data-look="new"] .chip.active { background: var(--text); border-color: var(--text); color: var(--bg); }

/* metashare rows: ranked cards with a deck-coloured bar */
html[data-look="new"] #deckList { counter-reset: rank; }
html[data-look="new"] .deck-row { gap: 14px; padding: 12px 8px; margin: 0 -8px; border-radius: 12px; border-bottom-color: transparent; transition: background .15s; }
html[data-look="new"] .deck-row + .deck-row { border-top: 1px solid var(--border); border-radius: 0; }
html[data-look="new"] .deck-row:hover { background: var(--surface-2); border-radius: 12px; }
html[data-look="new"] #deckList .deck-row::before {
  counter-increment: rank; content: counter(rank); width: 22px; text-align: center; font-weight: 800; font-size: .85rem; color: var(--text-muted); font-variant-numeric: tabular-nums; flex-shrink: 0;
}
html[data-look="new"] #deckList .deck-row:nth-child(1)::before { color: #e9b949; }
html[data-look="new"] #deckList .deck-row:nth-child(2)::before { color: #a8b2bd; }
html[data-look="new"] #deckList .deck-row:nth-child(3)::before { color: #cd8a5a; }
html[data-look="new"] .deck-thumb { width: 50px; height: 50px; border-radius: 14px; box-shadow: 0 8px 18px -10px rgba(0,0,0,.7), inset 0 0 0 1px rgba(255,255,255,.12); font-size: 1.05rem; }
html[data-look="new"] .deck-row-name { font-size: .98rem; }
html[data-look="new"] .bar-track { height: 7px; border-radius: 99px; }
html[data-look="new"] .bar-fill { border-radius: 99px; background: linear-gradient(90deg, var(--accent), #c04cff); }
html[data-look="new"] .deck-row-pct { font-size: 1.1rem; font-weight: 800; letter-spacing: -0.02em; }
html[data-look="new"] .deck-banner { height: 170px; border-radius: 20px; position: relative; overflow: hidden; box-shadow: 0 20px 40px -24px rgba(0,0,0,.8); }
html[data-look="new"] .deck-banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.65), transparent 60%); }
html[data-look="new"] .deck-banner h1 { position: relative; z-index: 1; font-size: 1.7rem; letter-spacing: -0.03em; }
html[data-look="new"] .avatar { background: linear-gradient(135deg, var(--accent), #c04cff); color: #fff; }
html[data-look="new"] th { font-size: .68rem; letter-spacing: .08em; }
html[data-look="new"] tr.clickable:hover td { background: var(--surface-2); }
html[data-look="new"] .toast { background: linear-gradient(135deg, var(--accent), #c04cff); color: #fff; font-weight: 600; bottom: 100px; box-shadow: 0 12px 30px -10px var(--accent); }
@media (min-width: 768px) { html[data-look="new"] .toast { bottom: 24px; } }
html[data-look="new"] .card, html[data-look="new"] .stat-tile { animation: mtg-rise .45s cubic-bezier(.2,.9,.3,1) both; }
@keyframes mtg-rise { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) { html[data-look="new"] .card, html[data-look="new"] .stat-tile { animation: none; } }

/* ---------- extras (off unless switched on) ---------- */
.x-search, .x-donut, .x-export, .x-trend { display: none !important; }
html[data-f-search] .x-search { display: flex !important; }
html[data-f-donut] .x-donut { display: flex !important; }
html[data-f-export] .x-export { display: inline-flex !important; }
html[data-f-trends] .x-trend { display: inline-block !important; }
.x-search { align-items: center; gap: 8px; margin: 0 0 10px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface-2); }
.x-search input[type="search"] { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; padding: 10px 0; outline: none; box-shadow: none; }
.x-search svg { color: var(--text-muted); flex: none; }
.x-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.x-head h2 { margin: 0 !important; }
.x-export { align-items: center; gap: 6px; font-size: .78rem !important; padding: 6px 12px !important; border-radius: 999px !important; background: var(--surface-2) !important; color: var(--text) !important; border: 1px solid var(--border-strong) !important; box-shadow: none !important; font-weight: 600; }
.x-donut { align-items: center; gap: 18px; flex-wrap: wrap; justify-content: center; margin: 2px 0 14px; }
.x-donut svg { width: 150px; height: 150px; flex: none; }
.x-donut .seg { transition: opacity .2s; cursor: pointer; }
.x-donut .legend { display: grid; gap: 6px; font-size: .84rem; min-width: 170px; }
.x-donut .legend div { display: flex; align-items: center; gap: 8px; }
.x-donut .legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.x-donut .legend span { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 700; padding-left: 10px; }
.x-trend { font-size: .72rem; font-weight: 700; margin-left: 6px; font-variant-numeric: tabular-nums; vertical-align: 1px; }
.x-trend.up { color: var(--good); } .x-trend.down { color: var(--critical); } .x-trend.flat, .x-trend.new { color: var(--text-muted); }
html[data-f-compact] .deck-row { padding-top: 6px; padding-bottom: 6px; gap: 10px; }
html[data-f-compact] .deck-thumb { width: 32px; height: 32px; font-size: .78rem; border-radius: 8px; }
html[data-f-compact] .deck-row-sub { display: none; }
html[data-f-compact] .bar-track { margin-top: 4px; height: 5px; }
html[data-f-compact] td, html[data-f-compact] th { padding-top: 5px; padding-bottom: 5px; }
html[data-f-compact] .pilot-row { padding: 4px 0; }
html[data-f-compact] .card { padding: 12px; }
html[data-f-compact] .stat-tile { padding: 9px 12px; }
html[data-f-compact] .stat-tile .value { font-size: 1.3rem; }
.x-none { color: var(--text-muted); font-size: .86rem; padding: 10px 0; }
