/* Screen appearance only. Report files retain their own paper palette. */
html[data-theme]{background:var(--bg,#0b101b);min-height:100%}
html[data-theme] body{min-height:100vh;min-height:100dvh}
html[data-theme="dark"]{color-scheme:dark}
html[data-theme="light"]{
  color-scheme:light;
  --bg:#f5f0e7;
  --surface:#fffcf7;
  --surface-raised:#ece4d7;
  --text:#222a33;
  --muted:#626873;
  --line:#d6cbbb;
  --gold:#927447;
  --gold-bright:#79582e;
  --action:#222e3d;
  --action-ink:#fffaf2;
  --action-hover:#37485c;
  --navy:var(--surface);
  --lav:#57616e;
  --ink:#151b25;
  --cream:#e8ddcb;
  --paper:#fffcf7;
}

/* A compact, familiar day/night switch with a full touch target. */
html[data-theme] .stellar-theme-toggle{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  flex:0 0 auto;width:auto;min-width:44px;min-height:44px;height:44px;
  margin:0;padding:0 13px;border:1px solid var(--line,#303a49);
  border-radius:999px;background:transparent;color:var(--lav,#b9c2d0);
  font-family:var(--sans,'Noto Sans KR',sans-serif);font-size:12px;font-weight:400;
  line-height:1;white-space:nowrap;cursor:pointer;box-shadow:none;
  transition:background .18s,border-color .18s,color .18s;
}
html[data-theme] .stellar-theme-toggle:hover{
  background:var(--surface-raised,#182231);border-color:var(--gold,#bfa174);
  color:var(--text,#f3eee4);transform:none;
}
html[data-theme] .stellar-theme-toggle:focus-visible{
  outline:2px solid var(--gold-bright,#e3c99d);outline-offset:4px;
}
.stellar-theme-toggle svg{display:block;width:18px;height:18px;flex:0 0 18px}
html[data-theme="dark"] .stellar-theme-toggle .theme-moon,
html[data-theme="light"] .stellar-theme-toggle .theme-sun{display:none}
html[data-theme] .stellar-appearance-bar{
  display:flex;justify-content:flex-end;max-width:960px;
  margin:0 auto;padding:20px 28px 0;gap:12px;
}
.stellar-appearance-bar+.wrap,.stellar-appearance-bar+.register-page{padding-top:24px}

/* Forms and subtle boundaries need their own contrast in daylight. */
html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea{
  background:var(--surface);color:var(--text);border-color:#918674;
}
html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder{color:#707078;opacity:1}
html[data-theme="light"] input:hover,
html[data-theme="light"] select:hover,
html[data-theme="light"] textarea:hover{border-color:#75664f}
html[data-theme="light"] input:focus,
html[data-theme="light"] select:focus,
html[data-theme="light"] textarea:focus{border-color:var(--gold-bright)}
html[data-theme="light"] ::selection{background:#dbc5a4;color:#222a33}
html[data-theme="light"] .qbtn:hover{background:#e5dccd}
html[data-theme="light"] .login-page .login-google:hover{
  background:var(--action-hover);border-color:var(--action-hover);color:var(--action-ink);
}
html[data-theme="light"] #logout-btn{
  background:var(--surface);color:var(--lav);border-color:#918674;
  box-shadow:0 2px 12px rgba(50,40,25,.1);
}
html[data-theme="light"] #logout-btn:hover{
  background:var(--surface-raised);border-color:var(--gold-bright);
}

/* Older auxiliary screens declare a few fixed night colors after BASE_CSS. */
html[data-theme="light"] .card,
html[data-theme="light"] .gate{background:var(--surface);border-color:var(--line)}
html[data-theme="light"] .note{background:transparent;border-color:var(--line)}
html[data-theme="light"] .q,
html[data-theme="light"] .ax.수렴,
html[data-theme="light"] .ax.발산{background:var(--surface-raised);border-color:var(--line);color:var(--text)}
html[data-theme="light"] .q .qt,
html[data-theme="light"] .axrow .axl b{color:var(--text)}
html[data-theme="light"] .real,
html[data-theme="light"] .brow .bl{color:var(--lav)}
html[data-theme="light"] .bar{background:#e0d6c8}
html[data-theme="light"] .b부분{background:#eee0c5;color:#77501f}
html[data-theme="light"] .b수렴{background:#e8e5ef;color:#5c526e}
html[data-theme="light"] .b빗나감{background:var(--surface-raised);color:var(--lav)}
html[data-theme="light"] .quick .hit,
html[data-theme="light"] .cbtn.on{background:var(--action);color:var(--action-ink)}
html[data-theme="light"] .cbtn{background:var(--surface);border-color:var(--line);color:var(--lav)}
html[data-theme="light"] .ghost,
html[data-theme="light"] .quick .miss,
html[data-theme="light"] .ax.단서,
html[data-theme="light"] .b단서{border-color:var(--line)}
html[data-theme="light"] .htab td{border-color:var(--line)}
html[data-theme="light"] .m{border-color:var(--line)}
html[data-theme="light"] .m.on{background:#ede1cf;border-color:#b79d75}
html[data-theme="light"] .m.deep{background:#e2ceb0;border-color:#9b7846;color:#69491f}
html[data-theme="light"] .w{border-color:#b79d75}

/* Preserve semantic status colors from server-rendered inline fragments. */
html[data-theme="light"] [style*="color:#e7e0ff"],
html[data-theme="light"] [style*="color:#d9d2f5"]{color:var(--text)!important}
html[data-theme="light"] [style*="color:#e88"]{color:#a33f39!important}
html[data-theme="light"] [style*="color:#9a9"],
html[data-theme="light"] [style*="color:#7a9"],
html[data-theme="light"] [style*="color:#5fc77f"]{color:#2b6b50!important}
html[data-theme="light"] [style*="color:#e3c074"]{color:#77501f!important}
html[data-theme="light"] [style*="color:#8d867c"],
html[data-theme="light"] [style*="color:#9a927e"]{color:var(--muted)!important}
html[data-theme="light"] [style*="background:rgba(255,255,255,.08)"]{background:var(--surface-raised)!important}
html[data-theme="light"] button[name="noq"]{color:var(--text);border-color:var(--line)}
html[data-theme="light"] [style*="border-top:1px solid rgba(255,255,255,.06)"]{border-top-color:var(--line)!important}

/* The homepage illustration is vector artwork, not an inverted image. */
html[data-theme="light"] .celestial-chart [fill="#e3c99d"]{fill:var(--gold-bright)}
html[data-theme="light"] .celestial-chart [fill="#aab3c1"]{fill:var(--muted)}
html[data-theme="light"] .celestial-chart [stroke="#e3c99d"],
html[data-theme="light"] .celestial-chart [stroke="#b8a488"]{stroke:var(--gold-bright)}
html[data-theme="light"] #orbit-line stop{stop-color:#79582e}
html[data-theme="light"] #orbit-halo stop:nth-child(2){stop-color:#d1ba97;stop-opacity:.22}

@media(max-width:1000px){
  html[data-theme] .header-links{gap:18px}
  html[data-theme] .login-nav{gap:20px}
}
@media(max-width:760px){
  html[data-theme] .theme-toggle-label{display:none}
  html[data-theme] .stellar-theme-toggle{width:44px;padding:0}
  html[data-theme] .header-links{gap:12px}
  html[data-theme] .login-nav{gap:10px}
  html[data-theme] .stellar-appearance-bar{padding:16px 20px 0}
  .stellar-appearance-bar+.wrap,.stellar-appearance-bar+.register-page{padding-top:20px}
}
@media(max-width:600px){
  html[data-theme] .header-links>a:first-child{display:none}
}
@media(max-width:380px){
  html[data-theme] .site-header{gap:8px}
  html[data-theme] .header-links{gap:8px}
  html[data-theme] .login-header{gap:8px}
  html[data-theme] .login-nav{gap:6px}
  html[data-theme] .login-brand{gap:9px}
  html[data-theme] .login-brand-name{font-size:14px;letter-spacing:.2em}
  html[data-theme] .login-nav-enter{gap:6px}
}
@media(prefers-reduced-motion:reduce){
  html[data-theme] .stellar-theme-toggle{transition:none}
}
@media print{
  html[data-theme]{background:white;color-scheme:light}
  .stellar-theme-toggle,.stellar-appearance-bar{display:none!important}
}
