:root {
  color-scheme: light;
  --ink: #16232d;
  --muted: #68747c;
  --line: #d8e0e4;
  --surface: #ffffff;
  --canvas: #f3f6f5;
  --accent: #087f72;
  --accent-dark: #075e56;
  --warm: #f0a35b;
  --shadow: 0 18px 44px rgba(27, 58, 58, 0.09);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 56px 0 72px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 34px; }
.eyebrow, .section-kicker { margin: 0 0 8px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: 0.14em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(34px, 5vw, 58px); line-height: 1; letter-spacing: 0; }
h2 { margin-bottom: 0; font-size: 21px; line-height: 1.2; }
.subtitle { max-width: 560px; margin-bottom: 0; color: var(--muted); font-size: 16px; line-height: 1.6; }
.meta-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.version-badge, .api-badge { display: inline-flex; align-items: center; min-height: 30px; color: var(--accent-dark); border: 1px solid #c6e3dc; border-radius: 5px; background: #e9f6f2; font-size: 12px; font-weight: 800; }
.version-badge { padding: 6px 9px; }
.api-badge { max-width: min(100%, 620px); padding-left: 9px; overflow: hidden; }
.api-badge-label { flex: 0 0 auto; margin-right: 7px; }
.api-badge code { min-width: 0; overflow: hidden; color: var(--ink); font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 11px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.icon-button { flex: 0 0 auto; min-height: 28px; margin-left: 8px; padding: 0 8px; color: var(--accent-dark); border: 0; border-left: 1px solid #c6e3dc; background: transparent; font-size: 11px; font-weight: 800; }
.icon-button:hover { color: var(--ink); background: rgba(255, 255, 255, 0.55); }
.status-dot { width: 12px; height: 12px; margin-top: 8px; border-radius: 50%; background: var(--warm); box-shadow: 0 0 0 7px rgba(240, 163, 91, 0.16); }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.panel { min-width: 0; padding: 26px; background: var(--surface); border: 1px solid rgba(216, 224, 228, 0.9); border-radius: 8px; box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.file-button { position: relative; display: inline-flex; align-items: center; padding: 9px 12px; color: var(--accent-dark); border: 1px solid var(--line); border-radius: 6px; background: #f8fbfa; font-size: 13px; font-weight: 700; white-space: nowrap; }
.file-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.source-switch { display: flex; gap: 4px; margin-bottom: 20px; padding: 4px; border-radius: 6px; background: #edf2f1; }
.switch-button { flex: 1; padding: 9px 12px; color: var(--muted); border: 0; border-radius: 4px; background: transparent; font-weight: 700; }
.switch-button.active { color: var(--ink); background: var(--surface); box-shadow: 0 2px 9px rgba(27, 58, 58, 0.08); }
.field { display: block; margin-bottom: 18px; }
.field > span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 12px; font-weight: 800; }
input, select, textarea { width: 100%; color: var(--ink); border: 1px solid var(--line); border-radius: 6px; background: #fbfcfc; outline: none; }
input, select { height: 44px; padding: 0 12px; }
textarea { resize: vertical; padding: 12px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(8, 127, 114, 0.12); }
.hidden { display: none; }
.options { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.actions, .result-actions { display: flex; align-items: center; gap: 12px; }
.result-actions { flex-wrap: wrap; }
.primary-button, .secondary-button { min-height: 42px; padding: 0 16px; border-radius: 6px; font-weight: 800; }
.primary-button { color: white; border: 1px solid var(--accent); background: var(--accent); }
.primary-button:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.primary-button:disabled { cursor: wait; opacity: 0.65; }
.secondary-button { color: var(--accent-dark); border: 1px solid var(--line); background: #f8fbfa; }
.secondary-button:not(:disabled):hover { border-color: var(--accent); }
.status { color: var(--muted); font-size: 13px; }
.status[data-tone="error"] { color: #b24747; }
.count { padding: 5px 8px; color: var(--accent-dark); border-radius: 4px; background: #e8f4f1; font-size: 12px; font-weight: 800; }
.result { min-height: 420px; margin-bottom: 14px; color: #24353c; background: #f7f9f8; font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 12px; }
.qr-panel { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 22px; padding: 18px; border: 1px solid #d8e9e4; border-radius: 8px; background: #f5fbf8; }
.qr-panel h3 { margin: 0 0 7px; font-size: 17px; }
.qr-expiry { margin: 0; color: var(--muted); font-size: 12px; }
.qrcode { flex: 0 0 auto; min-width: 180px; min-height: 180px; padding: 10px; background: white; }
.qrcode img { display: block; width: 180px; height: 180px; }
.privacy-note { margin: 17px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

@media (max-width: 820px) {
  .shell { width: min(100% - 28px, 620px); padding-top: 32px; }
  .workspace { grid-template-columns: 1fr; }
  .result { min-height: 300px; }
  .qr-panel { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 520px) {
  .shell { width: min(100% - 24px, 620px); padding-bottom: 40px; }
  .panel { padding: 19px; }
  .topbar { gap: 14px; margin-bottom: 24px; }
  h1 { font-size: 38px; }
  .subtitle { font-size: 14px; }
  .meta-strip { align-items: stretch; flex-direction: column; }
  .version-badge, .api-badge { width: 100%; }
  .api-badge { min-width: 0; }
  .actions { align-items: flex-start; flex-direction: column; }
  .primary-button, .actions .status { width: 100%; }
  .primary-button { min-height: 46px; }
  .result-actions { align-items: stretch; flex-direction: column; }
  .result-actions .secondary-button { width: 100%; }
  .qrcode { align-self: center; }
}
