:root {
  color-scheme: light;
  --base: #f3f5ec;
  --paper: #fcfdf8;
  --ink: #162b23;
  --muted: #52645d;
  --line: #d6dfd4;
  --field: #f2f5ef;
  --action: #234b3b;
  --accent: #dff2ab;
  --error: #972c20;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--base);
  color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: inherit; }
button, textarea { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #618543; outline-offset: 4px; }

.shell { width: min(100% - 48px, 740px); margin-inline: auto; }
.top { display: flex; justify-content: space-between; align-items: center; min-height: 77px; border-bottom: 1px solid var(--line); }
.wordmark { display: inline-flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 750; text-decoration: none; }
.mark { display: block; border-radius: 10px; width: 34px; height: 34px; }
.history-link { font-size: 14px; text-decoration: none; color: var(--muted); padding-block: 12px; }
.history-link span { margin-inline-start: 3px; }
.history-link:hover { text-decoration: underline; }

.intro { padding: 68px 0 30px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(44px, 9vw, 70px); line-height: 1.06; letter-spacing: -.065em; font-weight: 780; }
.intro p { margin-top: 16px; max-width: 32em; color: var(--muted); font-size: 16px; line-height: 1.7; }
.composer { padding: 24px; background: var(--paper); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 3px 0 #162b2308; }
.form-header, .form-footer, .history-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.form-header { min-height: 33px; margin-bottom: 9px; }
.form-header label { font-size: 15px; font-weight: 700; }
.paste { background: transparent; color: var(--action); padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 14px; }
textarea { width: 100%; min-height: 118px; resize: vertical; border-radius: 12px; border: 1px solid var(--line); padding: 13px 14px; line-height: 1.6; font-size: 16px; color: var(--ink); background: var(--field); }
textarea::placeholder { color: #5b6d60; }
.form-footer { margin-top: 14px; }
.form-footer p { font-size: 13px; color: var(--muted); line-height: 1.5; }
.primary { display: inline-flex; justify-content: space-between; gap: 22px; align-items: center; min-height: 46px; border: 1px solid transparent; border-radius: 10px; padding: 10px 15px; background: var(--action); color: #fff; font-weight: 680; white-space: nowrap; }
.primary:hover { background: #183b2d; }
button:disabled { opacity: .7; cursor: wait; }
#submit { position: relative; overflow: hidden; }
#submit.is-progress { justify-content: center; min-width: 151px; opacity: 1; background: var(--action); }
.submit-label { position: relative; }
.submit-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: #4b7560; transition: width .24s ease; }
.is-indeterminate .submit-fill { width: 38%; animation: submit-sweep 1.5s ease-in-out infinite; transition: none; }
@keyframes submit-sweep { from { transform: translateX(-100%); } to { transform: translateX(264%); } }
@media (prefers-reduced-motion: reduce) {
  .submit-fill { transition: none; }
  .is-indeterminate .submit-fill { animation: none; }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.feedback { margin-top: 12px; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.feedback:empty { display: none; }
.feedback.error, .job-error { color: var(--error); }
.history { padding-block: 42px; scroll-margin-top: 15px; }
.history-header { border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.history-header h2 { font-size: 21px; }
.history-header span { font-size: 13px; color: var(--muted); }
.empty { padding: 21px 0; color: var(--muted); font-size: 14px; }
.jobs { list-style: none; margin: 0; padding: 0; }
.jobs li { border-bottom: 1px solid var(--line); }
.job-entry { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 12px; min-height: 54px; padding: 8px 2px; text-align: left; color: inherit; }
button.job-entry { border: 0; background: transparent; }
button.job-entry:hover { background: var(--field); }
.job-entry > span:first-child { min-width: 0; }
.job-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; font-size: 15px; font-weight: 650; line-height: 1.35; }
.job-detail { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.job-detail.job-error { color: var(--error); }
.play-indicator { flex: none; padding-inline: 5px; color: var(--action); font-size: 13px; }
progress { display: block; width: 100%; height: 5px; margin: 0 0 6px; accent-color: var(--action); }
dialog { box-sizing: border-box; width: min(100% - 32px, 680px); padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); color: var(--ink); }
dialog::backdrop { background: #162b2366; }
.player-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.player-header h2 { font-size: 16px; line-height: 1.45; overflow-wrap: anywhere; }
.player-header button { flex: none; }
#player-video { display: block; width: 100%; max-height: 70dvh; border-radius: 10px; background: #111; }

@media (max-width: 520px) {
  .shell { width: calc(100% - 36px); }
  .top { min-height: 65px; }
  .intro { padding: 44px 0 22px; }
  .intro p { font-size: 15px; }
  .composer { padding: 16px; border-radius: 16px; }
  .form-footer { flex-direction: column; align-items: stretch; }
  .primary { justify-content: center; gap: 10px; min-height: 48px; }
  .history { padding-top: 27px; }
}

.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(100%, 358px); padding: clamp(20px, 6vw, 30px); text-align: center; }
.login-icon { display: block; margin: 0 auto 14px; border-radius: 16px; }
.login-card h1 { font-size: 40px; line-height: 1.15; }
.login-instruction { margin-top: 10px; color: var(--muted); font-size: 15px; }
.pin-slots { display: flex; justify-content: center; gap: 10px; margin: 18px 0 6px; }
.pin-slots span { display: grid; place-items: center; width: 40px; height: 44px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); }
.pin-slots .filled { border-color: var(--action); }
.pin-slots .filled::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--action); }
.pin-status { min-height: 25px; color: var(--error); font-size: 14px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.keypad button { min-height: 51px; touch-action: manipulation; border: 1px solid var(--line); border-radius: 12px; background: var(--field); color: var(--ink); font-size: 23px; font-weight: 650; }
.keypad button:hover, .keypad button:active { background: var(--accent); }
.keypad .key-secondary { font-size: 15px; color: var(--muted); }
