:root {
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: #f5f3ed;
  color: #203129;
  font-synthesis: none;
}
.device-name-line{display:flex;align-items:baseline;flex-wrap:wrap;gap:6px 8px;min-width:0}
.receiver-maintenance{display:flex;flex-wrap:wrap;align-items:center;gap:4px 12px;margin-top:12px}.receiver-maintenance .small-note{margin:0}.receiver-maintenance a{font-size:13px}
.device-short-id{font-size:20px;color:#516a5e;white-space:nowrap}
.remembered-tag{font-size:12px;font-weight:600;background:#e6f2eb;color:#276346;border-radius:20px;padding:3px 9px;white-space:nowrap}
.connection-guide{margin:14px 0;padding:16px;border:1px solid #c6ddd0;border-radius:14px;background:#edf6ef}
.connection-guide strong{display:block;font-size:16px;margin-bottom:7px}
.connection-guide p{font-size:14px;line-height:1.7;margin-bottom:12px;color:#496354}
.device-manager{margin-top:20px;border-top:1px solid #dbe5df;padding-top:20px}
.device-manager .section-heading{margin-bottom:6px}
.device-manager h3{margin:0}.device-cards{display:grid;gap:10px;margin:14px 0}
.saved-device{display:flex;align-items:center;gap:8px;border:1px solid #d6e0d9;border-radius:13px;background:#fafbf9;padding:4px 12px 4px 4px}
.saved-device[data-selected="true"]{border:2px solid #38795b;background:#eff7f1;padding:3px 11px 3px 3px}
.saved-device-select{flex:1;min-width:0;background:none;border:0;padding:13px 10px;text-align:left;color:inherit;cursor:pointer}
.saved-device-select strong,.saved-device-select span{display:block;overflow-wrap:anywhere}.saved-device-select strong{font-size:15px}.saved-device-select span{font-size:12px;color:#607466;margin-top:7px}
.saved-device-remove{flex:none;font-size:13px}.device-manager>.button{margin-top:3px}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 12% 0%, #e6f0e9, transparent 35rem), #f5f3ed; }
button, input, select, textarea { font: inherit; }
[hidden] { display: none !important; }
button, summary, select, a, input { -webkit-tap-highlight-color: transparent; }
button:focus-visible, summary:focus-visible, select:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid #287953; outline-offset: 3px;
}
button { touch-action: manipulation; }
a { color: #176b51; text-underline-offset: 3px; overflow-wrap: anywhere; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 24px; font-weight: 650; }
h2 { margin-bottom: 0; font-size: 18px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
.page-shell { width: min(720px, calc(100% - 28px)); margin: 0 auto; padding: 24px 0 36px; }
.hero { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.brand-mark { display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 11px; background: #176b51; color: #fff; font-size: 24px; }
.card { margin-top: 14px; padding: 20px; border: 1px solid #dce4de; border-radius: 16px; background: #fff; }
.section-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.status, .phase-chip { display: inline-flex; align-items: center; min-height: 28px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.status-waiting, .phase-chip { background: #eeeae0; color: #62583f; }
.status-online { background: #dcf4e9; color: #126046; }
.status-error { background: #fbe2de; color: #9d352a; }
.small-note, .foreground-note { margin: 10px 0 0; color: #596d62; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.foreground-note { font-size: 12px; }
.small-note:empty, .actions:empty, .file-list:empty, .setup-message:empty, #transfer-action-note:empty { display: none; }
.button { min-height: 44px; max-width: 100%; padding: 10px 16px; border: 0; border-radius: 9px; cursor: pointer; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.button-primary { background: #176b51; color: #fff; }
.button-secondary { background: #e8efea; color: #254a39; }
.button-wide { width: 100%; margin-top: 16px; }
.text-button, .file-remove, .file-diagnostic { min-height: 44px; padding: 8px 4px; border: 0; background: transparent; color: #176b51; cursor: pointer; font-size: 13px; line-height: 1.5; }
button:disabled { opacity: .48; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.disclosure { margin-top: 10px; border-top: 1px solid #dce4de; }
.disclosure > summary, .manga-more > summary { min-height: 44px; padding: 12px 0; cursor: pointer; color: #315d47; font-size: 13px; line-height: 1.5; }
.disclosure > summary::marker, .manga-more > summary::marker { color: #688676; }
.device-card { padding: 16px 18px; background: #eaf2ec; }
.device-identity { display: flex; align-items: center; gap: 10px; }
.reader-icon { display: grid; place-items: center; flex: none; width: 30px; height: 34px; border-radius: 6px; background: #fff; color: #176b51; font-size: 24px; }
.device-details { min-width: 0; font-size: 18px; overflow-wrap: anywhere; }
.device-card .small-note { font-size: 12px; }
.device-checks { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin-top: 10px; }
.check-label { display: block; margin-bottom: 3px; color: #596d62; font-size: 12px; }
.device-checks strong { font-size: 14px; font-weight: 500; }
.device-choice { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 13px; }
.device-choice label { flex: none; }
.device-choice select { min-width: 0; width: 100%; }
select { min-height: 44px; padding: 8px; border: 1px solid #b9cec1; border-radius: 8px; background: #fff; color: #203a30; }
.connection-details { margin-top: 6px; }
.setup-panel { border-top: 1px solid #cfdbd2; margin-top: 14px; padding-top: 14px; line-height: 1.65; }
.setup-panel h3 { margin-bottom: 10px; }
.setup-panel p { font-size: 14px; }
.setup-code-entry { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.setup-code-entry input { min-width: 0; width: 180px; max-width: 100%; min-height: 44px; padding: 10px; border: 1px solid #bacfc3; border-radius: 8px; letter-spacing: .15em; }
.setup-message { margin: 10px 0 0; line-height: 1.6; overflow-wrap: anywhere; }
.setup-message[data-kind="success"] { color: #176b51; }
.setup-message[data-kind="error"], #permission-note { color: #983f2d; }
.setup-cooldown { color: #654b25; font-size: 14px; padding: 10px 12px; background: #f5efdf; border-radius: 8px; }
.file-mode { display: inline-flex; max-width: 100%; padding: 3px; gap: 3px; margin-bottom: 12px; border-radius: 10px; background: #edf1ee; }
.file-mode button { min-height: 44px; min-width: 92px; padding: 8px 18px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #566a5e; cursor: pointer; font-size: 14px; }
.file-mode [aria-pressed="true"] { border-color: #c5d6ca; background: #fff; color: #176b51; font-weight: 600; }
.file-picker { display: block; width: 100%; min-height: 80px; padding: 14px; border: 1.5px dashed #8ba79d; border-radius: 11px; background: #f7faf8; color: #214c3b; cursor: pointer; text-align: center; }
.file-picker-title, .file-picker-subtitle { display: block; }
.file-picker-title { font-size: 17px; font-weight: 600; }
.file-picker-subtitle { margin-top: 6px; color: #596d62; font-size: 13px; line-height: 1.5; }
.manga-panel { margin-top: 12px; padding: 0 14px; background: #f5f8f5; border: 1px solid #d5e0d8; border-radius: 10px; }
.manga-panel > summary { position: relative; min-height: 60px; padding: 12px 44px 12px 0; cursor: pointer; list-style: none; }
.manga-panel > summary::-webkit-details-marker { display: none; }
.settings-title { display: block; font-size: 13px; font-weight: 600; color: #245c46; }
#manga-settings-summary { display: block; margin-top: 5px; color: #596d62; font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.settings-change { position: absolute; right: 0; top: 13px; color: #176b51; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.manga-panel[open] { padding-bottom: 12px; }
.manga-panel[open] > summary { border-bottom: 1px solid #d5e0d8; }
.manga-options { display: grid; gap: 12px; margin-top: 10px; }
.manga-options > label, .manga-option > label { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; }
.manga-option .small-note { margin: 0 0 0 25px; font-size: 12px; }
.manga-panel input[type="checkbox"] { margin: 0; accent-color: #176b51; width: 17px; height: 17px; flex: none; }
.manga-selects { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.manga-selects label { min-width: 0; font-size: 13px; line-height: 1.5; }
.manga-selects select { display: block; margin-top: 6px; width: 100%; font-size: 13px; }
.manga-more { margin: 12px 0 0; border-top: 1px solid #d5e0d8; }
.queue-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; color: #596d62; font-size: 13px; line-height: 1.6; }
#queue-summary { min-width: 0; overflow-wrap: anywhere; }
#queue-summary[data-state="attention"] { color: #993d2d; }
#clear-files { flex: none; }
.file-list { display: grid; gap: 0; margin: 8px 0 0; padding: 0; list-style: none; }
.file-list li { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid #dce4de; font-size: 14px; }
.file-name { flex-basis: 100%; min-width: 0; overflow-wrap: anywhere; line-height: 1.6; }
.file-conversion-note, .file-meta { display: block; margin-top: 3px; color: #596d62; font-size: 12px; line-height: 1.6; }
.file-state { flex-basis: 100%; min-width: 0; margin-top: 4px; color: #50695c; line-height: 1.65; overflow-wrap: anywhere; }
.file-state[data-state="ready"], .file-state[data-state="done"], .file-state[data-state="published"] { color: #176b51; }
.file-state[data-state="error"], .file-state[data-state="conflict"], .file-state[data-state="uncertain"] { color: #a33c31; }
.file-state .preparation-progress { display: block; width: 100%; height: 7px; margin-top: 6px; accent-color: #176b51; }
.file-extra { font-size: 12px; margin-top: 4px; }
.file-extra summary { min-height: 44px; padding: 10px 0; cursor: pointer; color: #596d62; }
.file-extra .file-diagnostic { display: block; }
.transfer-progress { margin-top: 16px; padding-top: 14px; border-top: 1px solid #dce4de; }
.progress-heading, .progress-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
.progress-label { margin-top: 7px; color: #50695c; line-height: 1.6; overflow-wrap: anywhere; }
.progress-meta { margin-top: 7px; color: #596d62; font-size: 12px; }
.transfer-progress progress { width: 100%; height: 12px; margin-top: 10px; accent-color: #176b51; }
.transfer-progress[data-state="error"] .progress-label, .transfer-progress[data-state="error"] .progress-meta { color: #a33c31; }
.result-card h2 { font-size: 15px; }
.result-log { margin-top: 10px; padding: 12px; border-radius: 9px; background: #f1f5f2; color: #425e4e; line-height: 1.65; font-size: 13px; overflow-wrap: anywhere; white-space: pre-line; }
.result-log[data-kind="success"] { color: #126046; background: #e8f4ec; }
.result-log[data-kind="error"] { color: #963b2d; background: #fff0ea; }
.event-heading { margin: 12px 0 8px; color: #596d62; font-size: 12px; font-weight: 500; }
.runtime-events { padding: 0; margin: 0; list-style: none; }
.runtime-events li { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; padding: 5px 0; font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; }
.runtime-events time { color: #596d62; font-variant-numeric: tabular-nums; }
.runtime-events [data-kind="error"] { color: #a33c31; }
.diagnostic-details, #series-diagnostics-slot > details { border-top: 1px solid #dce4de; margin-top: 12px; font-size: 13px; }
.diagnostic-details summary, #series-diagnostics-slot > details > summary { min-height: 44px; padding: 12px 0; cursor: pointer; color: #315d47; }
.diagnostic-details dl { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 8px; }
.diagnostic-details dt { color: #596d62; }
.diagnostic-details dd { margin: 0; overflow-wrap: anywhere; }
.diagnostic-details textarea { width: 100%; min-height: 180px; margin-top: 12px; padding: 10px; border: 1px solid #bacfc3; border-radius: 9px; background: #fff; color: #203129; font: 12px/1.65 monospace; resize: vertical; }
#series-diagnostics-slot button { display: block; margin-top: 8px; }
.page-footer { margin-top: 18px; text-align: center; font-size: 12px; color: #596d62; line-height: 1.6; }
.page-footer .small-note { font-size: 12px; }
@media (max-width: 600px) {
  .page-shell { width: calc(100% - 24px); padding-top: 18px; }
  h1 { font-size: 21px; }
  .card { padding: 16px; }
  .device-card { padding: 14px; }
  .device-details { font-size: 17px; }
  .setup-code-entry input { flex: 1; }
}
@media (max-width: 400px) {
  .manga-selects { grid-template-columns: minmax(0, 1fr); }
  .file-mode { display: flex; }
  .file-mode button { flex: 1; min-width: 0; }
  .file-picker-subtitle { font-size: 12px; }
}
