:root {
  --bg: #fafafa; --card: #fff; --text: #1a1a1a; --muted: #777;
  --border: #e8e8e8; --accent: #2563eb; --hover: #f4f4f4;
  --radius: 10px; --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111; --card: #1a1a1a; --text: #eee; --muted: #888; --border: #333; --hover: #252525; }
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; -webkit-font-smoothing: antialiased; }
#app { max-width: 880px; margin: 0 auto; padding: 20px 16px 60px; }

/* ── Breadcrumb ── */
#breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; color: var(--muted); margin-bottom: 24px; min-height: 22px; flex-wrap: wrap; }
#breadcrumb a { color: var(--accent); text-decoration: none; }
#breadcrumb a:hover { text-decoration: underline; }
#breadcrumb .sep { color: var(--muted); user-select: none; }

/* ── Search ── */
.search-bar { width: 100%; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 1rem; margin-bottom: 28px; background: var(--card); color: var(--text); outline: none; font-family: var(--font); }
.search-bar:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.search-bar.hidden { display: none; }

/* ── Deck grid ── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.deck-tile { display: block; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; text-decoration: none; color: var(--text); cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.deck-tile:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.deck-tile .tile-name { font-weight: 600; font-size: 1rem; }
.deck-tile .tile-count { color: var(--muted); font-size: 0.83rem; margin-top: 4px; }
.deck-tile .tile-sub { color: var(--muted); font-size: 0.78rem; margin-top: 2px; }

/* ── Cards ── */
.deck-header { margin-bottom: 20px; }
.deck-header h1 { font-size: 1.5rem; font-weight: 700; }
.deck-header .meta { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }

.expand-bar { margin-bottom: 16px; display: flex; gap: 8px; }
.expand-bar button { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 16px; cursor: pointer; font-size: 0.83rem; color: var(--text); font-family: var(--font); }
.expand-bar button:hover { background: var(--hover); }

.card-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; }
.card-q { padding: 16px 20px; cursor: pointer; user-select: none; display: flex; justify-content: space-between; align-items: flex-start; }
.card-q:hover { background: var(--hover); }
.card-q .q-num { color: var(--muted); font-size: 0.75rem; margin-right: 10px; flex-shrink: 0; min-width: 22px; }
.card-q .q-text { flex: 1; }
.card-q .arrow { font-size: 0.75rem; color: var(--muted); margin-left: 12px; flex-shrink: 0; transition: transform 0.2s; }
.card-q.open .arrow { transform: rotate(90deg); }

.card-a { display: none; padding: 0 20px 18px 52px; color: var(--text); border-top: 1px solid var(--border); }
.card-a.open { display: block; }
.card-a img { max-width: 100%; height: auto; border-radius: 6px; margin: 8px 0; }
.card-a table { border-collapse: collapse; width: 100%; margin: 8px 0; font-size: 0.9rem; }
.card-a td, .card-a th { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.card-a ul, .card-a ol { padding-left: 20px; margin: 6px 0; }
.card-a strong { color: var(--accent); }

.no-results { text-align: center; color: var(--muted); padding: 48px 20px; display: none; }

/* ── Footer ── */
footer { text-align: center; color: var(--muted); font-size: 0.78rem; padding: 20px 0; }
