:root {
  color-scheme: light;
  --ink: #16281f;
  --muted: #68766f;
  --line: #d9e2dc;
  --paper: #fffef9;
  --canvas: #edf2ed;
  --green: #136f48;
  --green-dark: #0d5336;
  --green-soft: #e8f3ec;
  --amber: #b26120;
  --shadow: 0 26px 70px rgba(28, 48, 38, .12);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(255,255,255,.3) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.3) 1px, transparent 1px),
    var(--canvas);
  background-size: 28px 28px;
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
}

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

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

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
  padding: 13px 16px;
  background: rgba(255, 254, 249, .82);
  border: 1px solid rgba(22, 40, 31, .08);
  border-radius: 7px 18px 7px 18px;
  backdrop-filter: blur(10px);
}

.header-brand { display: flex; align-items: center; gap: 12px; }
.header-brand h1 { margin: 0; font-size: 21px; line-height: 1.2; }
.header-brand p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

.privacy-badge {
  flex: none;
  padding: 7px 10px;
  color: var(--green);
  background: var(--green-soft);
  border: 1px solid #c2d9ca;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 750;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  aspect-ratio: 1;
  color: #fff;
  background: var(--green);
  border-radius: 11px 3px 11px 3px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 4px 4px 0 #c5d9cc;
}

