:root {
  color-scheme: light;
  --canvas: #f0effa;
  --paper: #fff;
  --ink: #211e3b;
  --muted: #625e76;
  --line: #dedbeb;
  --accent: #5036a9;
  --accent-dark: #41288e;
  --light-accent: #eee8ff;
  --result: #24203c;
  --result-line: #4a4264;
  --result-muted: #c4bbd8;
  --result-code: #f4edff;
  --display: "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --digits: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-family: var(--display);
  color: var(--ink);
  background: var(--canvas);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #9271e5; outline-offset: 3px; }

.shell {
  max-width: 1032px;
  margin-inline: auto;
  padding: clamp(42px, 8vh, 104px) 28px 30px;
}

.masthead { margin-bottom: 30px; }
.brand-mark { display: block; border-radius: 12px; }
.masthead h1 {
  margin: 14px 0 6px;
  font-size: clamp(34px, 5vw, 51px);
  letter-spacing: -.045em;
  line-height: 1.18;
  font-weight: 800;
}
.masthead p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .94fr);
  gap: 16px;
  align-items: start;
}
.panel { min-width: 0; border-radius: 22px; padding: 27px 28px; }
.panel h2 { margin: 0; font-size: 21px; line-height: 1.4; }
.source {
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 5px 16px #211e3b08;
}
.source label { display: block; margin: 19px 0 7px; font-size: 14px; font-weight: 600; }
.input-row { display: flex; gap: 8px; }
.input-row input {
  flex: 1;
  width: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 12px;
  color: var(--ink);
  background: #fcfbff;
  min-height: 44px;
  font-size: 16px;
}
.input-row input::placeholder { color: var(--muted); font-size: 14px; opacity: 1; }

.button {
  border: 1px solid transparent;
  border-radius: 9px;
  min-height: 38px;
  padding: 0 13px;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.3;
}
.primary { background: var(--accent); color: var(--paper); min-width: 64px; }
.primary:hover:not(:disabled) { background: var(--accent-dark); }
.primary:disabled { background: #e7e2f4; color: var(--muted); }

.separator { display: flex; gap: 12px; align-items: center; margin: 14px 0; color: var(--muted); font-size: 12px; }
.separator::before, .separator::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.drop-area {
  background: #faf8ff;
  border: 1px dashed #c3b9dd;
  border-radius: 13px;
  padding: 16px 10px 13px;
  text-align: center;
}
.drop-area[data-dragging] { border-color: var(--accent); background: var(--light-accent); }
.qr-mark {
  width: 24px;
  height: 24px;
  margin-inline: auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
  color: var(--accent);
}
.qr-mark i { border: 2px solid currentColor; border-radius: 2px; }
.qr-mark i:last-child { background: currentColor; margin: 2px 0 0 2px; }
.drop-area p { margin: 7px 0 8px; font-size: 14px; font-weight: 650; }
.image-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 5px; }
.secondary { background: var(--light-accent); color: var(--accent-dark); }
.secondary:hover:not(:disabled) { background: #e2d6fc; }
.ghost { background: transparent; color: var(--accent-dark); }
.ghost:hover:not(:disabled) { background: var(--light-accent); }

.notice {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
  margin: 11px 0 0;
}
.notice[data-error] { color: #962343; }

.result {
  display: grid;
  align-content: start;
  background: var(--result);
  color: var(--result-code);
  box-shadow: 0 9px 23px #29204423;
}
.result-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.clear { min-height: 34px; background: transparent; color: var(--result-code); border-color: var(--result-line); }
.clear:hover:not(:disabled) { background: var(--result-line); }
.clear:disabled { color: var(--result-muted); opacity: .65; }
.account {
  margin: 9px 0 -7px;
  color: var(--result-muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.code {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(11px, 2.2vw, 26px);
  margin: 17px 0 16px;
  min-height: 83px;
  padding: 0 8px;
  border-block: 1px solid var(--result-line);
  font: 650 clamp(30px, 5.2vw, 57px)/1 var(--digits);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.04em;
  user-select: all;
}
.code[data-ready="false"] { color: #a397c0; user-select: none; }
.timer-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--result-muted); font-size: 13px; }
#remaining { font-family: var(--digits); color: var(--result-code); white-space: nowrap; }
.timer progress {
  display: block;
  appearance: none;
  border: 0;
  width: 100%;
  height: 5px;
  margin-top: 9px;
  border-radius: 9px;
  overflow: hidden;
  background: var(--result-line);
  color: #ba9cf9;
}
.timer progress::-webkit-progress-bar { background: var(--result-line); }
.timer progress::-webkit-progress-value { background: #ba9cf9; }
.timer progress::-moz-progress-bar { background: #ba9cf9; }
.timer[data-ending] #remaining { color: #ffd3b9; }
.timer[data-ending] progress::-webkit-progress-value { background: #ffd3b9; }
.timer[data-ending] progress::-moz-progress-bar { background: #ffd3b9; }
.copy {
  width: 100%;
  margin-top: 22px;
  background: #ebe2ff;
  color: #312050;
  min-height: 44px;
}
.copy:hover:not(:disabled) { background: #dacbff; }
.copy:disabled { background: #3a3351; color: var(--result-muted); }
.copy-feedback { margin: 7px 0 0; min-height: 18px; font-size: 12px; color: var(--result-muted); }
.privacy { margin-top: 19px; color: var(--muted); font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 690px) {
  .shell { max-width: 510px; padding: 29px 16px 24px; }
  .masthead { margin-bottom: 23px; }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .panel { padding: 19px; border-radius: 17px; }
  .code { font-size: clamp(39px, 10.5vw, 56px); }
  .copy-feedback:empty { min-height: 0; margin: 0; }
}
