:root {
  color-scheme: light;
  --bg: #f6f8f5;
  --text: #17211b;
  --muted: #617066;
  --line: #d9e2db;
  --panel: #ffffff;
  --accent: #1c7c54;
  --accent-dark: #115d3d;
  --blue: #315f87;
  --warn-bg: #fff6d7;
  --warn-text: #614a00;
  --error-bg: #fbe6e2;
  --error-text: #872b1f;
  --success-bg: #e4f4ec;
  --success-text: #155c3b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(28, 124, 84, 0.07), transparent 38%),
    linear-gradient(180deg, #ffffff 0, var(--bg) 42%);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

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

.masthead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 0 0 28px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(34px, 6vw, 64px);
  line-height: 1;
}

h2 {
  font-size: 22px;
}

.status-strip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  color: var(--muted);
  white-space: nowrap;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #9aa79f;
}

.dot.ready {
  background: var(--accent);
}

.dot.error {
  background: #b33b2f;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  padding: 28px 0;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 48px rgba(25, 38, 31, 0.07);
}

.request-panel {
  padding: 24px;
}

label {
  display: block;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.address-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.turnstile-row {
  margin-top: 16px;
  min-height: 65px;
}

.turnstile-row[hidden] {
  display: none;
}

input {
  width: 100%;
  min-height: 52px;
  border: 1px solid #c8d3cc;
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  background: #fbfdfc;
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(28, 124, 84, 0.12);
}

button {
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

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

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

.feedback {
  min-height: 48px;
  margin-top: 16px;
  padding: 12px;
  border-radius: 8px;
  color: var(--muted);
  background: #f3f6f4;
  overflow-wrap: anywhere;
}

.feedback.error {
  color: var(--error-text);
  background: var(--error-bg);
}

.feedback.success {
  color: var(--success-text);
  background: var(--success-bg);
}

.details-panel {
  padding: 18px;
}

dl {
  margin: 0;
  display: grid;
  gap: 12px;
}

dl div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

dl div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

dt {
  color: var(--muted);
  font-size: 13px;
}

dd {
  margin: 0;
  max-width: 180px;
  text-align: right;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.result {
  display: grid;
  gap: 12px;
  padding: 24px;
}

.result[hidden] {
  display: none;
}

.result a {
  color: var(--blue);
  overflow-wrap: anywhere;
}

.result p {
  margin: 0;
  color: var(--muted);
}

.return {
  display: grid;
  gap: 14px;
  padding: 24px;
}

.return p {
  margin: 0;
  color: var(--muted);
  max-width: 760px;
}

.copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.copy-row code {
  min-height: 46px;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  overflow-wrap: anywhere;
}

.copy-row button {
  min-height: 46px;
}

.copy-feedback {
  min-height: 0;
  margin-top: 0;
  padding: 8px 10px;
}

.history {
  margin-top: 24px;
  padding: 24px;
}

.history-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

#history-count {
  display: inline-grid;
  min-width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-weight: 800;
}

.history-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-item,
.history-empty {
  display: grid;
  gap: 8px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.history-empty {
  color: var(--muted);
}

.history-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
}

.history-amount {
  font-weight: 800;
}

.history-status {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: capitalize;
  white-space: nowrap;
}

.history-status.confirmed {
  color: var(--success-text);
  background: var(--success-bg);
  border-color: transparent;
}

.history-status.unconfirmed {
  color: var(--warn-text);
  background: var(--warn-bg);
  border-color: transparent;
}

.history-times {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.history-times time {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.history-address,
.history-tx {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.history-address {
  color: var(--text);
}

.history-tx {
  color: var(--blue);
  text-decoration: none;
}

.history-tx:hover {
  text-decoration: underline;
}

.warning {
  padding: 12px;
  border-radius: 8px;
  color: var(--warn-text);
  background: var(--warn-bg);
  overflow-wrap: anywhere;
}

@media (max-width: 820px) {
  .shell {
    width: min(100vw - 24px, 680px);
    padding: 24px 0;
  }

  .masthead,
  .workspace,
  .address-row {
    grid-template-columns: 1fr;
  }

  .masthead {
    display: grid;
    align-items: start;
  }

  .status-strip {
    justify-content: flex-start;
    white-space: normal;
  }

  button {
    width: 100%;
  }

  .copy-row {
    grid-template-columns: 1fr;
  }

  .history-top {
    display: grid;
    gap: 4px;
  }
}
