:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --text: #172026;
  --muted: #65727c;
  --line: #d9e0e4;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --danger: #a43131;
  --soft: #edf7f5;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(900px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 48px 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 18px 42px rgb(23 32 38 / 0.08);
}

.topbar {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1.05;
  letter-spacing: 0;
}

p {
  margin: 8px 0 0;
  color: var(--muted);
}

.status {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--muted);
  font-size: 13px;
  background: #fbfcfc;
}

.field {
  display: grid;
  gap: 8px;
  font-weight: 650;
}

.field span {
  font-size: 14px;
}

textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  color: var(--text);
  font: inherit;
  outline: none;
}

textarea {
  min-height: 168px;
  resize: vertical;
  padding: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}

select {
  height: 44px;
  padding: 0 12px;
}

textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(15 118 110 / 0.14);
}

.row {
  display: grid;
  grid-template-columns: minmax(150px, 200px) minmax(180px, 1fr);
  gap: 14px;
  align-items: end;
  margin-top: 16px;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: wait;
  opacity: 0.64;
}

.ghost {
  background: #e7efed;
  color: var(--accent-strong);
}

.ghost:hover {
  background: #dbe8e5;
}

.result {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  margin-top: 24px;
  padding: 18px;
  border: 1px solid #bddad5;
  border-radius: 8px;
  background: var(--soft);
}

.result-label {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(44px, 12vw, 72px);
  line-height: 1;
  font-weight: 850;
  letter-spacing: 0;
  color: var(--accent-strong);
}

.updated-token {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.updated-token textarea {
  min-height: 104px;
}

.notice {
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff8e6;
  border: 1px solid #eadca8;
  color: #66500b;
  font-size: 14px;
}

.message {
  min-height: 22px;
  margin-top: 16px;
}

.message.error {
  color: var(--danger);
}

.message.ok {
  color: var(--accent-strong);
}

@media (max-width: 640px) {
  .shell {
    width: min(100vw - 20px, 900px);
    padding: 18px 0;
  }

  .panel {
    padding: 18px;
  }

  .topbar,
  .row,
  .result {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .status {
    justify-self: start;
  }
}
