:root {
  --bg: #0c0c0e;
  --bg-2: #141416;
  --ink: #f0ece4;
  --muted: #8f8b83;
  --dim: #5c5a55;
  --line: #26262a;
  --line-strong: #3a3a40;
  --accent: #ff4d24;
  --accent-soft: rgba(255, 77, 36, 0.13);
  --ok: #3ecf8e;
  --warn: #ffb547;
  --mono: "Cascadia Code", "JetBrains Mono", "SF Mono", "Fira Code", ui-monospace, Consolas, "Courier New", monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--mono);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ============ BACKGROUND ============ */
.grid-bg {
  position: fixed; inset: 0; z-index: -2;
  background-image: radial-gradient(rgba(240, 236, 228, 0.055) 1px, transparent 1.4px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 80%);
          mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 80%);
}
.scanline {
  position: fixed; left: 0; right: 0; top: 0; height: 1px; z-index: -1;
  background: linear-gradient(90deg, transparent, rgba(255, 77, 36, 0.10), transparent);
  animation: scan 8s linear infinite;
  pointer-events: none;
}
@keyframes scan {
  0% { transform: translateY(-2px); opacity: 0; }
  5% { opacity: 1; }
  95% { opacity: 1; }
  100% { transform: translateY(100vh); opacity: 0; }
}

.shell { max-width: 720px; margin: 0 auto; padding: 26px 22px 90px; }

/* ============ TOP BAR ============ */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 18px; border-bottom: 1px solid var(--line);
  font-size: 12px; letter-spacing: 0.08em;
}
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; }
.brand .mark {
  width: 24px; height: 24px; display: grid; place-items: center;
  background: var(--accent); color: var(--bg); font-weight: 800; font-size: 13px;
  border-radius: 3px;
}
.dim { color: var(--dim); }
.status { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; letter-spacing: 0.05em; }
.status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); transition: all .3s; }
.status.ok { color: var(--ok); }
.status.ok .dot { background: var(--ok); animation: pulse 2s ease-out infinite; }
.status.bad { color: var(--accent); }
.status.bad .dot { background: var(--accent); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(62, 207, 142, 0.5); } 70% { box-shadow: 0 0 0 7px rgba(62, 207, 142, 0); } 100% { box-shadow: 0 0 0 0 rgba(62, 207, 142, 0); } }

/* ============ HERO ============ */
.hero { padding: 56px 0 40px; }
.eyebrow { color: var(--dim); font-size: 13px; letter-spacing: 0.06em; margin-bottom: 18px; }
.display {
  font-size: clamp(42px, 9vw, 74px);
  line-height: 0.95;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.display .accent { color: var(--accent); }
.display .cursor { color: var(--accent); font-weight: 400; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.sub { color: var(--muted); font-size: 14px; margin-top: 20px; max-width: 440px; line-height: 1.6; }

/* ============ CONSOLE ============ */
.console {
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  padding: 22px;
  display: flex; flex-direction: column; gap: 18px;
}
.prompt {
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
  transition: border-color .2s;
}
.prompt:focus-within { border-color: var(--accent); }
.prompt .chev { color: var(--accent); font-size: 16px; }
.prompt input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--ink); font-family: var(--mono); font-size: 15px;
}
.prompt input::placeholder { color: var(--dim); }
.pact {
  padding: 5px 10px; background: transparent; border: 1px solid var(--line);
  color: var(--muted); font-family: var(--mono); font-size: 11px; letter-spacing: 0.03em;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.pact:hover { border-color: var(--accent); color: var(--accent); }
.pact:active { transform: translateY(1px); }

.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: flex; border: 1px solid var(--line); }
.seg button {
  flex: 1; padding: 9px 8px; background: transparent; border: none;
  color: var(--muted); font-family: var(--mono); font-size: 12px;
  letter-spacing: 0.03em; cursor: pointer; transition: all .15s;
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent-soft); color: var(--accent); }