.step, .result-label {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.trust-line {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 16px;
  padding: 12px 15px;
  color: #486055;
  background: rgba(232, 243, 236, .8);
  border-left: 3px solid var(--green);
  border-radius: 4px;
}
.trust-line svg { flex: none; width: 22px; height: 22px; fill: var(--green); }
.trust-line p { margin: 0; font-size: 13px; line-height: 1.6; }

.tool-card {
  padding: clamp(24px, 5vw, 48px);
  background: var(--paper);
  border: 1px solid rgba(22, 40, 31, .08);
  border-radius: 8px 32px 8px 32px;
  box-shadow: var(--shadow);
}

.section-heading { display: flex; justify-content: space-between; align-items: start; gap: 16px; margin-bottom: 30px; }
h2 { margin: 0; font-family: Georgia, "Noto Serif SC", serif; font-size: clamp(24px, 4vw, 32px); }
.status { flex: none; padding: 8px 11px; border: 1px solid #bcd4c5; border-radius: 99px; color: var(--green); font-size: 12px; font-weight: 700; }
.status i { display: inline-block; width: 7px; height: 7px; margin-right: 6px; background: #1dab67; border-radius: 50%; }

label { display: block; margin-bottom: 9px; font-size: 14px; font-weight: 750; }
input {
  width: 100%;
  min-height: 50px;
  padding: 0 15px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #aebdb4;
  border-radius: 6px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(19,111,72,.14); }
.secret-row { display: grid; grid-template-columns: 1fr auto; }
.secret-row input { border-radius: 6px 0 0 6px; }
.icon-button { min-width: 70px; color: var(--green); background: var(--green-soft); border: 1px solid #aebdb4; border-left: 0; border-radius: 0 6px 6px 0; font-weight: 750; }
.field-hint { margin: 9px 0 0; color: var(--muted); font-size: 12px; }

details { margin-top: 22px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
summary { padding: 15px 0; color: var(--green); font-size: 14px; font-weight: 750; cursor: pointer; }
.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 0 0 18px; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.actions button { min-height: 44px; padding: 0 18px; border-radius: 5px; font-weight: 800; }
.primary { color: #fff; background: var(--green); border: 1px solid var(--green); box-shadow: 0 6px 16px rgba(19,111,72,.2); }
.primary:hover { background: var(--green-dark); }
.secondary { color: var(--green); background: transparent; border: 1px solid var(--green); }
.secondary:disabled { color: #97a29c; border-color: #cbd3ce; cursor: not-allowed; }
.text-button { margin-left: auto; color: var(--muted); background: transparent; border: 1px solid transparent; }
.text-button:hover { color: #a33b2d; }

.message { margin-top: 20px; padding: 13px 15px; color: #8a2c21; background: #fff0ed; border-left: 3px solid #c85141; }
.result { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 24px; margin-top: 32px; padding-top: 30px; border-top: 1px solid var(--line); }
.code { display: flex; align-items: baseline; gap: 16px; padding: 0; color: var(--ink); background: none; border: 0; }
.code span { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: clamp(42px, 9vw, 68px); font-weight: 700; letter-spacing: .1em; line-height: 1; }
.code small { color: var(--green); white-space: nowrap; }
.timer-area { position: relative; display: grid; place-items: center; width: 116px; height: 116px; }
.timer-copy { position: absolute; display: grid; place-items: center; z-index: 1; color: var(--muted); font-size: 11px; }
.timer-copy strong { margin-top: 3px; color: var(--ink); font-size: 16px; }
.ring { width: 116px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 6; }
.ring-track { stroke: #e5ebe7; }
.ring-progress { stroke: var(--green); stroke-linecap: round; stroke-dasharray: 188.5; transition: stroke-dashoffset .3s linear; }

.qr-panel { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-top: 28px; padding: 22px; background: var(--green-soft); border-radius: 6px 18px 6px 18px; }
.qr-panel p:not(.result-label) { max-width: 420px; margin: 0; color: var(--muted); line-height: 1.6; }
.qr-panel img { padding: 8px; background: #fff; border: 1px solid #c7d8cd; }

.history-panel { margin-top: 30px; padding-top: 26px; border-top: 1px solid var(--line); }
.history-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.history-heading h3 { margin: 0; font-family: Georgia, "Noto Serif SC", serif; font-size: 22px; }
.danger-button { padding: 8px 12px; color: #a33b2d; background: #fff7f5; border: 1px solid #dfb9b2; border-radius: 5px; font-size: 12px; font-weight: 750; }
.danger-button:disabled { color: #9da6a1; background: transparent; border-color: #d6ddd9; cursor: not-allowed; }
.history-empty { margin: 18px 0 0; padding: 18px; color: var(--muted); background: #f4f6f4; border: 1px dashed #c7d1cb; border-radius: 6px; font-size: 13px; text-align: center; }
.history-list { display: grid; gap: 9px; margin: 18px 0 0; padding: 0; list-style: none; }
.history-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 13px 14px; background: #f7faf8; border: 1px solid #c9d9cf; border-radius: 6px; }
.history-main { min-width: 0; }
.history-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.history-secret { overflow: hidden; color: var(--ink); font-family: ui-monospace, Consolas, monospace; font-size: 14px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.history-actions { display: flex; gap: 7px; }
.history-actions button { min-height: 34px; padding: 0 10px; border-radius: 4px; font-size: 12px; font-weight: 750; }
.history-use { color: #fff; background: var(--green); border: 1px solid var(--green); }
.history-delete { color: #a33b2d; background: transparent; border: 1px solid #d8b4ae; }

.notice { display: grid; grid-template-columns: auto 1fr; gap: 14px; margin: 22px 0 0; padding: 18px 20px; color: #5f4b2f; background: #f8f0dd; border: 1px solid #e8d8b7; border-radius: 6px; }
.notice p { margin: 0; line-height: 1.6; }
footer { padding: 25px 0; color: #829087; font-family: ui-monospace, Consolas, monospace; font-size: 12px; text-align: center; }

@media (max-width: 640px) {
  .shell { padding-top: 14px; }
  .app-header { align-items: flex-start; }
  .privacy-badge { display: none; }
  .section-heading { display: block; }
  .status { display: inline-block; margin-top: 14px; }
  .meta-grid, .result { grid-template-columns: 1fr; }
  .timer-area { width: 92px; height: 92px; }
  .ring { width: 92px; }
  .qr-panel { flex-direction: column; align-items: start; }
  .qr-panel img { width: 100%; max-width: 240px; height: auto; align-self: center; }
  .notice { grid-template-columns: 1fr; }
  .text-button { margin-left: 0; }
  .history-item { grid-template-columns: 1fr; }
  .history-actions button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
