/* ============================================================
   EDH Matcher — design system v2
   ============================================================ */

:root{
  --bg: #0b0c10;
  --bg-elevated: #111319;
  --panel: #15171f;
  --panel-2: #1b1e28;
  --line: #262a36;
  --line-soft: #1e212b;
  --text: #edecea;
  --text-dim: #b7b5ae;
  --muted: #82868f;
  --brand: #d4a84e;
  --brand-hover: #e6bd66;
  --brand-ink: #191203;
  --green: #46b980;
  --green-ink: #0a1f14;
  --red: #e0645d;
  --red-ink: #2a0f0d;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 6px 20px rgba(0,0,0,.35);
  --shadow-lg: 0 16px 40px rgba(0,0,0,.45);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Iowan Old Style", "Source Serif Pro", Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Consolas, monospace;
}

html[data-theme="light"]{
  --bg: #f6f5f2;
  --bg-elevated: #ffffff;
  --panel: #ffffff;
  --panel-2: #f1efe9;
  --line: #e2ded3;
  --line-soft: #ebe8e0;
  --text: #201e19;
  --text-dim: #4b473e;
  --muted: #79746a;
  --brand: #9c7420;
  --brand-hover: #7d5c18;
  --brand-ink: #ffffff;
  --green: #227a50;
  --green-ink: #ffffff;
  --red: #a6362f;
  --red-ink: #ffffff;
  --shadow-sm: 0 1px 2px rgba(30,25,10,.06);
  --shadow-md: 0 6px 20px rgba(30,25,10,.08);
  --shadow-lg: 0 16px 40px rgba(30,25,10,.1);
}

*{box-sizing:border-box;}
html{color-scheme: dark;}
html[data-theme="light"]{color-scheme: light;}

body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family: var(--font-sans);
  font-size:14.5px;
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
  overflow-x:hidden;
}

img{max-width:100%;}

/* ---------- app shell: rail lateral fixa + conteúdo ---------- */
.app-shell{display:flex; min-height:100vh;}

.rail{
  width:216px;
  flex-shrink:0;
  background:var(--panel);
  border-right:1px solid var(--line);
  display:flex;
  flex-direction:column;
  padding:24px 14px;
  position:sticky;
  top:0;
  height:100vh;
}

