/* Dafeiyu Daily — paper, ink, screentones and character panels. Local assets only. */
:root {
  --comic-paper: #f8f6ef;
  --comic-ink: #182c49;
  --comic-blue: #315ee7;
  --comic-yellow: #ffe28b;
  --comic-pale: #edf2ff;
  --comic-red: #b64e3e;
  --bg: var(--comic-paper);
  --bg-2: #efeee7;
  --card: #fffefa;
  --card-2: #f1f4fc;
  --ink: var(--comic-ink);
  --text: var(--comic-ink);
  --muted: #526179;
  --dim: #667186;
  --line: #c0c6d0;
  --line-soft: #e2e4e9;
  --accent: var(--comic-blue);
  --accent-2: #2449ba;
  --warn: #98681b;
  --danger: #ac3c38;
  --ok: #26745e;
  --radius: 9px;
  --radius-sm: 6px;
  --shadow: 5px 5px 0 var(--comic-ink);
  --comic-font: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color-scheme: light;
}
body {
  background-color: var(--comic-paper);
  background-image: radial-gradient(#192d4912 .7px, transparent .7px);
  background-size: 6px 6px;
  color: var(--comic-ink);
  font-size: 14px;
  line-height: 1.65;
}
body::before, body::after { content: none; }
button, input, textarea, select { font-family: inherit; }
button, a, input, textarea, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--comic-blue); outline-offset: 4px; }
a { color: #254cba; }
button:disabled { cursor: not-allowed; opacity: .48; }
.app-shell { max-width: 1120px; padding: 24px 24px calc(96px + var(--safe-bottom)); }
.app-shell.no-nav { padding-bottom: 24px; }
.card { background: #fffefa; border: 2px solid var(--comic-ink); border-radius: 9px; box-shadow: 4px 4px 0 #192d4912; }
.card.accent { border-color: var(--comic-ink); background: #fffefa; }
.card.flat { box-shadow: none; }
.btn, .icon-btn { border: 2px solid var(--comic-ink); border-radius: 6px; background: #fffefa; color: var(--comic-ink); box-shadow: 3px 3px 0 var(--comic-ink); font-weight: 750; transition: transform .15s ease, box-shadow .15s ease; }
.btn:hover:not(:disabled), .icon-btn:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--comic-ink); text-decoration: none; }
.btn:active:not(:disabled), .icon-btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--comic-ink); }
.btn.primary, .send-btn { background: var(--comic-blue); border-color: var(--comic-ink); color: white; }
.btn.ghost { background: transparent; box-shadow: none; }
.input, textarea, select { border: 2px solid #a2acbd; border-radius: 6px; background: white; box-shadow: none; color: var(--comic-ink); }
.input:focus, textarea:focus, select:focus { border-color: var(--comic-blue); box-shadow: 0 0 0 3px #315ee714; }
.input::placeholder, textarea::placeholder { color: #737f91; opacity: 1; }
.chip { background: var(--comic-pale); border: 1px solid #b4bfd4; border-radius: 4px; color: #35517f; box-shadow: none; font-size: 11px; font-weight: 750; white-space: normal; transform: none; }
.chip.ok { background: #e5f3eb; border-color: #8bb7a6; color: #216149; }
.chip.warn { background: #fff3ca; border-color: #d2b46d; color: #775719; }
.chip.bad { background: #ffebe8; border-color: #d19b95; color: #8e3c37; }
.banner { border-radius: 6px; box-shadow: none; }
.banner.warn { border: 1px solid #dcc28b; background: #fff8e4; color: #795c28; }
.banner.info { border: 1px solid #becbe8; background: #eff4ff; color: #385786; }
.topbar { background: var(--comic-paper); border-bottom: 2px solid var(--comic-ink); backdrop-filter: none; }
.topbar .title { color: var(--comic-ink); }
.bottom-nav { background: #fffefa; border-top: 2px solid var(--comic-ink); box-shadow: none; }
.bottom-nav .inner { max-width: 1120px; }
.bottom-nav .nav-item.active { color: var(--comic-blue); }
.bottom-nav .nav-item .ico img { border-radius: 6px; }
.connect-fab { background: var(--comic-blue); border-radius: 6px; box-shadow: 3px 3px 0 var(--comic-ink); }
.progress { background: #e6e9f0; border: 0; border-radius: 0; height: 6px; }
.progress .bar { background: var(--comic-blue); border-radius: 0; }
.code-log { max-height: 220px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); background: #f0f2f6; border: 1px solid #dce0e7; border-radius: 4px; font-size: 11px; }

/* The connection cover is a printed manga spread, with a separate usable form. */
.comic-masthead { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 64px; padding-bottom: 18px; border-bottom: 3px solid var(--comic-ink); }
.comic-brand { display: flex; align-items: center; gap: 10px; color: var(--comic-ink); text-decoration: none !important; font-size: 25px; font-weight: 950; letter-spacing: -.8px; line-height: 1.1; }
.comic-brand > img { width: 47px; height: 47px; object-fit: cover; border: 2px solid var(--comic-ink); border-radius: 50%; }
.comic-brand-sub { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: 2px; }
.comic-header-links { display: flex; align-items: center; gap: 24px; font-size: 13px; font-weight: 750; }
.comic-header-links a { padding: 6px 0; color: var(--comic-ink); }
.comic-header-links .comic-nav-current { color: var(--comic-blue); border-bottom: 2px solid var(--comic-blue); }
.edition-tag { padding: 4px 8px; border: 1px solid var(--comic-ink); font: 11px Consolas, monospace; letter-spacing: 1px; }
.comic-page-heading { display: flex; justify-content: space-between; gap: 10px; margin: 12px 0 22px; color: var(--muted); font-size: 10px; letter-spacing: 1.5px; }
.connection-layout { display: grid; grid-template-columns: 1.05fr 1fr; gap: 28px; align-items: start; }
.character-cover { position: relative; min-width: 0; background: white; border: 3px solid var(--comic-ink); border-radius: 2px; box-shadow: 7px 7px 0 #182c49; }
.cover-heading { position: relative; padding: 24px 26px 0; z-index: 1; background: radial-gradient(#a3b5de66 .8px, transparent .8px) right top / 5px 5px, linear-gradient(115deg, #f1f5ff, #fff); overflow: hidden; }
.chapter-label { display: inline-block; padding: 3px 9px; background: var(--comic-yellow); color: var(--comic-ink); border: 1.5px solid var(--comic-ink); font-size: 10px; font-weight: 850; letter-spacing: .4px; transform: rotate(-2deg); }
.cover-heading h1 { position: relative; z-index: 1; margin: 16px 0 8px; font-size: clamp(26px, 3vw, 38px); font-weight: 950; line-height: 1.35; letter-spacing: -1.5px; }
.cover-heading h1 em { color: var(--comic-blue); font-style: normal; text-decoration: underline; text-decoration-color: var(--comic-yellow); text-decoration-thickness: 7px; text-underline-offset: -2px; text-decoration-skip-ink: none; }
.cover-heading p { position: relative; z-index: 1; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.cover-spark { position: absolute; right: 32px; top: 47px; color: var(--comic-blue); font-size: 70px; transform: rotate(8deg); opacity: .16; }
.cover-art { position: relative; height: 330px; background: white; overflow: hidden; }
.cover-art > img { display: block; width: 100%; height: 100%; object-fit: contain; }
.cover-sfx { position: absolute; top: 64px; left: 22px; z-index: 1; writing-mode: vertical-rl; color: var(--comic-blue); font-size: 24px; font-style: italic; font-weight: 950; text-shadow: 2px 2px 0 var(--comic-yellow); transform: rotate(-9deg); }
.cover-art-label { position: absolute; right: 14px; bottom: 8px; padding: 2px 6px; color: var(--muted); font-size: 9px; background: white; }
.cover-dialogue { position: relative; display: flex; align-items: center; gap: 13px; min-height: 94px; padding: 16px 20px; border-top: 3px solid var(--comic-ink); background: var(--comic-pale); }
.cover-dialogue > img { width: 55px; height: 55px; flex: 0 0 55px; object-fit: cover; border: 2px solid var(--comic-ink); border-radius: 50%; }
.dialogue-speaker { color: var(--comic-blue); font-size: 10px; font-weight: 800; letter-spacing: .5px; }
.cover-dialogue p { margin: 4px 0 0; font-size: 13px; font-weight: 700; line-height: 1.6; }
.dialogue-star { position: absolute; right: 12px; bottom: 4px; color: #a1b3e2; font-size: 34px; }
.connection-portal { min-width: 0; }
.card.portal-card { margin: 0; padding: 24px; border: 3px solid var(--comic-ink); border-radius: 2px; box-shadow: 6px 6px 0 #ccd6ed; }
.portal-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-heading { display: flex; align-items: center; gap: 10px; min-width: 0; }
.panel-number { align-self: stretch; color: var(--comic-blue); font: italic 800 38px/1 Consolas, monospace; letter-spacing: -4px; }
.panel-eyebrow { color: var(--muted); font-size: 10px; letter-spacing: 1px; }
.panel-heading h2 { margin: 2px 0 0; font-size: 19px; font-weight: 850; letter-spacing: -.5px; }
.portal-title-row .chip { flex: 0 0 auto; max-width: 128px; text-align: center; line-height: 1.5; padding: 4px 8px; }
.connection-steps { display: flex; justify-content: space-between; gap: 8px; list-style: none; margin: 22px 0; padding: 12px 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.connection-steps li { display: flex; align-items: center; gap: 6px; color: var(--dim); font-size: 11px; }
.connection-steps li > span { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; background: #eef0f4; border: 1px solid #d0d6df; border-radius: 50%; font: 10px Consolas, monospace; }
.connection-steps li.is-current { color: var(--comic-blue); font-weight: 750; }
.connection-steps li.is-current > span { background: var(--comic-blue); border-color: var(--comic-blue); color: white; }
.connection-steps li.is-complete > span { background: var(--comic-yellow); border-color: var(--comic-ink); color: var(--comic-ink); }
.saved-account-note { display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px 12px; background: #eef6ef; border: 1px solid #c3d8c6; font-size: 11px; color: #356144; }
.saved-dot { width: 6px; height: 6px; border-radius: 50%; background: #438356; flex: 0 0 6px; }
.account-change-row { justify-content: flex-end; margin: 4px 0 8px; }
.text-button { padding: 4px 0; background: transparent; border: 0; color: var(--comic-blue); font-size: 11px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.connection-config { margin: 4px 0 18px; }
.connection-config > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 0; color: var(--comic-ink); cursor: pointer; font-size: 12px; font-weight: 750; list-style: none; }
.connection-config > summary::before { content: '+'; width: 16px; height: 16px; display: grid; place-items: center; background: var(--comic-pale); color: var(--comic-blue); }
.connection-config[open] > summary::before { content: '−'; }
.connection-config > summary > span { margin-left: auto; color: var(--dim); font-size: 10px; font-weight: 400; }
.account-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.connection-config .field { margin: 0 0 12px; }
.connection-config .label { display: flex; gap: 8px; align-items: baseline; margin: 0 0 6px; color: var(--comic-ink); font-size: 12px; font-weight: 700; }
.connection-config .label > span { font-size: 10px; color: var(--dim); font-weight: 400; }
.connection-config .input { min-height: 45px; padding: 10px 11px; font-size: 12px; }
.field-footnote { margin: 6px 0 0; color: var(--dim); font-size: 10px; }
.connection-actions > .btn.primary { display: flex; justify-content: space-between; width: 100%; min-height: 48px; padding: 12px 16px; border-radius: 4px; font-size: 15px; }
.connection-actions > .btn.primary > span:last-child { font-size: 20px; line-height: 1; }
.secondary-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.secondary-actions .btn { padding: 9px 7px; min-height: 39px; font-size: 11px; }
.portal-progress { margin: 20px 0 10px; }
.portal-progress > .row { margin-top: 6px; }
.connection-hint { margin: 16px 0 0; color: var(--muted); font-size: 11px; line-height: 1.8; }
.connection-diagnostics { margin-top: 18px; border-top: 1px dashed #b8c0d0; }
.connection-diagnostics > summary { display: flex; justify-content: space-between; padding: 12px 0 0; color: var(--muted); font-size: 11px; cursor: pointer; list-style: none; }
.connection-diagnostics > summary > span { font-size: 16px; line-height: 1; }
.connection-diagnostics[open] > summary > span { transform: rotate(45deg); }
.connection-diagnostics .stat-grid { margin-top: 12px; gap: 8px; }
.connection-diagnostics .stat { background: #f3f5fa; border: 1px solid #e0e4eb; border-radius: 3px; padding: 8px; }
.diagnostics-note { margin: 10px 0 0; font-size: 10px; color: var(--dim); }
.connection-diagnostics #stack-missing { margin-top: 10px; font-size: 10px; }
.portal-card #stack-error { margin: 0 0 16px; padding: 12px; font-size: 12px; overflow-wrap: anywhere; }
.manga-qr-panel { position: relative; margin: 2px 0 18px; padding: 20px; background: white; text-align: center; border: 2px solid var(--comic-ink); box-shadow: 4px 4px 0 var(--comic-yellow); }
.manga-qr-panel #stack-qr { display: block; width: 208px; height: 208px; max-width: 100%; margin: 17px auto 10px; padding: 4px; background: white; image-rendering: pixelated; }
.manga-qr-panel p { margin: 0; font-size: 12px; font-weight: 700; }
.qr-note { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; }
.qr-heading { position: relative; }
.qr-heading .chapter-label { background: var(--comic-pale); }
.qr-spark { position: absolute; top: -8px; right: 0; color: var(--comic-blue); font-size: 30px; }
.connection-caution { display: flex; align-items: flex-start; gap: 10px; margin: 21px 1px 0; padding: 0 4px; color: var(--muted); }
.caution-mark { display: grid; place-items: center; flex: 0 0 17px; width: 17px; height: 17px; margin-top: 3px; border: 1px solid var(--muted); border-radius: 50%; font-size: 10px; font-weight: 700; }
.connection-caution p { margin: 0; font-size: 10px; line-height: 1.9; }
.connection-caution a { white-space: nowrap; text-decoration: underline; text-underline-offset: 3px; }
.manga-afterword { margin-top: 52px; }
.afterword-heading { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 8px 15px; margin-bottom: 20px; }
.afterword-heading h2 { margin: 0; font-size: 22px; font-weight: 850; }
.afterword-heading p { grid-column: 2; margin: 0; color: var(--muted); font-size: 12px; }
.daily-panels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.daily-panel { position: relative; margin: 0; padding: 0; overflow: hidden; background: white; border: 2px solid var(--comic-ink); box-shadow: 4px 4px 0 #ccd6ed; }
.daily-panel-num { position: absolute; top: 0; left: 0; z-index: 1; padding: 3px 8px; border-right: 1px solid var(--comic-ink); border-bottom: 1px solid var(--comic-ink); background: var(--comic-yellow); font: 9px/1.6 Consolas, monospace; letter-spacing: 1px; }
.daily-panel > img { display: block; width: 100%; height: 190px; object-fit: cover; object-position: center 38%; transition: transform .25s ease; }
.daily-panel:last-child > img { object-position: center 65%; }
.daily-panel:hover > img { transform: scale(1.035); }
.daily-bubble { position: absolute; top: 128px; right: 10px; z-index: 1; padding: 7px 10px; background: white; border: 2px solid var(--comic-ink); border-radius: 50%; font-size: 12px; font-weight: 850; transform: rotate(-5deg); }
.daily-panel > h3 { position: relative; margin: 0; padding: 12px; background: white; border-top: 2px solid var(--comic-ink); font-size: 13px; text-align: center; }
.comic-colophon { display: flex; justify-content: space-between; gap: 12px; margin-top: 34px; padding: 14px 0 0; border-top: 2px solid var(--comic-ink); color: var(--muted); font-size: 10px; letter-spacing: .5px; }

@media (max-width: 860px) {
  .app-shell { padding-right: 20px; padding-left: 20px; }
  .connection-layout { gap: 20px; grid-template-columns: 1fr 1.08fr; }
  .cover-heading { padding: 22px 20px 0; }
  .cover-heading h1 { font-size: 29px; }
  .cover-art { height: 300px; }
  .card.portal-card { padding: 20px 18px; }
  .panel-heading h2 { font-size: 17px; }
  .portal-title-row { align-items: start; }
  .portal-title-row .chip { max-width: 78px; font-size: 10px; }
  .connection-steps { gap: 4px; }
  .connection-steps li { gap: 4px; font-size: 10px; }
  .account-grid { grid-template-columns: 1fr; gap: 0; }
}
@media (max-width: 640px) {
  .app-shell { padding: 17px 16px calc(90px + var(--safe-bottom)); }
  .comic-masthead { gap: 12px; padding-bottom: 14px; min-height: 55px; }
  .comic-brand { font-size: 22px; gap: 8px; }
  .comic-brand > img { width: 40px; height: 40px; }
  .comic-brand-sub { font-size: 7px; letter-spacing: 1px; }
  .comic-header-links { gap: 15px; font-size: 11px; }
  .edition-tag { display: none; }
  .comic-page-heading { font-size: 8px; letter-spacing: .3px; margin: 10px 0 16px; }
  .connection-layout { grid-template-columns: 1fr; gap: 25px; }
  .character-cover { display: grid; grid-template-columns: 1fr 1fr; box-shadow: 5px 5px 0 var(--comic-ink); }
  .cover-heading { padding: 18px 0 18px 16px; background: none; }
  .cover-heading .chapter-label { padding: 2px 5px; font-size: 8px; white-space: nowrap; }
  .cover-heading h1 { font-size: 25px; line-height: 1.4; letter-spacing: -1px; margin: 13px 0 9px; }
  .cover-heading p { font-size: 10px; }
  .cover-spark { display: none; }
  .cover-art { height: auto; min-height: 225px; align-self: stretch; }
  .cover-art > img { object-fit: contain; }
  .cover-sfx { font-size: 18px; left: 7px; top: 20px; }
  .cover-art-label { display: none; }
  .cover-dialogue { grid-column: 1 / -1; min-height: 82px; padding: 12px 16px; gap: 10px; }
  .cover-dialogue > img { width: 45px; height: 45px; flex-basis: 45px; }
  .cover-dialogue p { font-size: 12px; padding-right: 10px; }
  .card.portal-card { padding: 21px 18px 17px; box-shadow: 5px 5px 0 #ccd6ed; }
  .panel-heading h2 { font-size: 18px; }
  .portal-title-row .chip { max-width: 105px; }
  .account-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .connection-steps { margin: 18px 0; }
  .connection-steps li { font-size: 11px; gap: 6px; }
  .connection-config { margin-bottom: 16px; }
  .manga-afterword { margin-top: 36px; }
  .afterword-heading { gap: 10px; }
  .afterword-heading h2 { font-size: 17px; letter-spacing: -.5px; }
  .afterword-heading p { grid-column: 1 / -1; font-size: 11px; }
  .daily-panels { gap: 10px; }
  .daily-panel-num { padding: 2px 4px; font-size: 6px; letter-spacing: 0; }
  .daily-panel > img { height: 122px; object-position: center; }
  .daily-bubble { top: 79px; right: 3px; left: 3px; padding: 4px 2px; font-size: 9px; text-align: center; border-width: 1px; }
  .daily-panel > h3 { padding: 8px 3px; font-size: 9px; }
  .comic-colophon { flex-wrap: wrap; font-size: 8px; margin-top: 25px; }
  .comic-colophon > span:nth-child(2) { display: none; }
}
@media (max-width: 359px) {
  .app-shell { padding-left: 12px; padding-right: 14px; }
  .comic-header-links { gap: 9px; font-size: 10px; }
  .cover-heading { padding-left: 13px; }
  .cover-heading h1 { font-size: 22px; }
  .cover-art { min-height: 220px; }
  .card.portal-card { padding: 17px 13px; }
  .panel-number { font-size: 32px; }
  .panel-heading h2 { font-size: 16px; }
  .panel-eyebrow { font-size: 9px; }
  .portal-title-row .chip { max-width: 72px; font-size: 9px; }
  .connection-steps li { gap: 4px; font-size: 10px; }
  .account-grid { grid-template-columns: 1fr; gap: 0; }
  .manga-qr-panel { padding: 16px 10px; }
  .manga-qr-panel #stack-qr { width: 200px; height: 200px; }
  .afterword-heading h2 { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