.opts { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field .label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--dim);
}
.field input, .field select {
  width: 100%; padding: 10px 12px; background: transparent;
  border: 1px solid var(--line); color: var(--ink);
  font-family: var(--mono); font-size: 14px; outline: none;
  border-radius: 0; transition: border-color .15s;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.field select { cursor: pointer; }
.field select option { background: var(--bg-2); color: var(--ink); }
.prefix { display: flex; align-items: center; border: 1px solid var(--line); transition: border-color .15s; }
.prefix:focus-within { border-color: var(--accent); }
.prefix-host { padding: 10px 0 10px 12px; color: var(--dim); font-size: 14px; white-space: nowrap; }
.prefix input { border: none !important; padding-left: 0; }

.hidden { display: none !important; }

/* ============ GO BUTTON ============ */
.go {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 15px; background: var(--accent); color: var(--bg);
  border: none; cursor: pointer; width: 100%;
  font-family: var(--mono); font-size: 15px; font-weight: 800; letter-spacing: 0.06em;
  transition: filter .15s, transform .08s, opacity .15s;
}
.go:hover { filter: brightness(1.1); }
.go:active { transform: translateY(2px); }
.go .go-arrow { transition: transform .15s; }
.go:hover .go-arrow { transform: translateX(4px); }
.go.loading { opacity: 0.7; pointer-events: none; }
.go.loading .go-arrow { display: none; }
.go.loading .go-txt { animation: breathe 1.2s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.5; } }

/* ============ RESULT ============ */
.result {
  margin-top: 26px; border: 1px solid var(--accent); background: var(--accent-soft);
  padding: 20px 22px; animation: rise .35s cubic-bezier(.2,.8,.2,1);
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.res-head { color: var(--accent); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; margin-bottom: 12px; }
.res-link {
  display: block; color: var(--ink); font-size: 17px; text-decoration: none;
  word-break: break-all; font-weight: 700;
}
.res-link:hover { color: var(--accent); }
.res-meta { color: var(--muted); font-size: 12px; margin-top: 8px; }
.res-actions { display: flex; gap: 10px; margin-top: 16px; }

.btn {
  padding: 9px 16px; background: transparent; border: 1px solid var(--line-strong);
  color: var(--ink); font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em;
  cursor: pointer; transition: all .15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.danger:hover { color: var(--accent); border-color: var(--accent); }
.btn.copied { border-color: var(--ok); color: var(--ok); }

/* ============ HISTORY ============ */
.history { margin-top: 46px; }
.h-head { font-size: 12px; letter-spacing: 0.16em; color: var(--muted); margin-bottom: 16px; font-weight: 700; }
.history .empty { color: var(--dim); font-size: 13px; padding: 24px; border: 1px dashed var(--line); text-align: center; }
.row {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  border: 1px solid var(--line); border-left: 2px solid var(--line-strong);
  margin-bottom: 10px; font-size: 13px; transition: border-color .15s;
  animation: rowin .35s cubic-bezier(.2,.8,.2,1) backwards;
}
.row:hover { border-left-color: var(--accent); }
@keyframes rowin { from { opacity: 0; transform: translateX(-8px); } }
.badge {
  flex: 0 0 auto; padding: 3px 8px; font-size: 10px; letter-spacing: 0.1em;
  border: 1px solid; white-space: nowrap;
}
.badge.perm { color: var(--ok); border-color: var(--ok); }
.badge.exp { color: var(--warn); border-color: var(--warn); }
.row .left { flex: 1; min-width: 0; }
.row .short { color: var(--accent); font-size: 14px; text-decoration: none; font-weight: 700; }
.row .short:hover { text-decoration: underline; }
.row .t { color: var(--dim); font-size: 12px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 340px; }
.row .acts { display: flex; gap: 6px; flex: 0 0 auto; }
.row .acts .btn { padding: 6px 10px; font-size: 11px; }

footer { margin-top: 60px; text-align: center; color: var(--dim); font-size: 12px; letter-spacing: 0.04em; }

/* ============ TOAST ============ */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--bg-2); border: 1px solid var(--line-strong); color: var(--ink);
  padding: 12px 20px; font-size: 13px; font-family: var(--mono);
  opacity: 0; pointer-events: none; transition: opacity .22s, transform .22s; z-index: 99;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.toast.err { border-color: var(--accent); }

@media (max-width: 560px) {
  .controls { grid-template-columns: 1fr; }
  .row { flex-wrap: wrap; }
  .row .acts { width: 100%; justify-content: flex-end; }
}