.brand{
  display:flex;
  align-items:center;
  gap:9px;
  font-family: var(--font-display);
  font-size:17px;
  font-weight:600;
  color:var(--text);
  letter-spacing:.2px;
  padding:0 8px;
  margin-bottom:30px;
}
.brand .brand-mark{
  width:26px; height:26px;
  border-radius:7px;
  background:linear-gradient(145deg, var(--brand), #8a6423);
  display:flex; align-items:center; justify-content:center;
  font-size:13px;
  color:#fff;
  box-shadow: var(--shadow-sm);
  flex-shrink:0;
}

.rail-nav{display:flex; flex-direction:column; gap:2px; flex:1;}
.rail-nav a{
  display:flex; align-items:center; gap:10px;
  color:var(--muted);
  font-size:13.5px;
  font-weight:600;
  padding:10px 12px;
  border-radius:8px;
  transition: background .12s ease, color .12s ease;
}
.rail-nav a .ico{font-size:14px; width:16px; text-align:center; opacity:.85;}
.rail-nav a:hover{background:var(--panel-2); color:var(--text);}
.rail-nav a.active{background:var(--panel-2); color:var(--text); box-shadow: inset 3px 0 0 var(--brand);}

.theme-toggle-rail{
  background:transparent;
  border:1px solid var(--line);
  color:var(--muted);
  border-radius:8px;
  padding:9px 12px;
  font-size:12.5px;
  font-weight:600;
  cursor:pointer;
  display:flex; align-items:center; gap:8px;
  justify-content:flex-start;
  width:100%;
}
.theme-toggle-rail:hover{border-color:var(--brand); color:var(--brand); filter:none;}

.main{flex:1; min-width:0;}
.wrap{max-width:1080px; margin:0; padding:34px 40px 60px;}

@media (max-width: 900px){
  .app-shell{flex-direction:column;}
  .rail{
    width:100%; height:auto; position:relative;
    flex-direction:row; align-items:center; gap:16px;
    padding:14px 18px;
  }
  .brand{margin-bottom:0;}
  .rail-nav{flex-direction:row;}
  .theme-toggle-rail{width:auto;}
  .wrap{padding:24px 18px 40px;}
}

/* ---------- typography ---------- */
h1{
  font-family: var(--font-display);
  font-size:25px;
  font-weight:600;
  margin:0 0 6px 0;
  letter-spacing:.2px;
}
h2{
  font-size:11.5px;
  text-transform:uppercase;
  letter-spacing:1.2px;
  color:var(--muted);
  margin:0 0 14px 0;
  font-weight:700;
}
.page-subtitle{color:var(--text-dim); font-size:13.5px; margin:0 0 22px 0; line-height:1.6;}
.hint{color:var(--muted); font-size:12.5px; line-height:1.65;}

a{color:var(--brand); text-decoration:none;}
a:hover{color:var(--brand-hover);}

/* ---------- panels & layout ---------- */
.panel{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s ease, border-color .15s ease;
}
.layout{
  display:grid;
  grid-template-columns: 330px 1fr;
  gap:20px;
  align-items:start;
}
@media (max-width: 860px){ .layout{grid-template-columns:1fr;} }

/* ---------- sidebar / commander list ---------- */
.commander-list{display:flex; flex-direction:column; gap:5px; max-height:68vh; overflow-y:auto; margin-right:-4px; padding-right:4px;}
.commander-list::-webkit-scrollbar{width:6px;}
.commander-list::-webkit-scrollbar-thumb{background:var(--line); border-radius:3px;}

.commander-item{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
  padding:9px 12px;
  border-radius:8px;
  color:var(--text);
  font-size:13px;
  font-weight:500;
  background:transparent;
  border:1px solid transparent;
  transition: background .12s ease, border-color .12s ease;
}
.commander-item:hover{background:var(--panel-2); border-color:var(--line);}
.commander-item.active{background:var(--panel-2); border-color:var(--brand);}
.badge{font-size:11px; color:var(--muted); font-weight:600; font-family:var(--font-mono);}

/* ---------- deck cards ---------- */
.deck-card{
  background:var(--panel-2);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:18px 20px;
  margin-bottom:16px;
}
.deck-card-head{display:flex; justify-content:space-between; align-items:center;}
.deck-name{font-size:14.5px; font-weight:700; letter-spacing:.1px;}
.pct{font-size:20px; font-weight:700; font-family:var(--font-mono);}
.bar-track{height:5px; border-radius:3px; background:var(--line); margin:12px 0 10px; overflow:hidden;}
.bar-fill{height:100%; border-radius:3px; transition: width .3s ease;}
.missing-list{columns:2; font-size:12.5px; color:var(--red); margin-top:8px;}
.empty-state{color:var(--muted); text-align:center; padding:60px 16px; font-size:13.5px; line-height:1.7;}

/* ---------- buttons ---------- */
button, .btn, .btn-outline, .btn-danger{
  font-family:inherit;
  background:var(--brand);
  color:var(--brand-ink);
  border:none;
  border-radius:var(--radius-sm);
  padding:9px 16px;
  font-size:13px;
  font-weight:700;
  cursor:pointer;
  transition: filter .12s ease, transform .1s ease, box-shadow .12s ease;
  display:inline-flex; align-items:center; gap:6px;
  text-decoration:none;
}
button:hover, .btn:hover{filter:brightness(1.08); text-decoration:none;}
button:active, .btn:active{transform:scale(.98);}
button:disabled{opacity:.5; cursor:not-allowed;}

button.secondary, .btn-outline{
  background:transparent;
  border:1px solid var(--line);
  color:var(--text);
}
button.secondary:hover, .btn-outline:hover{border-color:var(--brand); color:var(--brand); filter:none;}

button.danger, .btn-danger{
  background:transparent;
  border:1px solid var(--red);
  color:var(--red);
}
button.danger:hover, .btn-danger:hover{background:var(--red); color:var(--red-ink); filter:none;}

/* ---------- forms ---------- */
input[type=text], input[type=file], textarea, select{
  font-family:inherit;
  width:100%;
  background:var(--bg-elevated);
  border:1px solid var(--line);
  border-radius:var(--radius-sm);
  color:var(--text);
  padding:9px 11px;
  font-size:13px;
}
input[type=text]:focus, textarea:focus, select:focus{
  outline:none; border-color:var(--brand);
}
label{font-size:11.5px; color:var(--muted); display:block; margin-bottom:5px; font-weight:600;}

code{background:var(--panel-2); padding:1px 6px; border-radius:4px; font-size:12px; border:1px solid var(--line); font-family:var(--font-mono);}
details summary{cursor:pointer; color:var(--brand); font-size:13px; margin-top:8px; font-weight:600;}

/* ---------- misc shared ---------- */
.divider{border-top:1px solid var(--line-soft); margin:18px 0;}
.stat-strip{display:flex; gap:20px; flex-wrap:wrap; margin-bottom:22px;}
.stat-strip .stat{background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); padding:12px 16px; box-shadow:var(--shadow-sm); transition:transform .15s ease, box-shadow .15s ease;}
.stat-strip .stat:hover{transform:translateY(-2px); box-shadow:var(--shadow-md);}
.stat-strip .stat .num{font-family:var(--font-mono); font-size:19px; font-weight:700; color:var(--text);}
.stat-strip .stat .lbl{font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:.6px; margin-top:2px;}

/* ---------- detail view hierarchy ---------- */
.summary-card{
  background:var(--panel);
  border:1px solid var(--line);
  border-left:3px solid var(--brand);
  border-radius:var(--radius);
  padding:18px 20px;
  margin-bottom:20px;
}
.deck-toolbar{
  display:flex; flex-wrap:wrap; gap:18px; align-items:center;
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:12px 16px;
  margin-bottom:22px;
  position:sticky; top:12px; z-index:10;
}
.deck-toolbar .field{display:flex; align-items:center; gap:7px;}
.deck-toolbar label{margin:0; font-size:11px; white-space:nowrap;}
.deck-toolbar select{width:auto; padding:6px 9px; font-size:12px;}
.section-title{
  font-size:12px; text-transform:uppercase; letter-spacing:1px; color:var(--muted);
  font-weight:700; margin:26px 0 12px; display:flex; align-items:center; gap:10px;
}
.section-title::after{content:''; flex:1; height:1px; background:var(--line-soft);}

.commander-hero{width:190px; border-radius:var(--radius); border:1px solid var(--line); box-shadow:var(--shadow-md); flex-shrink:0;}
@media (max-width: 560px){
  .commander-hero{width:120px;}
}
