:root {
  --bg: #10110f;
  --bg-2: #181914;
  --ink: #f3efe4;
  --muted: #9b9588;
  --line: rgba(243, 239, 228, 0.12);
  --gold: #e4c27a;
  --gold-deep: #b8893e;
  --danger: #e38b7b;
  --ok: #b7d3a8;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(228, 194, 122, 0.08), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: "Noto Sans SC", "Noto Sans Thai", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

html[lang="th"] body { font-family: "Noto Sans Thai", "Noto Sans SC", sans-serif; }
html[lang="th"] .brand h1 { font-family: "Noto Serif Thai", "Noto Sans Thai", serif; letter-spacing: 0; }
html[lang="en"] .brand h1 { letter-spacing: 0; }

button, input { font: inherit; color: inherit; }

.page {
  width: min(560px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: 16px;
  row-gap: 12px;
  margin-bottom: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
  min-width: max-content;
}

.brand h1 {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.25;
  white-space: nowrap;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.mark {
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--gold);
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px var(--bg), inset 0 0 0 5px var(--gold);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  margin-left: auto;
}

.langs {
  display: flex;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.langs button {
  border: 0;
  background: transparent;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}

.langs button[aria-pressed="true"] {
  background: var(--gold);
  color: #231b0d;
}

.network, .wallet {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  white-space: nowrap;
}

.network { color: var(--gold); }

.wallet { cursor: pointer; }
.wallet:hover { border-color: rgba(228, 194, 122, 0.5); }

.slip {
  background: linear-gradient(180deg, rgba(255,255,255,0.025), transparent 80px), var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 28px 24px 22px;
}

.field-label {
  display: block;
  margin: 18px 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.field-label:first-child { margin-top: 0; }

.amount-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.amount-row input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 56px;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.amount-row input::placeholder { color: rgba(243, 239, 228, 0.22); }

.unit {
  color: var(--gold);
  font-size: 14px;
  letter-spacing: 0.08em;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.chips button {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--muted);
  cursor: pointer;
}

.chips button:hover,
.chips button[aria-pressed="true"] {
  color: var(--ink);
  border-color: rgba(228, 194, 122, 0.55);
}

#contract {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}

#contract:focus { border-color: rgba(228, 194, 122, 0.65); }

.meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 18px 0 0;
}

.meta div {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.meta dt {
  color: var(--muted);
  font-size: 12px;
}

.meta dd {
  margin: 6px 0 0;
  font-size: 14px;
  word-break: break-all;
}

.submit {
  width: 100%;
  margin-top: 20px;
  border: 0;
  border-radius: 14px;
  padding: 15px 16px;
  background: var(--gold);
  color: #231b0d;
  font-weight: 600;
  cursor: pointer;
}

.submit:disabled {
  cursor: not-allowed;
  background: #3a372f;
  color: #8d877b;
}

.submit:not(:disabled):hover { background: #efd092; }

.status {
  min-height: 1.4em;
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.status a { color: var(--gold); }
.status.error { color: var(--danger); }
.status.ok { color: var(--ok); }

.note {
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

@media (max-width: 640px) {
  .topbar { align-items: flex-start; }
  .brand h1 { font-size: 24px; }
  .amount-row input { font-size: 42px; }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
  .meta { grid-template-columns: 1fr; }
}
