/* Embeddable calculator (templates/pages/widget.php). Loaded after style-v2.css and uses its tokens, so dark/light and the
   brand colours follow the main site. Everything is sized so the control bar, the verdict, three picks and five listings
   fit in a 640 px frame without scrolling. */

.widget-body { background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 13px; }
.widget-body main { padding: 10px 12px 0; max-width: 960px; margin: 0 auto; }
.widget-body .empty { margin: 12px 0; }

/* ── Control bar ─────────────────────────────────────────────────────────── */
.w-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; padding: 8px; background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--r-md); }
.w-field { position: relative; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.w-field-gpu  { flex: 1.3 1 170px; }
.w-field-goal { flex: 1 1 170px; }
.w-field-tier { flex: 0 1 140px; }
.w-field-k { font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.w-field-k em { font-style: normal; text-transform: none; letter-spacing: 0; opacity: .7; }
.w-field input, .w-field select { width: 100%; height: 34px; padding: 0 10px; background: var(--bg); color: var(--text); border: 1px solid var(--border-2); border-radius: var(--r-sm); font: 500 13px var(--sans); outline: none; transition: border-color .15s, box-shadow .15s; }
.w-field input::placeholder { color: var(--text-3); font-weight: 400; }
.w-field input:focus, .w-field select:focus { border-color: var(--lime); box-shadow: 0 0 0 3px var(--lime-glow); }
.w-field .suggestions { top: calc(100% + 4px); border-radius: var(--r-md); max-height: 240px; }
.w-field .sug { padding: 8px 12px; font-size: 12.5px; }
.w-go { height: 34px; padding: 0 16px; display: inline-flex; align-items: center; gap: 6px; background: var(--lime); color: #0a0a0c; border: 0; border-radius: var(--r-sm); font: 700 12.5px var(--sans); cursor: pointer; transition: background .15s, box-shadow .15s; }
html[data-theme="light"] .w-go { color: #fff; }
.w-go:hover { background: var(--lime-2); box-shadow: 0 4px 16px var(--lime-glow); }

.w-hint { margin: 8px 2px 0; font-size: 12px; color: var(--text-3); }
.w-hint-warn { color: var(--amber); }

/* ── Start screen ────────────────────────────────────────────────────────── */
.w-start { padding: 22px 4px 8px; text-align: center; }
.w-headline { margin: 0 0 14px; font-size: clamp(22px, 5vw, 32px); font-weight: 600; line-height: 1.05; letter-spacing: -0.04em; text-wrap: balance; }
.w-headline .accent { color: var(--lime); font-weight: 700; font-style: italic; letter-spacing: -0.05em; }
.w-chips { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; margin-top: 8px; }
.w-chips-k { font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-right: 2px; }
.w-chip { padding: 4px 10px; background: var(--bg-1); color: var(--text-2); border: 1px solid var(--border); border-radius: 999px; font: 500 12px var(--sans); cursor: pointer; transition: border-color .15s, color .15s; }
.w-chip:hover { border-color: var(--lime); color: var(--text); }

/* ── Goal strip ──────────────────────────────────────────────────────────── */
.w-goal { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin-top: 8px; padding: 8px 12px; background: var(--bg-1); border: 1px solid var(--border); border-left: 3px solid var(--lime); border-radius: var(--r-md); }
.w-goal.is-met   { border-left-color: #00e676; }
.w-goal.is-short { border-left-color: var(--amber); }
.w-goal-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
.w-goal-k { font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.w-goal-name { font-size: 14px; font-weight: 600; }
.w-goal-req { font-size: 11.5px; color: var(--text-3); }
.w-goal-status { font-size: 12px; font-weight: 600; white-space: nowrap; }
.w-goal-status.ok  { color: #00e676; }
.w-goal-status.bad { color: var(--amber); }
html[data-theme="light"] .w-goal-status.ok { color: #2e7d32; }

/* ── Verdict strip ───────────────────────────────────────────────────────── */
.w-verdict { display: grid; grid-template-columns: auto 1fr auto; gap: 8px 16px; align-items: center; margin-top: 8px; padding: 10px 14px; background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--r-md); }
.w-verdict.go   { box-shadow: 0 0 0 1px rgba(0,230,118,.18); }
.w-verdict.hold { box-shadow: 0 0 0 1px rgba(255,214,0,.16); }
.w-verdict.skip { box-shadow: 0 0 0 1px rgba(255,23,68,.14); }
.w-v-head { display: flex; flex-direction: column; gap: 2px; min-width: 96px; }
.w-v-k { font-family: var(--mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.w-v-word { font-size: 28px; font-weight: 700; line-height: 1; letter-spacing: -0.04em; }
.w-verdict.go   .w-v-word { color: #00e676; }
.w-verdict.hold .w-v-word { color: var(--amber); }
.w-verdict.skip .w-v-word { color: var(--red); }
html[data-theme="light"] .w-verdict.go .w-v-word { color: #2e7d32; }
.w-v-word .punct { color: var(--text); font-weight: 600; }
.w-v-body p { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.w-v-body strong { color: var(--text); font-weight: 600; }
.w-v-body .accent { color: #00e676; }
html[data-theme="light"] .w-v-body .accent { color: #2e7d32; }
.w-v-note { margin-top: 3px !important; font-size: 11px !important; color: var(--amber) !important; }
.w-meter { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.w-meter-track { flex: 1; height: 5px; background: var(--bg-3); border-radius: 3px; overflow: hidden; }
.w-meter-fill { height: 100%; border-radius: 3px; background: var(--lime); }
.w-verdict.go   .w-meter-fill { background: linear-gradient(90deg, #00e676, #69f0ae); }
.w-verdict.hold .w-meter-fill { background: linear-gradient(90deg, var(--amber), #ffe566); }
.w-verdict.skip .w-meter-fill { background: linear-gradient(90deg, var(--red), #ff6b8a); }
.w-meter-val { font-family: var(--mono); font-size: 12px; font-weight: 600; white-space: nowrap; }
.w-meter-val small { font-weight: 400; color: var(--text-3); margin-left: 2px; }
.w-v-subject { display: flex; flex-direction: column; gap: 1px; padding-left: 14px; border-left: 1px solid var(--border); min-width: 120px; }
.w-v-sub-k { font-family: var(--mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.w-v-subject strong { font-size: 14px; font-weight: 600; }
.w-v-sub-meta { font-family: var(--mono); font-size: 10.5px; color: var(--text-3); }
.w-v-sub-meta b { color: var(--text-2); font-weight: 600; }

/* ── Picks ───────────────────────────────────────────────────────────────── */
.w-picks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.w-pick { position: relative; display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 8px 10px; background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--r-md); }
.w-pick.is-featured { border-color: var(--lime); background: linear-gradient(180deg, var(--lime-glow), transparent 70%), var(--bg-1); }
.w-pick-rank { align-self: flex-start; padding: 1px 7px; font-family: var(--mono); font-size: 9px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); background: var(--bg-3); border-radius: 999px; }
.w-pick.is-featured .w-pick-rank { background: var(--lime); color: #0a0a0c; }
html[data-theme="light"] .w-pick.is-featured .w-pick-rank { color: #fff; }
.w-pick.is-featured .w-pick-rank::before { content: "★ "; }
.w-pick-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; line-height: 1.25; }
.w-pick-stats { display: flex; align-items: baseline; gap: 6px; }
.w-pick-gain { font-size: 22px; font-weight: 700; line-height: 1; letter-spacing: -0.03em; color: #00e676; }
html[data-theme="light"] .w-pick-gain { color: #2e7d32; }
.w-pick-gain small { font-size: 11px; font-weight: 400; color: var(--text-3); margin-left: 1px; }
.w-pick-gain-k { font-size: 10px; color: var(--text-3); }
.w-pick-flag { font-size: 10px; color: var(--amber); }
.w-pick-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; margin-top: auto; padding-top: 2px; }
.w-pick-price { font-size: 14px; font-weight: 700; }
.w-pick-cpp { font-family: var(--mono); font-size: 10px; color: var(--text-3); }
.w-pick-cpp b { color: var(--text); font-weight: 600; }

.w-buy { display: inline-block; margin-left: auto; padding: 3px 9px; background: #16a34a; color: #fff; border-radius: var(--r-sm); font: 600 11px var(--sans); text-decoration: none; white-space: nowrap; transition: background .15s; }
.w-buy:hover { background: #15803d; }

/* ── Listings ────────────────────────────────────────────────────────────── */
.w-table-wrap { margin-top: 8px; background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.w-table-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.w-table-head h2 { margin: 0; font-size: 13px; font-weight: 600; }
.w-count { margin-left: 6px; font-family: var(--mono); font-size: 10px; font-weight: 500; color: var(--text-3); }
.w-sorts { display: flex; gap: 4px; }
.w-sort { padding: 2px 8px; font: 500 11px var(--sans); color: var(--text-3); border: 1px solid transparent; border-radius: 999px; text-decoration: none; }
.w-sort:hover { color: var(--text); }
.w-sort.is-active { color: var(--lime); border-color: var(--lime); background: var(--lime-glow); }

.w-table { width: 100%; border-collapse: collapse; }
.w-table th { padding: 5px 8px; font-family: var(--mono); font-size: 9px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); text-align: left; border-bottom: 1px solid var(--border); }
.w-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); font-size: 12.5px; vertical-align: middle; }
.w-table tbody tr:last-child td { border-bottom: 0; }
.w-table tbody tr[data-href] { cursor: pointer; }
.w-table tbody tr:hover { background: var(--bg-2); }
.w-table tr.is-best td:first-child { box-shadow: inset 3px 0 0 var(--lime); }
.w-table .r { text-align: right; white-space: nowrap; }
.w-table td:first-child, .w-table th:first-child { padding-left: 12px; }
.w-table td:last-child, .w-table th:last-child { padding-right: 12px; }
.w-model { font-weight: 500; }
.w-model .badge { margin-right: 4px; }
.w-table td.price { font-weight: 600; font-variant-numeric: tabular-nums; }
.w-table td.gain { font-family: var(--mono); font-weight: 600; }
.w-table td.gain.gain-neg  { color: var(--red); }
.w-table td.gain.gain-gray { color: var(--text-3); }
.w-table td.gain.gain-low  { color: var(--amber); }
.w-table td.gain.gain-mid  { color: #69f0ae; }
.w-table td.gain.gain-high { color: #00e676; }
html[data-theme="light"] .w-table td.gain.gain-mid  { color: #388e3c; }
html[data-theme="light"] .w-table td.gain.gain-high { color: #2e7d32; }
.w-all { display: block; padding: 7px 12px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-3); text-align: right; text-decoration: none; }
.w-all:hover { color: var(--lime); }

.widget-credit { margin-top: 6px; padding: 7px 12px; font-size: 10.5px; }
/* The embedding page chose the look (?theme=), so the visitor's own toggle would only fight it */
html.forced-theme .theme-btn, html.forced-theme .credit-sep:last-of-type { display: none; }

/* ── Narrow frames ───────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .w-verdict { grid-template-columns: 1fr; }
  .w-v-subject { padding: 6px 0 0; border-left: 0; border-top: 1px solid var(--border); flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
  .w-v-word { font-size: 24px; }
  .w-col-vram { display: none; }
}
@media (max-width: 520px) {
  .w-picks { grid-template-columns: 1fr; }
  .w-pick { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
  .w-pick-name { flex: 1 1 140px; }
  .w-pick-foot { margin-top: 0; padding-top: 0; flex: 1 1 100%; }
}
@media (max-width: 440px) {
  .widget-body main { padding: 8px 8px 0; }
  .w-field-gpu, .w-field-goal, .w-field-tier { flex: 1 1 100%; }
  .w-go { flex: 1 1 100%; justify-content: center; }
  .w-col-buy .w-buy { padding: 3px 7px; }
  .w-sorts { display: none; }
}
@media (prefers-reduced-motion: reduce) { .w-go, .w-buy, .w-field input { transition: none; } }
