:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --primary: #e5b65d;
  --primary-400: #c99838;
  --primary-100: #4a3214;
  --primary-500: #fdf0d0;
  --background: #f8f8f8;
  --surface: #fff;
  --main: #131313;
  --muted: #4a4a4a;
  --border: #d1d1d1;
  --success: #17603a;
  --error: #a72c27;
}

* { box-sizing: border-box; }
html { background: var(--surface); }
body { margin: 0; min-width: 280px; min-height: 100vh; color: var(--main); background: var(--surface); }
button, input { font: inherit; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--primary-100); outline-offset: 3px; }
[hidden] { display: none !important; }

.site-header { border-bottom: 1px solid var(--border); }
.header-inner { min-height: 64px; padding: 11px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; flex: none; }
.brand img { display: block; width: min(174px, 45vw); height: auto; }
.header-label { color: var(--muted); font-size: 11px; text-align: right; }

.content { padding: 28px 20px calc(32px + env(safe-area-inset-bottom)); }
.content-inner { width: 100%; max-width: 480px; margin: 0 auto; }
h1 { margin: 0 0 12px; color: var(--main); font-size: 28px; font-weight: 650; line-height: 1.2; letter-spacing: -.025em; }
.intro { margin: 0 0 22px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.notice { margin: 0 0 22px; border-left: 3px solid var(--primary-400); padding: 10px 12px; background: var(--primary-500); color: var(--primary-100); font-size: 12px; line-height: 1.5; }

.steps { display: flex; gap: 9px; list-style: none; padding: 0; margin: 0 0 26px; }
.steps li { flex: 1; border-top: 2px solid var(--border); padding-top: 8px; color: var(--muted); font-size: 11px; }
.steps li[aria-current="step"] { border-color: var(--primary-400); color: var(--main); font-weight: 700; }
.summary { margin: 0 0 24px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.summary div { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid #e0e0e0; }
.summary div:last-child { border-bottom: 0; }
.summary dt { flex: none; color: var(--muted); font-size: 12px; }
.summary dd { margin: 0; max-width: 65%; color: var(--main); text-align: right; font-size: 14px; font-weight: 650; overflow-wrap: anywhere; }
.summary dd small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; font-weight: 400; }
.summary .limit { padding: 8px 0; }
.summary .limit dt, .summary .limit dd { color: var(--muted); font-size: 12px; font-weight: 500; }
.summary .amount dd { font-size: 22px; font-weight: 750; }
.monthly-limit { margin-top: -12px; padding: 10px 0 24px; }
.monthly-heading { display: flex; justify-content: space-between; gap: 8px; color: var(--main); font-size: 12px; }
.monthly-heading strong { font-size: 12px; font-weight: 650; }
.monthly-track { display: block; width: 100%; height: 12px; margin-top: 10px; overflow: hidden; border-radius: 10px; }
.monthly-track .month-remaining { fill: #e7e7e7; }
.monthly-track .month-used { fill: #34495e; }
.monthly-track .month-current { fill: var(--primary-400); }
.monthly-legend { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; margin-top: 9px; color: var(--muted); font-size: 11px; }
.monthly-legend span { white-space: nowrap; }
.legend-dot { display: inline-block; width: 8px; height: 8px; margin-right: 4px; border-radius: 50%; }
.legend-dot.used { background: #34495e; }
.legend-dot.current { background: var(--primary-400); }
.primary { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 52px; border: 0; border-radius: 8px; background: var(--primary-400); color: var(--main); font-size: 15px; font-weight: 700; text-decoration: none; cursor: pointer; }
.primary:disabled { opacity: .55; cursor: not-allowed; }
.primary:hover:not(:disabled) { background: var(--primary); }
.secondary { display: block; border: 0; background: transparent; color: var(--main); font-size: 14px; font-weight: 650; margin: 13px auto 0; padding: 11px 18px; text-align: center; cursor: pointer; text-decoration: underline; text-decoration-color: var(--primary-400); text-underline-offset: 5px; }
.code-label { display: block; font-size: 13px; font-weight: 650; margin: 0 0 8px; }
.code-field { display: block; width: 100%; min-height: 52px; border: 0; border-bottom: 1px solid var(--border); padding: 10px 0; background: var(--surface); color: var(--main); font-size: 16px; letter-spacing: .12em; margin-bottom: 20px; }
.code-field:focus { border-color: var(--primary-400); }
.code-field[aria-invalid="true"] { border-color: var(--error); border-bottom-width: 2px; }
.field-error { margin: -10px 0 15px; color: var(--error); font-size: 13px; line-height: 1.4; }
.field-status { margin: 10px 0 15px; color: var(--primary-100); font-size: 13px; line-height: 1.4; }
.resend { display: block; min-height: 44px; margin: 12px auto 0; padding: 8px; border: 0; background: none; color: var(--main); font-size: 14px; text-decoration: underline; text-decoration-color: var(--primary-400); text-underline-offset: 4px; cursor: pointer; }
.resend:disabled { color: var(--muted); text-decoration: none; cursor: not-allowed; }

.result-panel { margin-bottom: 24px; border-left: 4px solid; border-radius: 6px; padding: 20px 16px; }
.result-panel h1 { color: inherit; margin: 10px 0 0; }
.result-panel .intro { color: inherit; margin: 8px 0 0; }
.result-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: #fff; font-size: 24px; font-weight: 700; }
.result-success { background: #eaf5ed; color: var(--success); border-color: var(--success); }
.result-success .result-icon { background: var(--success); }
.result-error { background: #fdf0ef; color: var(--error); border-color: var(--error); }
.result-error .result-icon { background: var(--error); }
.unknown-status { border-left: 4px solid var(--primary-400); padding-left: 12px; }

@media (min-width: 768px) {
  html, body { background: var(--background); }
  .page { max-width: 720px; min-height: 100vh; margin: 0 auto; background: var(--surface); }
  .header-inner { padding: 16px 40px; }
  .content { padding: 48px 40px 70px; }
}
