/* revoke.wick.pics — dependency-free stylesheet */

:root {
  --bg: #080b10;
  --bg-2: #0d1219;
  --panel: #111823;
  --panel-2: #16202d;
  --line: #1f2b3a;
  --line-2: #2a3a4e;

  --text: #e8eef6;
  --muted: #8ba0b8;
  --dim: #5f7286;

  --green: #35d07f;
  --green-dim: #1e7d4c;
  --amber: #f0b429;
  --red: #f2545b;

  --radius: 12px;
  --radius-sm: 8px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(900px 500px at 50% -8%, rgba(53, 208, 127, 0.10), transparent 65%);
  min-height: 100vh;
}

.wrap { width: min(1080px, 100% - 2.5rem); margin-inline: auto; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.86rem; }
.big { font-size: 1.15rem; font-weight: 600; }
code { font-family: var(--mono); font-size: 0.9em; color: var(--muted); }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ topbar */

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(8, 11, 16, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 62px;
}
.brand {
  display: flex; align-items: center; gap: 0.55rem;
  color: var(--text); font-weight: 700; font-size: 1.06rem; letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px; display: block;
  border: 1px solid var(--line-2);
  box-shadow: 0 0 12px rgba(53, 208, 127, 0.22);
}
.brand .dot { color: var(--green); }
.topbar-right { display: flex; align-items: center; gap: 0.7rem; }

.wallet-wrap { position: relative; }
.wallet-menu {
  position: absolute; right: 0; top: calc(100% + 0.45rem);
  min-width: 180px; z-index: 50;
  background: var(--panel); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); padding: 0.3rem;
  box-shadow: 0 14px 34px -10px rgba(0, 0, 0, 0.7);
  display: flex; flex-direction: column;
}
.wallet-menu button {
  font: inherit; font-size: 0.88rem; text-align: left;
  padding: 0.55rem 0.7rem; border: none; border-radius: 6px;
  background: transparent; color: var(--text); cursor: pointer;
}
.wallet-menu button:hover { background: var(--panel-2); }
.wallet-menu button.danger { color: var(--red); }

