:root {
  --bg: #f4f2ee;
  --bg-glow: #fbe3d3;
  --card: #ffffff;
  --card-2: #faf8f5;
  --text: #1c1b1a;
  --muted: #6e6a64;
  --line: #e7e3dc;
  --accent: #e8743b;
  --accent-2: #d65f26;
  --accent-soft: #fdeee5;
  --kept: #8b93a1;
  --new: #e8743b;
  --free: #ece9e3;
  --bad: #d64545;
  --ok: #2f8f5b;
  --shadow: 0 1px 2px rgba(30, 25, 20, .04), 0 6px 24px rgba(30, 25, 20, .06);
  --radius: 16px;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131315; --bg-glow: #2a1a12; --card: #1c1c1f; --card-2: #222226; --text: #efedea; --muted: #9b978f;
    --line: #2f2f34; --accent-soft: #3a2418; --kept: #6f7887; --free: #2a2a2f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 30px rgba(0, 0, 0, .25);
  }
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; color: var(--text); line-height: 1.5; font-size: 15px;
  background: radial-gradient(900px 420px at 15% -8%, var(--bg-glow), transparent 70%);
  min-height: 100vh;
}
code { font-family: var(--mono); font-size: .92em; background: var(--accent-soft); padding: 1px 5px; border-radius: 5px; }
.shell { max-width: 860px; margin: 0 auto; padding: 40px 22px 56px; }

