.dqa-shell{--bg:#faf8f3;--card:#fff;--ink:#222;--muted:#746e66;--accent:#8c7658;max-width:680px;min-height:620px;margin:0 auto;padding:24px 18px 92px;background:var(--bg);color:var(--ink);font-family:system-ui,-apple-system,"Noto Sans KR",sans-serif;box-sizing:border-box}.dqa-shell *{box-sizing:border-box}.dqa-header{display:flex;justify-content:space-between;align-items:start}.dqa-mark{font-size:1.35rem;font-weight:800;color:var(--accent)}.dqa-header p{margin:6px 0;color:var(--muted);font-size:.85rem}.dqa-icon{border:0;background:none;font-size:1.4rem;color:var(--accent)}.dqa-greeting{color:var(--muted);margin:28px 0 14px}.dqa-card{background:var(--card);border-radius:22px;padding:32px 24px;box-shadow:0 8px 28px #6d5b4815;min-height:220px;display:flex;flex-direction:column;justify-content:center}.dqa-card blockquote{font-size:1.45rem;line-height:1.75;margin:0 0 18px;font-weight:650}.dqa-author{color:var(--accent);margin:0}.dqa-actions{display:flex;gap:8px;margin:14px 0 28px}.dqa-actions button,.dqa-search button{border:1px solid #ded6cb;background:var(--card);border-radius:12px;padding:10px 14px;color:var(--ink)}.dqa-shell h2,.dqa-shell h1{font-size:1.15rem}.dqa-list{display:grid;gap:10px}.dqa-item{background:var(--card);border:1px solid #eee6dc;border-radius:15px;padding:16px;text-align:left}.dqa-item button{float:right;border:0;background:none;color:var(--accent);font-size:1.2rem}.dqa-item p{margin:0;line-height:1.6}.dqa-item small{color:var(--muted)}.dqa-search{display:flex;gap:8px;margin:18px 0}.dqa-search input{flex:1;border:1px solid #ddd4c8;border-radius:12px;padding:12px;background:var(--card);color:var(--ink)}.dqa-setting{display:flex;justify-content:space-between;align-items:center;padding:18px 0;border-bottom:1px solid #e9e1d7}.dqa-nav{position:fixed;bottom:0;left:50%;transform:translateX(-50%);width:min(680px,100%);display:flex;justify-content:space-around;background:var(--card);border-top:1px solid #eee6dc;padding:10px 6px max(10px,env(safe-area-inset-bottom));z-index:2}.dqa-nav button{border:0;background:none;color:var(--muted);font-size:1.25rem}.dqa-nav span{display:block;font-size:.7rem;margin-top:3px}.dqa-dark{--bg:#171717;--card:#242424;--ink:#f5f5f5;--muted:#bdbdbd}.dqa-dark .dqa-item,.dqa-dark .dqa-search input,.dqa-dark .dqa-actions button{border-color:#3d3d3d}@media(min-width:700px){.dqa-nav{bottom:16px;border:1px solid #eee6dc;border-radius:18px}.dqa-shell{border-radius:24px;margin-top:20px}}
.dqa-shell{font-size:18px}.dqa-item p{font-size:1.05rem;line-height:1.75}.dqa-item small{font-size:.9rem}.dqa-search input,.dqa-search select,.dqa-search button{font-size:1rem;min-height:48px}.dqa-mark{font-size:1.55rem}.dqa-shell h1,.dqa-shell h2{font-size:1.35rem}
/* All readability controls stay within the app. */
.dqa-shell { --dqa-font:20px; font-size:var(--dqa-font); }
.dqa-shell [hidden] { display:none !important; }
.dqa-shell .dqa-item p { font-size:var(--dqa-font); line-height:1.85; white-space:pre-line; overflow-wrap:anywhere; }
.dqa-shell .dqa-item h2 { font-size:1.05em; margin:0 0 12px; }
.dqa-shell .dqa-item small { display:block; font-size:.8em; margin-top:12px; }
.dqa-shell .dqa-item { padding:22px; }
.dqa-shell .dqa-search { flex-wrap:wrap; }
.dqa-shell .dqa-search input { min-width:0; flex:1 1 200px; }
.dqa-shell .dqa-search select { max-width:100%; padding:10px; color:var(--ink); background:var(--card); border:1px solid #b6a890; border-radius:10px; }
.dqa-shell button { cursor:pointer; min-height:44px; }
.dqa-shell :focus-visible { outline:3px solid #87663a; outline-offset:3px; }
.dqa-shell #dqa-status:empty { display:none; }
.dqa-shell details { margin-top:16px; }
.dqa-shell details p { font-size:.85em; }

/* Focused usability refinements; the original app layout remains unchanged. */
.dqa-shell { min-height:0; padding-bottom:calc(96px + env(safe-area-inset-bottom)); }
.dqa-card { min-height:0; padding:28px 24px; }
.dqa-card .dqa-today-label { margin:0 0 12px; color:var(--accent); font-size:.78em; font-weight:800; letter-spacing:.04em; }
.dqa-card blockquote { font-size:1.6rem; line-height:1.72; }
.dqa-card blockquote,.dqa-shell .dqa-item p { letter-spacing:.012em; word-spacing:.05em; }
.dqa-card .dqa-byline { letter-spacing:0; word-spacing:0; }
.dqa-byline { display:flex; flex-wrap:wrap; gap:.45em; align-items:center; color:var(--muted); }
.dqa-byline span + span::before { content:'·'; margin-right:.45em; color:var(--accent); }
.dqa-actions { gap:10px; margin:14px 0 22px; flex-wrap:wrap; }
.dqa-actions button { min-height:46px; }
.dqa-home-section { margin:24px 0; }
.dqa-home-section h2 { margin-bottom:10px; }
.dqa-topic-chips { display:flex; gap:8px; flex-wrap:wrap; }
.dqa-topic-chips button { min-height:38px; padding:7px 12px; border:1px solid #ded6cb; border-radius:999px; background:var(--card); color:var(--ink); font-size:.78em; }
.dqa-home-shortcuts { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.dqa-home-shortcuts button { min-height:52px; padding:10px; border:1px solid #ded6cb; border-radius:12px; background:var(--card); color:var(--ink); text-align:left; }
.dqa-home-shortcuts span { float:right; color:var(--accent); font-weight:800; }
.dqa-compact-list .dqa-item { padding:14px 16px; }
.dqa-compact-list .dqa-item:nth-child(n+4) { display:none; }
.dqa-library-tabs { display:flex; gap:8px; margin:14px 0 18px; border-bottom:1px solid #e9e1d7; }
.dqa-library-tabs button { min-height:44px; border:0; border-bottom:3px solid transparent; background:transparent; color:var(--muted); padding:8px 4px; }
.dqa-library-tabs button[aria-selected="true"] { color:var(--ink); border-bottom-color:var(--accent); font-weight:800; }
.dqa-nav { padding-top:7px; }
.dqa-nav button { min-width:56px; min-height:52px; padding:4px 8px; border-radius:10px; }
.dqa-nav button[aria-current="page"] { color:var(--accent); background:#8c765812; font-weight:800; }
.dqa-nav span { margin-top:2px; }
.dqa-dark .dqa-topic-chips button,.dqa-dark .dqa-home-shortcuts button { border-color:#3d3d3d; }
@media (min-width:700px) { .dqa-shell { padding-bottom:104px; } }

/* Phones need more usable line width than the desktop-sized reading setting. */
@media (max-width:480px) {
  .dqa-shell {
    --dqa-font:17px;
    width:100%;
    padding:18px 14px calc(90px + env(safe-area-inset-bottom));
    font-family:"Noto Sans KR","Apple SD Gothic Neo","Malgun Gothic",sans-serif;
  }
  .dqa-shell .dqa-item { padding:18px 16px; border-radius:14px; }
  .dqa-shell .dqa-item h2 { font-size:1.08em; line-height:1.45; margin-bottom:10px; padding-right:30px; }
  .dqa-shell .dqa-item p {
    font-size:var(--dqa-font);
    line-height:1.78;
    letter-spacing:0;
    word-spacing:0;
    word-break:keep-all;
    overflow-wrap:normal;
  }
  .dqa-shell .dqa-item small { margin-top:10px; font-size:.82em; }
  .dqa-shell .dqa-list { gap:12px; }
  .dqa-shell .dqa-search { gap:7px; margin:14px 0; }
  .dqa-shell .dqa-nav { width:100%; }
}

/* Mobile-first layout pass: phone reading and one-handed controls take priority. */
@media (max-width:480px) {
  .dqa-shell {
    --dqa-font:17px;
    min-height:100dvh;
    padding:16px 16px calc(92px + env(safe-area-inset-bottom));
    overflow-x:hidden;
  }
  .dqa-header { align-items:center; min-height:44px; }
  .dqa-mark { font-size:1.42rem; letter-spacing:-.03em; }
  .dqa-header p { margin:3px 0 0; font-size:.78rem; }
  .dqa-icon { width:44px; height:44px; padding:0; }
  .dqa-greeting { margin:18px 0 12px; font-size:.92rem; line-height:1.5; }
  .dqa-shell h1 { margin:10px 0 14px; font-size:1.22rem; }
  .dqa-shell h2 { font-size:1.05rem; }

  .dqa-card { padding:22px 18px; border-radius:18px; }
  .dqa-card .dqa-today-label { margin-bottom:8px; font-size:.75rem; }
  .dqa-card blockquote { font-size:1.3rem; line-height:1.65; letter-spacing:-.018em; word-spacing:0; }
  .dqa-byline { margin-top:2px; font-size:.82rem; line-height:1.45; }

  .dqa-actions { display:grid; grid-template-columns:1fr 1fr 1fr 1.8fr; gap:7px; width:100%; margin:12px 0 22px; }
  .dqa-actions button { width:100%; min-width:0; min-height:46px; padding:9px 4px; font-size:.72rem; white-space:nowrap; }
  .dqa-actions button[data-action="random"] { grid-column:auto; }

  .dqa-home-section { margin:20px 0; }
  .dqa-home-section h2 { margin:0 0 9px; }
  .dqa-topic-chips { display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); gap:7px; margin:0; padding:0; overflow:visible; }
  .dqa-topic-chips button { width:100%; min-width:0; min-height:38px; padding:7px 3px; font-size:.75rem; white-space:nowrap; }
  .dqa-home-shortcuts { gap:8px; }
  .dqa-home-shortcuts button { min-height:56px; padding:10px 11px; font-size:.9rem; }

  .dqa-shell .dqa-search { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; margin:12px 0 16px; }
  .dqa-shell .dqa-search input { grid-column:1 / -1; width:100%; min-height:48px; padding:11px 13px; font-size:16px; }
  .dqa-shell .dqa-search select { width:100%; min-width:0; min-height:46px; padding:8px 10px; font-size:.92rem; }
  .dqa-shell .dqa-search button { min-height:46px; padding:8px 14px; font-size:.92rem; }
  #dqa-good .dqa-search { grid-template-columns:1fr; }
  #dqa-good .dqa-search select { grid-column:1 / -1; }

  .dqa-shell .dqa-list { gap:12px; }
  .dqa-shell .dqa-item { padding:18px 16px; border-radius:16px; }
  .dqa-shell .dqa-item button { width:40px; height:40px; margin:-7px -7px 0 8px; padding:0; font-size:1.3rem; }
  .dqa-shell .dqa-item h2 { min-height:28px; margin:0 36px 10px 0; padding:0; font-size:1.06rem; line-height:1.42; letter-spacing:-.015em; }
  .dqa-shell .dqa-item p {
    font-size:var(--dqa-font);
    line-height:1.78;
    letter-spacing:0;
    word-spacing:0;
    word-break:keep-all;
    overflow-wrap:break-word;
    line-break:strict;
  }
  #dqa-good .dqa-item p { white-space:pre-line; }
  .dqa-shell .dqa-item small { margin-top:10px; font-size:.78rem; line-height:1.45; }
  .dqa-shell .dqa-item details { margin-top:12px; }
  .dqa-shell .dqa-item details p { font-size:.9em; line-height:1.7; }
  .dqa-compact-list .dqa-item { padding:15px 16px; }

  .dqa-library-tabs { gap:16px; margin:8px 0 16px; }
  .dqa-library-tabs button { flex:1; min-height:46px; padding:9px 2px; font-size:.92rem; }
  .dqa-nav { min-height:70px; padding:5px 4px max(7px,env(safe-area-inset-bottom)); box-shadow:0 -5px 16px #3328110d; }
  .dqa-nav button { min-width:0; flex:1 1 20%; min-height:57px; padding:4px 2px; font-size:1.15rem; }
  .dqa-nav span { font-size:.68rem; line-height:1.25; white-space:nowrap; }
}

/* Brief feedback belongs in a toast, not at the top of the reading flow. */
.dqa-shell #dqa-status:not(:empty) {
  position:fixed;
  z-index:10;
  left:50%;
  bottom:calc(88px + env(safe-area-inset-bottom));
  transform:translateX(-50%);
  width:max-content;
  max-width:calc(100% - 32px);
  margin:0;
  padding:11px 15px;
  border-radius:999px;
  background:#29251f;
  color:#fff;
  box-shadow:0 8px 22px #0003;
  font-size:.88rem;
  line-height:1.35;
  text-align:center;
}
.dqa-dark #dqa-status:not(:empty) { background:#f7f3ea; color:#29251f; }
@media (min-width:700px) { .dqa-shell #dqa-status:not(:empty) { bottom:92px; } }

/* Keep the app surface continuous to the navigation and use its lower area as a real footer. */
.dqa-shell { background-color:var(--bg); }
.dqa-footer {
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:4px;
  margin:28px 0 0;
  padding:20px 12px 10px;
  border-top:1px solid #e9e1d7;
  color:var(--muted);
  font-size:.78rem;
  line-height:1.45;
  text-align:center;
}
.dqa-footer strong { color:var(--accent); font-size:.9rem; }
.dqa-footer small { font-size:.72rem; }
.dqa-dark .dqa-footer { border-color:#3d3d3d; }
@media (max-width:480px) {
  .dqa-shell { min-height:100vh; min-height:100dvh; padding-bottom:calc(98px + env(safe-area-inset-bottom)); }
  .dqa-footer { margin-top:22px; padding:17px 10px 6px; }
}

/* Home mood picker: it reuses the app's existing card and accent tone. */
.dqa-mood-section { padding:18px; border:1px solid #eee6dc; border-radius:16px; background:var(--card); }
.dqa-mood-section h2 { margin:0 0 5px; }
.dqa-mood-intro { margin:0 0 13px; color:var(--muted); font-size:.85em; }
.dqa-mood-buttons { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; }
.dqa-mood-buttons button { min-height:42px; padding:7px 8px; border:1px solid #ded6cb; border-radius:11px; background:var(--bg); color:var(--ink); font-size:.8em; line-height:1.3; }
.dqa-mood-buttons button[data-mood="restart"] { font-size:.72rem; letter-spacing:-.055em; white-space:nowrap; }
.dqa-mood-buttons button.is-active { border-color:var(--accent); background:#8c76581a; color:var(--accent); font-weight:800; }
.dqa-mood-results { margin-top:16px; padding-top:16px; border-top:1px solid #eee6dc; }
.dqa-mood-result-heading { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.dqa-mood-result-heading p { margin:0; font-size:.9em; }
.dqa-mood-result-heading button { min-height:36px; flex:0 0 auto; padding:6px 9px; border:1px solid #ded6cb; border-radius:9px; background:var(--card); color:var(--ink); font-size:.74em; }
.dqa-mood-results h3 { margin:14px 0 10px; font-size:.9em; }
.dqa-mood-list .dqa-item { padding:15px 16px; }
.dqa-dark .dqa-mood-section,.dqa-dark .dqa-mood-results { border-color:#3d3d3d; }
.dqa-dark .dqa-mood-buttons button,.dqa-dark .dqa-mood-result-heading button { border-color:#3d3d3d; background:var(--card); }
@media (max-width:480px) {
  .dqa-mood-section { padding:16px; }
  .dqa-mood-buttons { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .dqa-mood-buttons button { min-height:44px; padding:8px 7px; font-size:.82rem; }
  .dqa-mood-buttons button[data-mood="restart"] { font-size:.7rem; }
  .dqa-mood-result-heading { align-items:flex-start; }
  .dqa-mood-result-heading button { min-height:38px; padding:6px 8px; font-size:.72rem; }
}

/* Higher-contrast warm dark theme. Explicit text colors prevent theme CSS from dimming app copy. */
.dqa-shell.dqa-dark {
  --bg:#25211e;
  --card:#342e29;
  --ink:#fffaf3;
  --muted:#ddd3c7;
  --accent:#e1bb7d;
  color-scheme:dark;
}
.dqa-shell.dqa-dark h1,.dqa-shell.dqa-dark h2,.dqa-shell.dqa-dark h3,
.dqa-shell.dqa-dark p,.dqa-shell.dqa-dark blockquote,.dqa-shell.dqa-dark summary { color:var(--ink) !important; }
.dqa-shell.dqa-dark small,.dqa-shell.dqa-dark .dqa-greeting,.dqa-shell.dqa-dark .dqa-header p,
.dqa-shell.dqa-dark .dqa-byline,.dqa-shell.dqa-dark .dqa-mood-intro,.dqa-shell.dqa-dark .dqa-footer { color:var(--muted) !important; }
.dqa-shell.dqa-dark .dqa-card,.dqa-shell.dqa-dark .dqa-item,.dqa-shell.dqa-dark .dqa-nav,
.dqa-shell.dqa-dark .dqa-mood-section { background-color:var(--card); border-color:#564c43; }
.dqa-shell.dqa-dark .dqa-actions button,.dqa-shell.dqa-dark .dqa-search button,
.dqa-shell.dqa-dark .dqa-topic-chips button,.dqa-shell.dqa-dark .dqa-home-shortcuts button,
.dqa-shell.dqa-dark .dqa-mood-buttons button,.dqa-shell.dqa-dark .dqa-mood-result-heading button {
  background:#3b342e;
  border-color:#5b5148;
  color:var(--ink);
}
.dqa-shell.dqa-dark .dqa-search input,.dqa-shell.dqa-dark .dqa-search select {
  background:#302a25;
  border-color:#5b5148;
  color:var(--ink);
}
.dqa-shell.dqa-dark .dqa-nav button { color:var(--muted); }
.dqa-shell.dqa-dark .dqa-nav button[aria-current="page"] { color:var(--accent); background:#e1bb7d20; }
.dqa-shell.dqa-dark .dqa-mood-buttons button.is-active { background:#e1bb7d24; border-color:var(--accent); color:#ffe3ae; }
.dqa-shell.dqa-dark .dqa-footer { border-color:#564c43; }

/* Four optional light surfaces. Dark mode intentionally keeps its dedicated high-contrast palette. */
.dqa-shell:not(.dqa-dark).dqa-theme-warm { --bg:#faf8f3; --card:#fff; --ink:#222; --muted:#746e66; --accent:#8c7658; }
.dqa-shell:not(.dqa-dark).dqa-theme-sage { --bg:#f1f6ef; --card:#fbfdf9; --ink:#283428; --muted:#657163; --accent:#6f8465; }
.dqa-shell:not(.dqa-dark).dqa-theme-lilac { --bg:#f7f4fa; --card:#fefdff; --ink:#332d3d; --muted:#716b7d; --accent:#806e92; }
.dqa-shell:not(.dqa-dark).dqa-theme-sky { --bg:#f1f6fa; --card:#fbfdff; --ink:#283641; --muted:#647481; --accent:#597d98; }
.dqa-color-setting { padding:18px 0; border-bottom:1px solid #e9e1d7; }
.dqa-color-setting h2 { margin:0; font-size:1rem; }
.dqa-color-setting p { margin:5px 0 12px; color:var(--muted); font-size:.82rem; }
.dqa-color-themes { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; }
.dqa-color-themes button { min-height:58px; padding:7px 4px; border:1px solid #ded6cb; border-radius:12px; background:var(--card); color:var(--ink); font-size:.72rem; }
.dqa-color-themes button i { display:block; width:24px; height:24px; margin:0 auto 4px; border:1px solid #00000016; border-radius:50%; background:#faf8f3; }
.dqa-color-themes .dqa-color-sage i { background:#dce8d8; }
.dqa-color-themes .dqa-color-lilac i { background:#e7def0; }
.dqa-color-themes .dqa-color-sky i { background:#dbeaf3; }
.dqa-color-themes button.is-active { border:2px solid var(--accent); color:var(--accent); font-weight:800; }
.dqa-shell.dqa-dark .dqa-color-setting { border-color:#564c43; }
.dqa-shell.dqa-dark .dqa-color-setting p { color:var(--muted); }
.dqa-shell.dqa-dark .dqa-color-themes button { background:#3b342e; border-color:#5b5148; color:var(--ink); }
@media (max-width:480px) { .dqa-color-themes { gap:7px; } .dqa-color-themes button { min-height:56px; font-size:.7rem; } }
