/* ── Theme Variables ── */
:root {
    --bg-dark: #0f0f0f;
    --card-bg: #1a1a1a;
    --card-border: rgba(255,255,255,0.08);
    --card-hover-glow: rgba(139,92,246,0.25);
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --nav-bg: rgba(15,15,15,0.95);
    --nav-border: rgba(255,255,255,0.06);
    --gradient-purple: linear-gradient(135deg, #a855f7 0%, #6366f1 100%);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.5);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; background: var(--bg-dark); color: var(--text-primary); line-height: 1.6; min-height: 100vh; }
h1,h2,h3,h4,h5,h6 { font-family: 'Space Grotesk', -apple-system, sans-serif; font-weight: 600; line-height: 1.3; }
a { color: inherit; text-decoration: none; transition: color 0.2s ease; }
a:hover { color: #a78bfa; }
.container { max-width: 1280px; margin: 0 auto; padding: 0 1rem; }

/* ── Nav ── */
.nav { position: fixed; top: 0; left: 0; right: 0; background: var(--nav-bg); border-bottom: 1px solid var(--nav-border); z-index: 1000; height: 64px; display: flex; align-items: center; }
.nav-content { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.nav-logo { font-family: 'Space Grotesk', sans-serif; font-size: 1.5rem; font-weight: 700; background: var(--gradient-purple); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; display: flex; align-items: center; gap: 0.6rem; }
.nav-logo::before { content: ''; display: block; width: 32px; height: 32px; background: url('/img/sv-logo.svg') no-repeat center / contain; flex-shrink: 0; }
.nav-links { display: flex; gap: 2rem; list-style: none; }
.nav-links a { font-size: 0.9rem; font-weight: 500; color: var(--text-secondary); }
.nav-links a:hover, .nav-links a.active { color: var(--text-primary); }
.mobile-menu-btn { display: none; background: none; border: none; color: var(--text-primary); font-size: 1.5rem; cursor: pointer; }
@media (max-width: 768px) {
    .nav-links { display: none; position: absolute; top: 64px; left: 0; right: 0; background: var(--nav-bg); border-bottom: 1px solid var(--nav-border); flex-direction: column; padding: 1rem; gap: 0; }
    .nav-links.active { display: flex; }
    .nav-links a { padding: 0.75rem 1rem; display: block; border-bottom: 1px solid var(--card-border); }
    .nav-links a:last-child { border-bottom: none; }
    .mobile-menu-btn { display: block; }
}

/* ── Main Layout ── */
main { padding-top: 96px; padding-bottom: 3rem; min-height: calc(100vh - 180px); }

.breadcrumb { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1.5rem; }
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: #a78bfa; }
.breadcrumb span { margin: 0 0.4rem; }

.page-title { font-size: 2rem; margin-bottom: 0.5rem; background: var(--gradient-purple); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.page-subtitle { color: var(--text-secondary); margin-bottom: 2rem; font-size: 1rem; }

/* ── Input Panel ── */
.input-panel { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 12px; padding: 1.5rem; margin-bottom: 2rem; box-shadow: var(--shadow-md); }
.input-panel label { display: block; font-weight: 600; margin-bottom: 0.5rem; font-size: 0.95rem; }
.deck-textarea { width: 100%; min-height: 180px; background: #111; border: 1px solid var(--card-border); border-radius: 8px; color: var(--text-primary); font-family: 'Inter', monospace; font-size: 0.9rem; padding: 1rem; resize: vertical; transition: border-color 0.2s; }
.deck-textarea:focus { outline: none; border-color: #a855f7; }
.deck-textarea::placeholder { color: var(--text-muted); }

.controls-row { display: flex; align-items: center; gap: 1.5rem; margin-top: 1rem; flex-wrap: wrap; }

.currency-toggle { display: flex; background: #111; border: 1px solid var(--card-border); border-radius: 8px; overflow: hidden; }
.currency-toggle input[type="radio"] { display: none; }
.currency-toggle label { padding: 0.5rem 1.25rem; cursor: pointer; font-size: 0.9rem; font-weight: 500; color: var(--text-secondary); transition: background-color 0.2s, color 0.2s; user-select: none; }
.currency-toggle input[type="radio"]:checked + label { background: var(--gradient-purple); color: #fff; }

.check-btn { padding: 0.6rem 2rem; background: var(--gradient-purple); color: #fff; border: none; border-radius: 8px; font-family: 'Space Grotesk', sans-serif; font-size: 1rem; font-weight: 600; cursor: pointer; transition: opacity 0.2s, transform 0.1s; }
.check-btn:hover { opacity: 0.9; }
.check-btn:active { transform: scale(0.98); }
.check-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Progress ── */
.progress-wrap { margin-top: 1rem; display: none; }
.progress-wrap.visible { display: block; }
.progress-bar-outer { width: 100%; height: 6px; background: #222; border-radius: 3px; overflow: hidden; }
.progress-bar-inner { height: 100%; width: 0%; background: var(--gradient-purple); border-radius: 3px; transition: width 0.3s; }
.progress-text { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.4rem; }

/* ── Results ── */
#results { display: none; }
#results.visible { display: block; }

/* ── Summary Cards ── */
.summary-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 2rem; }
.summary-card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 12px; padding: 1.25rem; text-align: center; box-shadow: var(--shadow-sm); }
.summary-card .label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.25rem; }
.summary-card .value { font-family: 'Space Grotesk', sans-serif; font-size: 1.75rem; font-weight: 700; background: var(--gradient-purple); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.summary-card .sub { font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.25rem; }

@media (max-width: 600px) {
    .summary-cards { grid-template-columns: 1fr; }
}

/* ── Top 5 ── */
.section-title { font-size: 1.25rem; margin-bottom: 1rem; }
.top5-panel { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 12px; padding: 1.25rem; margin-bottom: 2rem; box-shadow: var(--shadow-sm); }
.top5-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0; border-bottom: 1px solid var(--card-border); }
.top5-item:last-child { border-bottom: none; }
.top5-rank { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 1rem; color: var(--text-muted); min-width: 1.5rem; text-align: center; }
.top5-name { flex: 1; font-weight: 500; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top5-bar-wrap { flex: 0 0 120px; height: 8px; background: #222; border-radius: 4px; overflow: hidden; }
.top5-bar { height: 100%; background: var(--gradient-purple); border-radius: 4px; min-width: 4px; }
.top5-price { font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 0.95rem; min-width: 70px; text-align: right; }

@media (max-width: 600px) {
    .top5-bar-wrap { flex: 0 0 60px; }
}

/* ── Type Breakdown ── */
.type-panel { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 12px; padding: 1.25rem; margin-bottom: 2rem; box-shadow: var(--shadow-sm); }
.type-bars { display: flex; flex-direction: column; gap: 0.6rem; }
.type-row { display: flex; align-items: center; gap: 0.75rem; }
.type-label { min-width: 110px; font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); }
.type-bar-wrap { flex: 1; height: 22px; background: #222; border-radius: 4px; overflow: hidden; position: relative; }
.type-bar { height: 100%; border-radius: 4px; min-width: 2px; transition: width 0.5s ease; }
.type-cost { min-width: 80px; text-align: right; font-family: 'Space Grotesk', sans-serif; font-size: 0.85rem; font-weight: 600; }

/* ── Card Table ── */
.table-panel { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 12px; overflow: hidden; margin-bottom: 2rem; box-shadow: var(--shadow-sm); }
.card-table { width: 100%; border-collapse: collapse; }
.card-table th { background: #161616; text-align: left; padding: 0.75rem 1rem; font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; cursor: pointer; user-select: none; white-space: nowrap; border-bottom: 1px solid var(--card-border); }
.card-table th:hover { color: var(--text-primary); }
.card-table th .sort-arrow { margin-left: 0.3rem; font-size: 0.7rem; }
.card-table td { padding: 0.6rem 1rem; font-size: 0.9rem; border-bottom: 1px solid var(--card-border); }
.card-table tr:last-child td { border-bottom: none; }
.card-table tr:hover { background: rgba(168,85,247,0.05); }
.card-table tr.most-expensive { background: rgba(168,85,247,0.1); }
.card-table .not-found { color: #ef4444; font-style: italic; }
.card-table .price-col { text-align: right; font-family: 'Space Grotesk', sans-serif; font-weight: 500; }
.card-table .qty-col { text-align: center; min-width: 40px; }
.card-table .type-col { color: var(--text-secondary); font-size: 0.85rem; }

@media (max-width: 768px) {
    .card-table th, .card-table td { padding: 0.5rem 0.6rem; font-size: 0.8rem; }
    .card-table .type-col { display: none; }
    .card-table th:nth-child(3) { display: none; }
}

/* ── Footer ── */
footer { border-top: 1px solid var(--card-border); padding: 2rem 0; text-align: center; }
.footer-content { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.footer-logo { font-family: 'Space Grotesk', sans-serif; font-size: 1.25rem; font-weight: 700; background: var(--gradient-purple); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; display: flex; align-items: center; gap: 0.5rem; }
.footer-logo::before { content: ''; display: block; width: 26px; height: 26px; background: url('/img/sv-logo.svg') no-repeat center / contain; flex-shrink: 0; }
.wubrg-dots { display: flex; gap: 0.5rem; }
.mana-dot { width: 12px; height: 12px; border-radius: 50%; }
.footer-text { color: var(--text-muted); font-size: 0.8rem; max-width: 500px; }
.footer-links { list-style: none; display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: center; }
.footer-links a { color: var(--text-muted); font-size: 0.8rem; }
.footer-links a:hover { color: #a78bfa; }

/* ── Tool Guide / FAQ ── */
.tool-guide { max-width: 800px; margin: 3rem auto; padding: 0 1.5rem; }
.tool-guide h2 { font-family: 'Space Grotesk', sans-serif; font-size: 1.5rem; color: #e5e7eb; margin: 2.5rem 0 1rem; border-bottom: 1px solid rgba(168,85,247,0.2); padding-bottom: 0.5rem; }
.tool-guide h3 { font-size: 1.15rem; color: #d1d5db; margin: 1.5rem 0 0.75rem; }
.tool-guide p, .tool-guide li { color: #9ca3af; line-height: 1.7; margin-bottom: 1rem; }
.tool-guide a { color: #a855f7; text-decoration: none; }
.tool-guide a:hover { text-decoration: underline; }
.faq-section { margin-top: 1.5rem; }
.faq-item { border: 1px solid #2a2a2e; border-radius: 8px; margin-bottom: 0.75rem; overflow: hidden; }
.faq-q { padding: 1rem 1.25rem; cursor: pointer; font-weight: 600; color: #e5e7eb; display: flex; justify-content: space-between; align-items: center; background: #1a1a1e; }
.faq-q::after { content: '+'; font-size: 1.25rem; color: #a855f7; transition: transform 0.2s; }
.faq-item.open .faq-q::after { content: '\2212'; }
.faq-a { max-height: 0; overflow: hidden; transition: max-height 0.3s ease, padding 0.3s ease; }
.faq-item.open .faq-a { max-height: 800px; padding: 0 1.25rem 1rem; }
.faq-a p { margin: 0.5rem 0; }
.related-links { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1rem; }
.related-links a { display: inline-block; padding: 0.5rem 1rem; background: rgba(168,85,247,0.1); border: 1px solid rgba(168,85,247,0.2); border-radius: 6px; color: #a855f7; font-size: 0.9rem; transition: background-color 0.2s, border-color 0.2s; }
.related-links a:hover { background: rgba(168,85,247,0.2); border-color: rgba(168,85,247,0.4); text-decoration: none; }

/* ── Guide Card Pair ── */
.guide-card-pair { display: flex; gap: 2rem; justify-content: center; margin: 2rem 0; flex-wrap: wrap; }
.guide-card-figure { text-align: center; max-width: 244px; }
.guide-card-figure img { border-radius: 12px; width: 100%; height: auto; box-shadow: 0 4px 12px rgba(0,0,0,0.5); }
.guide-card-figure figcaption { font-size: 0.8rem; color: #9ca3af; margin-top: 0.75rem; line-height: 1.5; }
/* Card images in guide content */
.tool-guide img { max-width: 265px; border-radius: 12px; margin: 1rem 0; box-shadow: 0 4px 12px rgba(0,0,0,0.4); }
.tool-guide .card-examples { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1.5rem 0; }
.tool-guide .card-examples img { max-width: 220px; }
@media (max-width: 640px) { .tool-guide img { max-width: 200px; } .tool-guide .card-examples img { max-width: 160px; } }

/* ── Savings Section ── */
.savings-section { margin-top: 2rem; }
.savings-btn { background: rgba(74,222,128,0.1); border: 1px solid rgba(74,222,128,0.3); color: #4ade80; padding: 0.6rem 1.25rem; border-radius: 8px; font-size: 0.9rem; font-weight: 500; cursor: pointer; font-family: inherit; transition: all 0.2s ease; }
.savings-btn:hover { background: rgba(74,222,128,0.2); border-color: rgba(74,222,128,0.5); }
.savings-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.savings-header { font-size: 1.1rem; font-weight: 600; color: #4ade80; margin-bottom: 0.75rem; }
.savings-table { display: flex; flex-direction: column; gap: 0.25rem; }
.savings-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.5rem 0.75rem; background: rgba(255,255,255,0.03); border-radius: 6px; font-size: 0.85rem; }
.savings-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.savings-detail { flex-shrink: 0; font-size: 0.82rem; }
.savings-saved { flex-shrink: 0; font-weight: 600; color: #4ade80; min-width: 70px; text-align: right; }
@media (max-width: 640px) { .savings-row { flex-wrap: wrap; } .savings-name { width: 100%; } }
