/* ENS & .gwei renewal — minimal stylesheet, no framework. */

:root {
  color-scheme: light dark;
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1b1f24;
  --muted: #5c636b;
  --border: #d3d8de;
  --accent: #2b6cb0;
  --accent-fg: #ffffff;
  --ok: #237a3f;
  --error: #b3352b;
  --warn: #96690a;
  --warn-bg: #fdf3d7;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.09);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --card: #1e2227;
    --text: #e4e7ea;
    --muted: #99a0a8;
    --border: #3a4048;
    --accent: #5f9be0;
    --accent-fg: #10141a;
    --ok: #5cc97c;
    --error: #f2877c;
    --warn: #e0b95c;
    --warn-bg: #302a10;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Display styles below must never resurrect hidden elements. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2.5rem 1rem;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.card {
  /* Shrink-to-fit: hug the content, but stay at least the old 38rem wide when
     there is room (no jumpy narrow card), never exceed ~92vw on small screens,
     and cap at 44rem on huge ones. 44rem = ~39.6rem of content (a 66-char tx
     hash in <code> at ~0.6em/char) + 2×1.5rem padding + slack, so the full
     hash and the 42-char addresses fit on one line before the cap bites. */
  width: fit-content;
  min-width: min(100%, 38rem);
  max-width: min(92vw, 44rem);
  padding: 1.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  box-shadow: var(--shadow);
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* No breakpoint: when title + wallet area no longer fit on one line, the
     wallet area simply wraps onto its own line and gets the full row. */
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

/* min-width: 0 lets the flex item shrink below the address' intrinsic width
   so the label inside can ellipsize instead of overflowing. */
.wallet-area { min-width: 0; }

/* Full address is rendered by JS; scarcity is handled here — it ellipsizes
   only when the line genuinely cannot fit it. */
#account-label {
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

h1 { font-size: 1.25rem; margin: 0; }

button {
  font: inherit;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: 0.4rem;
  background: var(--accent);
  color: var(--accent-fg);
  cursor: pointer;
}
button:hover:not(:disabled) { filter: brightness(1.08); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

input[type="text"],
input[type="number"] {
  font: inherit;
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  background: var(--card);
  color: var(--text);
}
input:disabled { opacity: 0.5; cursor: not-allowed; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

label { display: block; font-weight: 600; margin: 0.8rem 0 0.25rem; }

fieldset { border: 0; margin: 0.9rem 0 0; padding: 0; }
legend { font-weight: 600; padding: 0; }

/* Method radios stack vertically. */
.radio { display: block; font-weight: 400; margin: 0.35rem 0; }
.radio input { margin-right: 0.4rem; }

.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--warn);
  border-radius: 0.4rem;
  background: var(--warn-bg);
  margin-bottom: 1rem;
}

.quote {
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  padding: 0.6rem 0.8rem;
  margin: 1rem 0;
  min-height: 2.6rem;
}
.quote p { margin: 0.25rem 0; }
/* The released-name warning is the only p.error — make it prominent. */
.quote p.error { font-weight: 600; }

#years-row { max-width: 10rem; }

.status { min-height: 1.4rem; margin: 0.75rem 0 0; overflow-wrap: break-word; }

.ok { color: var(--ok); }
.error { color: var(--error); }
.warn { color: var(--warn); }
.muted { color: var(--muted); }

.small { font-size: 0.875rem; margin: 0.35rem 0 0; }
/* The card may now grow wider than a comfortable prose measure, so bound the
   long hint text itself (~68ch) instead of the card. */
#method-hint { margin-top: 0.5rem; max-width: 68ch; }

footer { margin-top: 1.5rem; }
details { font-size: 0.8rem; color: var(--muted); }
summary { cursor: pointer; }
/* 80ch keeps "role: 0x…42-char address" on one line (needs ~37em at the 0.8rem
   details font size) while bounding the line length; break-word still wraps
   the address on narrow screens instead of scrolling. */
.contract-line { margin: 0.3rem 0; overflow-wrap: break-word; max-width: 80ch; }

a { color: var(--accent); }
.contract-line a,
.status a { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85em; }
