:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #eef1f7;
  background: #0e1118;
  --card: #171c27;
  --surface: #10141d;
  --line: #30394a;
  --muted: #a5b1c5;
  --accent: #b6f2d1;
  --accent-strong: #d2fbe4;
  --error: #ffc0b7;
  --radius: 22px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  background: radial-gradient(ellipse at 55% -12rem, #223746, transparent 42rem);
  -webkit-font-smoothing: antialiased;
}

main { margin-inline: auto; }
.share-shell { width: min(calc(100% - 32px), 660px); padding: clamp(24px, 7vw, 72px) 0 48px; }
.admin-shell { width: min(calc(100% - 48px), 1080px); padding: 38px 0 64px; }

h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.65rem, 4vw, 2.55rem); line-height: 1.13; letter-spacing: -.045em; overflow-wrap: anywhere; }
h2 { font-size: 1.12rem; line-height: 1.35; letter-spacing: -.015em; overflow-wrap: anywhere; }
h3 { font-size: 1rem; line-height: 1.35; }
p { line-height: 1.5; }
button, input, select { font: inherit; }

.brand { display: flex; align-items: center; gap: 12px; color: #d3dce9; font-size: .91rem; font-weight: 680; }
.brand-mark { position: relative; width: 34px; height: 34px; display: inline-block; flex: 0 0 auto; border-radius: 11px; background: #254235; color: var(--accent); }
.brand-mark::before { content: ""; position: absolute; left: 8px; top: 11px; width: 8px; height: 8px; border: 2px solid currentColor; border-radius: 50%; }
.brand-mark::after { content: ""; position: absolute; width: 9px; height: 5px; left: 17px; top: 16px; border-top: 2px solid currentColor; border-right: 2px solid currentColor; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.block { padding: 24px; }
.message { margin-top: 24px; padding: 27px; display: grid; align-content: start; justify-items: start; gap: 12px; }
.message p { color: var(--muted); font-size: .94rem; }

.share-shell > .message { margin-top: 0; }
.account-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding-bottom: 18px; }
.account-heading h1 { min-width: 0; }
#account > .card + .card { margin-top: 14px; }
.credential-row { margin-top: 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 11px 12px 11px 15px; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; }
.credential-label { margin-bottom: 3px; color: var(--muted); font-size: .76rem; }
.credential-text { font-size: .97rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; }

.code-card { background: linear-gradient(130deg, #17271f, #171c27 65%); border-color: #355344; }
.code-content { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; min-height: 62px; }
.code-content p { font-size: .85rem; }
.code-digits { color: var(--accent); font: 700 clamp(1.45rem, 6vw, 2.8rem)/1.15 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .06em; white-space: nowrap; margin: 2px 0 7px; }
.code-actions { margin-top: 16px; }
.timer {
  --sweep: 360deg;
  --ring: #94e5b8;
  position: relative;
  isolation: isolate;
  width: 62px;
  aspect-ratio: 1;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--ring) var(--sweep), #3c4b4a 0);
  border-radius: 50%;
  font-size: 1.01rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.timer::before { position: absolute; z-index: -1; inset: 4px; content: ""; border-radius: 50%; background: #19231f; }
.timer.ending { --ring: #f7c690; }
.timer.ending span { color: #f7c690; }

.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; padding: 8px 14px; border: 1px solid #45536a; border-radius: 10px; background: #242c3b; color: #f0f3fa; font-size: .89rem; font-weight: 650; text-decoration: none; cursor: pointer; }
.button:hover:not(:disabled) { border-color: #647791; background: #2d384b; }
.button.small { min-height: 34px; padding: 6px 10px; font-size: .78rem; }
.button.quiet { background: transparent; color: #c5d0e2; border-color: transparent; }
.button.primary { color: #142820; background: var(--accent); border-color: var(--accent); }
.button.primary:hover:not(:disabled) { color: #142820; background: var(--accent-strong); border-color: var(--accent-strong); }
.button:disabled { cursor: default; opacity: .55; }

.admin-header, .admin-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.admin-title { margin: 34px 0 20px; flex-wrap: wrap; }
.count { display: inline-block; font-size: .92rem; letter-spacing: 0; color: var(--muted); vertical-align: middle; margin-left: 5px; }
.admin-grid { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(0, 2.25fr); gap: 16px; align-items: start; }
.admin-grid > .message { min-height: 164px; margin-top: 0; }
.login-panel { max-width: 420px; margin: 32px auto 0; }
.login-panel h1 { font-size: 1.45rem; margin-bottom: 20px; }
.list-panel { padding: 14px; }
.list-panel p { margin: 12px 3px 4px; font-size: .88rem; }
.list-panel ul { list-style: none; display: grid; gap: 5px; margin: 10px 0 0; padding: 0; max-height: min(68vh, 720px); overflow: auto; }
.list-panel ul:empty { margin-top: 0; }
.account-option { width: 100%; background: transparent; border: 1px solid transparent; border-radius: 10px; color: inherit; text-align: left; padding: 10px; display: grid; gap: 4px; cursor: pointer; }
.account-option strong { font-size: .91rem; overflow-wrap: anywhere; }
.account-option:hover { background: #273040; }
.account-option[aria-pressed="true"] { background: #22352f; border-color: #436454; }
.account-meta { color: var(--muted); font-size: .76rem; }
.account-meta.online { color: var(--accent); }

.editor h2 { margin-bottom: 17px; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.stack, .editor-section { display: grid; gap: 13px; }
.editor-section { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 4px; }
.field { display: block; min-width: 0; color: #d5deed; font-size: .85rem; }
.field > input, .field > select, .field > div { margin-top: 6px; }
.field-grid, .parameter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.parameter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 10px; }
.inline-input { display: flex; gap: 4px; }
.inline-input input { min-width: 0; }
input:not([type="checkbox"]), select { width: 100%; min-width: 0; color: inherit; background: var(--surface); border: 1px solid #3b465d; border-radius: 9px; padding: 9px 11px; min-height: 39px; }
input::placeholder { color: #91a0b6; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
input[type="checkbox"], summary { cursor: pointer; }
input:focus-visible, button:focus-visible, a:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.check { display: flex; align-items: center; gap: 8px; align-self: start; font-size: .87rem; }
summary { color: #c0ccde; font-size: .86rem; }
.provider-note { color: #ffe1b6; background: #302820; padding: 9px 11px; font-size: .83rem; border-radius: 8px; }
.tone-muted { color: var(--muted); }
.tone-error { color: var(--error); font-size: .88rem; }

.toast { position: fixed; inset: auto 16px 18px auto; background: #22352f; border: 1px solid #486d5a; color: #e8fff0; border-radius: 12px; padding: 10px 13px; max-width: calc(100% - 32px); box-shadow: 0 8px 26px #0007; font-size: .88rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 720px) {
  .admin-shell { width: min(calc(100% - 32px), 620px); padding-top: 24px; }
  .admin-grid { grid-template-columns: minmax(0, 1fr); }
  .list-panel ul { max-height: 210px; }
}

@media (max-width: 460px) {
  .block, .message { padding: 17px; }
  .credential-row { grid-template-columns: minmax(0, 1fr); justify-items: start; gap: 8px; }
  .field-grid { grid-template-columns: minmax(0, 1fr); }
  .parameter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .parameter-grid .field:last-child { grid-column: 1 / -1; }
  .timer { width: 50px; }
}

@media (pointer: coarse) {
  .button, .button.small { min-height: 44px; }
  input:not([type="checkbox"]), select { min-height: 44px; font-size: 1rem; }
}