.pill {
  font-size: 0.78rem; padding: 0.28rem 0.6rem;
  border: 1px solid var(--line-2); border-radius: 999px;
  color: var(--muted); font-family: var(--mono);
}
.pill.ok { color: var(--green); border-color: var(--green-dim); }
.pill.warn { color: var(--amber); border-color: #6b5417; }

/* ------------------------------------------------------------------ buttons */

.btn {
  font: inherit; font-weight: 600; font-size: 0.92rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, opacity 0.14s ease;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: #1d2937; border-color: #35485f; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: var(--green); color: #04160d; border-color: transparent;
}
.btn-primary:hover:not(:disabled) { background: #48e592; }
.btn-ghost { background: transparent; }
.btn-lg { padding: 0.75rem 1.4rem; font-size: 1rem; }
.btn-burn { background: #2a1410; border-color: #5c2a1e; color: #ffb199; }
.btn-burn:hover:not(:disabled) { background: #3a1b15; }
.btn-sm { padding: 0.38rem 0.75rem; font-size: 0.84rem; }

/* --------------------------------------------------------------------- hero */

.hero {
  padding: 4rem 0 2.5rem;
  display: flex; align-items: center; gap: 3rem;
}
.hero-copy { max-width: 760px; flex: 1 1 auto; min-width: 0; }

/* Green Wick — the token this site burns. Sits beside the copy on wide
   screens, drops out entirely on narrow ones so it never pushes the
   connect button below the fold. */
.hero-wick { flex: none; align-self: center; display: block; line-height: 0; }
.hero-wick img {
  display: block;
  width: 240px; height: 240px;
  border-radius: 22px;
  border: 1px solid #21402f;
  box-shadow:
    0 0 0 1px rgba(53, 208, 127, 0.10),
    0 18px 50px -12px rgba(53, 208, 127, 0.30);
}
@media (max-width: 900px) { .hero-wick { display: none; } }
.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.1; letter-spacing: -0.03em; margin: 0 0 1rem;
}
.lede { font-size: 1.08rem; color: var(--muted); margin: 0 0 1.8rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: center; }
.lookup { display: flex; gap: 0.5rem; flex: 1 1 340px; }
.lookup input {
  flex: 1; min-width: 0;
  font: inherit; font-size: 0.9rem; font-family: var(--mono);
  padding: 0.72rem 0.9rem;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
}
.lookup input:focus { outline: none; border-color: var(--green-dim); }
.lookup input::placeholder { color: var(--dim); font-family: var(--sans); }

/* Price, stated up front rather than first revealed in a confirm dialog. */
.fee-line {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0.5rem 0.7rem; margin: 1.5rem 0 0;
  font-size: 0.88rem; color: var(--muted);
}
.fee-chip {
  display: inline-flex; align-items: baseline; gap: 0.4rem;
  padding: 0.32rem 0.7rem; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--panel);
}
.fee-chip strong {
  color: var(--green); font-weight: 650;
  font-family: var(--mono); font-size: 0.9rem; letter-spacing: -0.01em;
}
.fee-tail { color: var(--dim); }

.assurances {
  list-style: none; padding: 0; margin: 2rem 0 0;
  display: grid; gap: 0.65rem;
}
.assurances li {
  color: var(--muted); font-size: 0.92rem;
  padding-left: 1.5rem; position: relative;
}
.assurances li::before {
  content: "→"; position: absolute; left: 0; color: var(--green);
}
.assurances strong { color: var(--text); font-weight: 600; }

/* -------------------------------------------------------------------- panel */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.scan-head { display: flex; align-items: center; gap: 1rem; }
.scan-head h2 { margin: 0 0 0.15rem; font-size: 1.1rem; }
.scan-head p { margin: 0; }

.spinner {
  width: 28px; height: 28px; flex: none;
  border: 3px solid var(--line-2);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress {
  margin-top: 1.1rem; height: 5px; border-radius: 999px;
  background: var(--line); overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, var(--green-dim), var(--green));
  transition: width 0.35s ease;
}

/* ------------------------------------------------------------------ results */

.results-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.results-head h2 { margin: 0; font-size: 1.35rem; letter-spacing: -0.02em; }
.results-head p { margin: 0.15rem 0 0; }
.results-actions { display: flex; align-items: center; gap: 0.9rem; }
.select-all-mobile { display: none; }
.check { display: flex; align-items: center; gap: 0.45rem; font-size: 0.88rem; color: var(--muted); cursor: pointer; }
.check input { accent-color: var(--green); width: 15px; height: 15px; }

.resume-bar {
  display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap;
  background: linear-gradient(180deg, #17130c, var(--panel));
  border: 1px solid #6b5417; border-radius: var(--radius-sm);
  padding: 0.85rem 1rem; margin-bottom: 1rem;
  font-size: 0.92rem;
}
.resume-bar #resume-text { flex: 1 1 240px; color: var(--amber); }
.resume-bar .btn-sm { min-height: auto; }

.batch-bar {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: var(--panel-2); border: 1px solid var(--green-dim);
  border-radius: var(--radius-sm); padding: 0.8rem 1rem; margin-bottom: 1rem;
}
.batch-bar > span:first-child { font-weight: 600; }
.batch-bar .btn { margin-left: auto; }

.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }

.approvals { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 760px; }
.approvals thead th {
  text-align: left; font-weight: 600; font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--dim);
  padding: 0.75rem 0.9rem; background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0;
}
.approvals td { padding: 0.85rem 0.9rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.approvals tbody tr:last-child td { border-bottom: none; }
.approvals tbody tr:hover { background: rgba(255,255,255,0.017); }
.approvals tbody tr.busy { opacity: 0.5; }
.approvals tbody tr.done { opacity: 0.4; }
.col-check { width: 40px; }
.col-check input { accent-color: var(--green); width: 15px; height: 15px; }
.col-action { width: 110px; text-align: right; }

.tok { display: flex; flex-direction: column; gap: 0.1rem; }
.tok-sym { font-weight: 650; }
.tok-name { font-size: 0.78rem; color: var(--dim); }

.amt-unlimited { color: var(--red); font-weight: 650; }
.amt-all { color: var(--red); font-weight: 650; }
.amt-num { font-family: var(--mono); font-size: 0.87rem; }

.risk { font-family: var(--mono); font-size: 0.87rem; }
.risk.none { color: var(--dim); }
.risk.some { color: var(--amber); }

.addr {
  font-family: var(--mono); font-size: 0.82rem; color: var(--muted);
}
.addr-label { color: var(--text); font-family: var(--sans); font-size: 0.87rem; }

.empty { text-align: center; padding: 3.5rem 1rem; }
.empty .big { margin-bottom: 0.4rem; }

/* --------------------------------------------------------------------- burn */

.burn { border-color: #33241c; background: linear-gradient(180deg, #14100e, var(--panel)); }
.burn-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.burn-head h2 {
  margin: 0 0 0.4rem; font-size: 1.15rem;
  display: flex; align-items: center; gap: 0.55rem;
}
.burn-wick {
  width: 28px; height: 28px; border-radius: 7px; flex: none;
  border: 1px solid #3a2a1f;
}
.stat-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem; margin: 1.3rem 0;
}
.stat { background: rgba(0,0,0,0.25); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.9rem 1rem; }
.stat-k { font-size: 1.3rem; font-weight: 700; font-family: var(--mono); letter-spacing: -0.02em; }
.stat-l { font-size: 0.78rem; color: var(--dim); margin-top: 0.15rem; }
.burn-actions { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; }

/* ------------------------------------------------------------------- footer */

.footer {
  padding: 2rem 0 4rem;
  display: grid; gap: 0.6rem; justify-items: center; text-align: center;
  border-top: 1px solid var(--line);
}

/* -------------------------------------------------------------------- modal */

.modal {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(4, 6, 9, 0.72); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 1.5rem;
}
.modal-card {
  background: var(--panel); border: 1px solid var(--line-2);
  border-radius: var(--radius); padding: 1.6rem;
  width: min(520px, 100%); max-height: 85vh; overflow-y: auto;
}
.modal-card h3 { margin: 0 0 0.9rem; font-size: 1.15rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.4rem; }
.modal-body-row {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.5rem 0; border-bottom: 1px solid var(--line); font-size: 0.9rem;
}
.modal-body-row:last-child { border-bottom: none; }
.modal-body-row .k { color: var(--muted); }
.modal-body-row .v { font-family: var(--mono); text-align: right; }
.steps { margin: 1rem 0 0; padding-left: 1.1rem; color: var(--muted); font-size: 0.88rem; }
.steps li { margin-bottom: 0.35rem; }

.wallet-list { display: grid; gap: 0.5rem; margin-top: 1.1rem; }
.wallet-option {
  display: flex; align-items: center; gap: 0.75rem;
  width: 100%; min-height: 56px;
  padding: 0.7rem 0.9rem;
  font: inherit; font-size: 0.98rem; font-weight: 600; text-align: left;
  color: var(--text); background: var(--panel-2);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.wallet-option:hover { background: #1d2937; border-color: var(--green-dim); }
.wallet-option img { width: 28px; height: 28px; border-radius: 7px; flex: none; }

/* ------------------------------------------------------------------- toasts */

.toasts {
  position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 95;
  display: flex; flex-direction: column; gap: 0.6rem; align-items: flex-end;
}
.toast {
  background: var(--panel-2); border: 1px solid var(--line-2);
  border-left: 3px solid var(--green);
  border-radius: var(--radius-sm); padding: 0.75rem 1rem;
  font-size: 0.88rem; max-width: 380px;
  animation: slide-in 0.22s ease;
}
.toast.err { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--amber); }
.toast a { display: block; margin-top: 0.2rem; font-size: 0.82rem; }
@keyframes slide-in { from { opacity: 0; transform: translateX(14px); } }

/* Attacker-controlled strings reach the DOM: a token can name itself anything,
   including a 60-character run with no spaces. Let them wrap everywhere they
   surface, not just inside the table. */
.tok-sym, .tok-name, .addr, .modal-body-row .v, .toast {
  overflow-wrap: anywhere;
}

/* iOS auto-zooms the whole page when a focused input is under 16px, leaving the
   layout scaled up and scrolled sideways. Applies at every width: iPads and
   phones in landscape are above the phone breakpoint but still iOS. */
.lookup input { font-size: 16px; }

/* ---- tablet and below: the table cannot fit, so restack it as cards -------
   Keyed at 860px, not 620px: the table is min-width 760px, so anything under
   ~800px scrolls sideways and hides the Revoke button in the last column.
   621-799px covers iPad mini portrait (744px) and most phones in landscape. */
@media (max-width: 860px) {
  .table-scroll { border: none; overflow-x: visible; }
  .approvals { min-width: 0; font-size: 0.95rem; }
  .approvals thead { display: none; }
  .approvals tbody tr {
    display: block; margin-bottom: 0.7rem; padding: 0.35rem 0.85rem 0.75rem;
    border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--panel);
    position: relative;
  }
  .approvals tbody tr:hover { background: var(--panel); }
  .approvals td {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; padding: 0.45rem 0; border-bottom: none;
    overflow-wrap: anywhere;
  }
  .approvals td::before {
    content: attr(data-label);
    color: var(--dim); font-size: 0.78rem;
    text-transform: uppercase; letter-spacing: 0.05em;
    flex: none;
  }

  /* The checkbox floats over the card's top-right corner — exactly where the
     right-aligned token symbol sits. Without this it painted over the symbol
     ("PLSX" rendered as "Pl<box>"), hiding the only identifier of what is about
     to be revoked. display:block drops the inherited flex layout whose empty
     ::before + 1rem gap padded the cell out to 45px of tap-stealing strip, and
     the Token cell reserves the space so nothing is drawn underneath. */
  .approvals td.col-check {
    position: absolute; top: 0.6rem; right: 0.7rem;
    width: auto; padding: 0; display: block;
  }
  .approvals td.col-check::before { content: none; }
  .approvals tbody td[data-label="Token"] { padding-right: 2.1rem; }

  .approvals td.col-action { width: auto; padding-top: 0.7rem; }
  .approvals td.col-action .btn { width: 100%; }
  .tok { align-items: flex-end; text-align: right; }

  /* Touch targets: 15px checkboxes and ~36px buttons are under the 44px floor,
     and the checkbox is how batch selection works. */
  .btn { min-height: 44px; }
  .btn-sm { min-height: 40px; }
  .col-check input, .check input { width: 22px; height: 22px; }

  /* select-all lives in the thead the card layout hides, so batch selection
     would need N individual taps. Surface it in the results header instead. */
  .select-all-mobile { display: flex; }

  /* The batch bar sits BEFORE the list in the DOM, so position:sticky bottom
     never engages — it has already been scrolled past. Fixed to the viewport
     also keeps it out of flow, so revealing it cannot shove the card list
     down under the user's finger. */
  .batch-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    margin: 0; border-radius: 0;
    border-left: none; border-right: none; border-bottom: none;
    padding: 0.8rem 1.1rem calc(0.8rem + env(safe-area-inset-bottom, 0px));
    background: var(--panel-2);
  }
  .batch-bar .btn { margin-left: 0; width: 100%; }
  /* Room so the last card is not trapped behind the fixed bar. */
  #results:has(#batch-bar:not(.hidden)) { padding-bottom: 8rem; }
}

/* ---- phones ------------------------------------------------------------- */
@media (max-width: 620px) {
  .hero { padding: 2.5rem 0 1.5rem; }
  .lookup { flex: 1 1 100%; }
  .results-actions { width: 100%; justify-content: space-between; flex-wrap: wrap; }

  /* Brand + pill + address button do not fit a 320px topbar. Hide every pill
     EXCEPT the wrong-network warning: `.pill.ok` alone missed the read-only
     pill (className is set to plain 'pill'), which then collapsed to a 69px
     column ~88px tall, burst the 62px bar and pushed the button off-screen. */
  .pill:not(.warn) { display: none; }
  .brand-text { font-size: 0.98rem; }
  .topbar-right { gap: 0.45rem; }

  /* The warning pill is the ONLY control that switches chain, and wrong-network
     is the default first-run state on mobile since PulseChain is not
     preconfigured in wallets. Give the wallet cluster its own row rather than
     letting the pill collapse to min-content and burst the header. */
  .topbar-inner.net-warn {
    flex-wrap: wrap; height: auto; min-height: 62px;
    row-gap: 0.45rem; padding-bottom: 0.5rem;
  }
  .topbar-inner.net-warn .topbar-right {
    flex: 1 0 100%; justify-content: flex-end;
  }
  #net-pill.warn { flex: 1 1 auto; min-width: 0; text-align: center; }

  /* Toasts must clear the fixed batch bar, and the container must never
     intercept taps meant for the button underneath it. */
  .toasts {
    bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px));
    left: 1.2rem; pointer-events: none;
  }
  .toast { max-width: 100%; pointer-events: auto; }
  body:has(#batch-bar:not(.hidden)) .toasts {
    bottom: calc(6.5rem + env(safe-area-inset-bottom, 0px));
  }
}

/* ---- very narrow (320px Android, Galaxy Fold cover) --------------------- */
@media (max-width: 380px) {
  /* .lookup measured 302px inside a 280px container, clipping the Check button
     and giving the page a horizontal scroll on first load. */
  .lookup { flex-wrap: wrap; }
  .lookup input, .lookup .btn { flex: 1 1 100%; }
  .stat-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