/* header */
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.brand { display: flex; gap: 14px; align-items: center; }
.logo { width: 48px; height: 48px; filter: drop-shadow(0 4px 10px rgba(232, 116, 59, .35)); }
.logo-body { fill: var(--accent); }
.logo-screen { fill: #fff; }
.logo-key { fill: rgba(255, 255, 255, .75); }
h1 { margin: 0; font-size: 28px; letter-spacing: -.02em; line-height: 1.15; }
.sub { margin: 2px 0 0; color: var(--muted); }
.pills { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.pills li { font-size: 12px; font-weight: 600; color: var(--muted); border: 1px solid var(--line); background: var(--card); padding: 4px 10px; border-radius: 999px; }

main { display: grid; gap: 16px; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.card-head > div { flex: 1; min-width: 0; }
.card-head p { margin: 0; font-size: 14px; }
h2 { margin: 0; font-size: 17px; letter-spacing: -.01em; }
.step {
  width: 30px; height: 30px; flex: none; border-radius: 10px; display: grid; place-items: center;
  font-weight: 700; font-size: 14px; color: var(--accent-2); background: var(--accent-soft);
}
#s-connect .card-head { margin-bottom: 0; }
.muted { color: var(--muted); }
#status.ok { color: var(--ok); font-weight: 600; }
#status.warn, .warn { color: var(--bad); }

/* buttons */
button, .button {
  font: inherit; font-size: 14px; font-weight: 600; padding: 9px 16px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
}
button:hover:not(:disabled), .button:hover { border-color: var(--muted); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, .button:focus-within, .opt:focus-within .switch { outline: 2px solid var(--accent); outline-offset: 2px; }
button.primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-2)); border-color: var(--accent-2); color: #fff;
  box-shadow: 0 2px 8px rgba(232, 116, 59, .35);
}
button.primary:hover:not(:disabled) { box-shadow: 0 4px 14px rgba(232, 116, 59, .45); border-color: var(--accent-2); }
button.primary.big { padding: 11px 28px; font-size: 15px; }
button.danger { background: linear-gradient(180deg, #e25555, var(--bad)); border-color: var(--bad); box-shadow: 0 2px 8px rgba(214, 69, 69, .35); }
button.ghost, .button.ghost { background: var(--card-2); }
button svg, .button svg, .drop svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.link { color: var(--accent-2); cursor: pointer; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* calculator info */
.info { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 10px; margin: 18px 0 0; }
.info > div { padding: 11px 14px; background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.info dt { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.info dd { margin: 2px 0 0; font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; }

/* app lists */
.apps { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.apps li { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--line); font-size: 14px; background: var(--card); }
.apps li:first-child { border-top: 0; }
.apps .badge {
  width: 32px; height: 32px; flex: none; border-radius: 9px; display: grid; place-items: center; font-weight: 700;
  color: #fff; background: linear-gradient(160deg, #9aa2b0, var(--kept));
}
.apps .badge.new { background: linear-gradient(160deg, #f2995f, var(--accent-2)); }
.apps .name { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.apps .meta { color: var(--muted); font-family: var(--mono); font-size: 12.5px; }
.apps .x { padding: 4px 10px; font-size: 13px; border-radius: 8px; background: var(--card-2); }
.apps .warn { font-size: 13px; }
.apps .empty { color: var(--muted); justify-content: center; padding: 16px; background: var(--card-2); }
.queue { margin-top: 12px; }
.note { margin: 10px 0 0; font-size: 13px; color: var(--muted); }

/* drop zone */
.drop {
  display: flex; align-items: center; justify-content: center; gap: 10px; padding: 26px; border-radius: 14px;
  border: 2px dashed var(--line); background: var(--card-2); color: var(--muted); transition: all .15s;
}
.drop svg { width: 24px; height: 24px; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--text); transform: scale(1.01); }

/* options as switches */
.options { display: grid; gap: 4px; margin: 18px 0; }
.opt { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; cursor: pointer; transition: background .15s; }
.opt:hover { background: var(--card-2); }
.opt > span:last-child { display: grid; gap: 1px; font-size: 14px; }
.opt > span:last-child .muted { font-size: 13px; }
.opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { flex: none; width: 38px; height: 22px; border-radius: 999px; background: var(--line); position: relative; margin-top: 1px; transition: background .2s; }
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s;
}
.opt input:checked + .switch { background: var(--accent); }
.opt input:checked + .switch::after { transform: translateX(16px); }
.opt.disabled { opacity: .5; cursor: not-allowed; }
.opt.disabled:hover { background: none; }

/* space bar */
.space { padding: 14px 16px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card-2); }
.space-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--free); position: relative; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .08); }
.bar div { height: 100%; transition: width .3s; }
.bar .kept { background: var(--kept); }
.bar .new { background: linear-gradient(90deg, #f2995f, var(--new)); }
.bar .over { background: var(--bad); }
.bar .mark { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--text); opacity: .55; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-weight: 500; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: 0; }

.install-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; flex-wrap: wrap; }
.install-row #plan { font-size: 13.5px; flex: 1; min-width: 200px; }
.progress { margin-top: 14px; height: 26px; background: var(--free); border-radius: 999px; position: relative; overflow: hidden; }
.progress div { height: 100%; width: 0; background: linear-gradient(90deg, #f2995f, var(--accent-2)); transition: width .2s; }
.progress span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 700; }

/* log */
.log summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.log summary::-webkit-details-marker { display: none; }
.log summary::after { content: "›"; color: var(--muted); font-size: 18px; transform: rotate(90deg); transition: transform .2s; }
.log:not([open]) summary::after { transform: rotate(0); }
.log pre {
  margin: 12px 0 0; max-height: 220px; overflow: auto; font: 12px/1.6 var(--mono); white-space: pre-wrap;
  color: var(--muted); background: var(--card-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
}
.log pre:empty::before { content: "Nothing yet."; }
.foot { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 26px; }
.foot p { margin: 4px 0; }
.foot a { color: var(--muted); }

/* dialog */
dialog {
  border: 1px solid var(--line); border-radius: 18px; background: var(--card); color: var(--text);
  max-width: 440px; padding: 26px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
dialog[open] { animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
dialog::backdrop { background: rgba(15, 12, 10, .45); backdrop-filter: blur(3px); }
dialog h2 { font-size: 19px; }
dialog p { color: var(--muted); font-size: 14px; }
.dlg-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 20px; color: var(--bad); background: rgba(214, 69, 69, .12); margin-bottom: 12px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

@media (max-width: 560px) {
  .card-head { flex-wrap: wrap; }
  #connect { width: 100%; justify-content: center; }
}

/* calculator software */
.fw-cards { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: stretch; }
.fw-cards > div:not(.arrow) { padding: 12px 14px; background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 2px; }
.fw-cards .k { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.fw-cards .v { font-family: var(--mono); font-size: 13px; }
.fw-cards .arrow { display: grid; place-items: center; color: var(--muted); font-size: 18px; }
#fw-box .opt { margin-top: 10px; }

/* NumPlay builder */
.numplay-link { width: 100%; display: flex; align-items: center; gap: 14px; margin-top: 10px; padding: 12px 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card-2); color: var(--text); text-align: left; font-weight: 400; white-space: normal; }
.numplay-link:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.numplay-link > span:nth-child(2) { flex: 1; display: grid; font-size: 14px; }
.numplay-link .muted { font-size: 13px; }
.np-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-size: 13px;
  background: linear-gradient(160deg, #6a5cff, #3d2fd6); flex: none; }
.np-go { color: var(--muted); font-size: 22px; transition: transform .2s; }
.numplay-link[aria-expanded="true"] .np-go { transform: rotate(90deg); }
.np { margin-top: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--card-2); }
.np-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.np-tools input, .np-tools select, .np-look input, .np-look select {
  font: inherit; font-size: 14px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); }
.np-tools input { flex: 1; min-width: 180px; }
.np-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; max-height: 420px; overflow: auto;
  padding: 2px; margin-top: 10px; }
.tile { position: relative; display: grid; justify-items: center; gap: 4px; padding: 10px 6px 8px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); font-weight: 500; white-space: normal; text-align: center; }
.tile img, .tile .ph { width: 48px; height: 48px; border-radius: 11px; object-fit: cover; }
.tile .ph { display: grid; place-items: center; color: #fff; font-weight: 700; }
.tile .t { font-size: 12.5px; line-height: 1.25; }
.tile .s { font-size: 11.5px; color: var(--muted); font-family: var(--mono); }
.tile .tag { position: absolute; top: 6px; left: 6px; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent-2); }
.tile[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.tile[aria-pressed="true"]::after { content: "\2713"; position: absolute; top: 6px; right: 6px; width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; color: #fff; background: var(--accent); }
.np-look { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-end; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.np-look label, .np-look > div { display: grid; gap: 4px; font-size: 14px; }
.np-look .k { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.np-variants { display: flex; gap: 6px; }
.np-variants button { padding: 3px; border-radius: 12px; }
.np-variants button img { width: 40px; height: 40px; border-radius: 9px; display: block; }
.np-variants button[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.np-check { display: flex !important; align-items: center; gap: 8px; }
.credit a { color: var(--accent-2); }
.np [hidden] { display: none !important; }
