:root {
  color-scheme: dark;
  --ground: #090909;
  --surface: #151515;
  --text: #f2f2f2;
  --muted: #a1a1a6;
  --line: #2b2b2d;
  --amber: #efbc77;
  --red: #ff9797;
  font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  color: var(--text);
  background: var(--ground);
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 15px; line-height: 1.6; word-break: keep-all; }
button, textarea, input { font: inherit; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: wait; opacity: .5; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
:is(button, a, input, textarea):focus-visible { outline: 2px solid #c5c5cc; outline-offset: 4px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.shell { width: min(100% - 40px, 680px); margin: 0 auto; padding-top: env(safe-area-inset-top); }
.topbar { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 650; letter-spacing: -.4px; }
.brand-secondary { color: var(--muted); font-weight: 450; }
.actions { display: flex; align-items: center; gap: 2px; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); }
.icon-button:hover { color: var(--text); background: var(--surface); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 15px; border: 1px solid transparent; border-radius: 8px; font-size: 14px; font-weight: 600; line-height: 1.5; }
.primary { background: #ededed; color: #101010; }
.primary:hover { background: #fff; }
.secondary { background: var(--surface); color: #ddd; border-color: var(--line); }
.secondary:hover { background: #202020; border-color: #49494c; }
.button svg { width: 16px; height: 16px; }
main { min-height: calc(100dvh - 150px); }
.boot { padding: 64px 0; color: var(--muted); font-size: 14px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 24px; font-weight: 650; line-height: 1.4; letter-spacing: -.7px; }
h2 { font-size: 16px; letter-spacing: -.3px; }
.auth { max-width: 340px; padding: clamp(48px, 14vh, 120px) 0 64px; margin: 0 auto; }
.lock-mark { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; margin-bottom: 24px; color: #bdbdc2; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.lock-mark svg { width: 22px; height: 22px; }
.intro { color: var(--muted); font-size: 14px; line-height: 1.8; margin: 10px 0 30px; }
.auth .primary { width: 100%; margin-top: 20px; }
.field-label { display: block; color: #b9b9bf; font-size: 13px; margin-bottom: 9px; }
input[type=password] { width: 100%; min-height: 48px; padding: 10px 13px; color: var(--text); background: var(--surface); border: 1px solid #3e3e42; border-radius: 8px; font-size: 16px; }
.setup { max-width: 460px; padding: 44px 0 60px; margin: 0 auto; }
.setup .intro { margin-bottom: 28px; }
.form-description { color: var(--muted); font-size: 13px; line-height: 1.8; margin-bottom: 20px; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .94em; color: #ddd; }
.file-picker { display: flex; align-items: center; justify-content: center; gap: 9px; position: relative; min-height: 48px; padding: 11px; margin-bottom: 22px; background: var(--surface); border: 1px solid #3e3e42; border-radius: 8px; font-size: 13px; cursor: pointer; }
.file-picker:hover { background: #202020; }
.file-picker:focus-within { outline: 2px solid #c5c5cc; outline-offset: 4px; }
.file-picker svg { width: 17px; height: 17px; }
.file-input { position: absolute; width: 100%; height: 100%; inset: 0; opacity: 0; cursor: pointer; }
textarea { display: block; width: 100%; min-height: 160px; padding: 14px; color: var(--text); background: #111; border: 1px solid #3e3e42; border-radius: 8px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; line-height: 1.75; word-break: break-all; }
textarea::placeholder { color: #8c8c95; }
.connect-button { width: 100%; margin-top: 20px; }
.privacy-note { margin: 16px 0 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.form-error { margin: 10px 0 0; color: var(--red); font-size: 13px; overflow-wrap: anywhere; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 35px; }
.provider { margin: 5px 0 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.status-line { display: flex; align-items: center; gap: 7px; margin: 27px 0 0; padding-bottom: 20px; color: var(--muted); font-size: 12px; }
.status-dot { width: 5px; height: 5px; flex-shrink: 0; border-radius: 50%; background: #a9c7b8; }
.status-dot.stale { background: var(--amber); }
.interval-label { margin-left: auto; white-space: nowrap; }
.limits { border-top: 1px solid var(--line); }
.limit { padding: 24px 0; border-bottom: 1px solid var(--line); }
.limit-header { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; }
.limit-label { margin: 0; font-size: 15px; font-weight: 600; }
.limit-period { max-width: 60%; color: var(--muted); font-size: 12px; text-align: right; overflow-wrap: anywhere; word-break: normal; }
.limit-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 12px 0 18px; }
.remaining { display: flex; align-items: baseline; gap: 6px; }
.remaining-value { font-size: 46px; font-weight: 550; letter-spacing: -2px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.remaining-unit { color: var(--muted); font-size: 13px; }
.reset { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.reset > span { color: var(--muted); font-size: 12px; }
.reset-countdown { font-size: 16px; font-weight: 550; font-variant-numeric: tabular-nums; text-align: right; }
.limit progress { display: block; appearance: none; width: 100%; height: 5px; overflow: hidden; border: 0; border-radius: 4px; background: #29292b; }
.limit progress::-webkit-progress-bar { background: #29292b; border-radius: 4px; }
.limit progress::-webkit-progress-value { background: #d0d0d4; border-radius: 4px; }
.limit progress::-moz-progress-bar { background: #d0d0d4; border-radius: 4px; }
.limit.low progress::-webkit-progress-value { background: var(--amber); }
.limit.low progress::-moz-progress-bar { background: var(--amber); }
.limit.low .remaining-value { color: var(--amber); }
.limit.exhausted progress::-webkit-progress-value { background: var(--red); }
.limit.exhausted progress::-moz-progress-bar { background: var(--red); }
.limit.exhausted .remaining-value { color: var(--red); }
.limit-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.usage-detail { overflow-wrap: anywhere; }
.reset-date { text-align: right; }
.cache-info { display: flex; justify-content: space-between; gap: 18px; margin: 24px 0 18px; }
.cache-info > div { min-width: 0; }
.cache-info dt { color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.cache-info dd { margin: 0; color: #c2c2c9; font-size: 12px; font-variant-numeric: tabular-nums; }
.cache-info > div:last-child { text-align: right; flex-shrink: 0; }
.timezone-note { color: var(--muted); font-size: 12px; margin: 0 0 42px; line-height: 1.8; }
.notice { padding: 14px; margin: 0 0 18px; border: 1px solid #554735; background: #1e1913; color: #e4bf8b; border-radius: 8px; font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; }
.limits > .notice { border: 0; background: var(--surface); color: #b8b8c0; margin: 20px 0; padding: 18px; }
#fatal-error { margin-top: 24px; }
footer { display: flex; align-items: center; justify-content: space-between; min-height: 74px; padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
dialog { width: min(460px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 22px; border: 1px solid #39393d; border-radius: 14px; background: #121212; color: var(--text); }
dialog::backdrop { background: #000b; }
.dialog-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: -4px -8px 16px 0; }
.dialog-top h2 { margin: 0; font-size: 19px; font-weight: 600; }
.disconnect { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-top: 16px; margin-top: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.text-button { border: 0; background: transparent; min-height: 44px; padding: 8px 0 8px 8px; font-size: 13px; white-space: nowrap; }
.danger { color: var(--red); }
@media (max-width: 420px) {
  .topbar { min-height: 68px; }
  .page-heading { padding-top: 28px; }
  h1 { font-size: 22px; }
  .button.secondary { padding: 9px 12px; font-size: 13px; }
  .limit { padding: 22px 0; }
  .remaining-value { font-size: 42px; }
  .reset-countdown { font-size: 15px; }
  .limit-meta { font-size: 11px; gap: 10px; }
  .status-line { font-size: 11px; gap: 6px; }
  .auth { padding-top: 64px; }
}
@media (max-width: 350px) {
  .shell { width: calc(100% - 32px); }
  .brand { font-size: 15px; gap: 8px; }
  .limit-meta { flex-direction: column; gap: 4px; }
  .reset-date { text-align: left; }
  .remaining-value { font-size: 38px; }
}
@media (prefers-reduced-motion: no-preference) {
  button { transition: background .15s, color .15s, border-color .15s; }
}
