@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;600;700&display=swap');

* { box-sizing: border-box; letter-spacing: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body { margin: 0; background: #f8fafc; color: #0f172a; font-family: 'Noto Sans SC', system-ui, sans-serif; }
.app-shell { display: flex; height: 100vh; height: 100dvh; flex-direction: column; overflow: hidden; padding-bottom: 3.5rem; }
.app-header { width: 100%; flex: none; }
.app-main { width: 100%; min-height: 0; flex: 1 1 auto; overflow: hidden; }
.app-footer { position: fixed; right: 0; bottom: 0; left: 0; z-index: 40; width: 100%; height: 3.5rem; }
.app-footer > div { display: flex; height: 100%; align-items: center; justify-content: center; padding-top: 0; padding-bottom: 0; }
.home-page { display: flex; height: 100%; align-items: center; justify-content: center; padding-top: 1.5rem; padding-bottom: 1.5rem; }
.content-page { display: flex; height: 100%; min-height: 0; flex-direction: column; overflow: hidden; padding-top: 2rem; padding-bottom: 1.5rem; }
.content-page-head { flex: none; margin-bottom: 1.5rem; }
.scroll-region { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex: none;
  border-radius: .55rem;
  background: #2563eb;
  color: #fff;
  font-size: .9rem;
}

.choice-card {
  display: flex;
  min-height: 11rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid #dbeafe;
  border-radius: .75rem;
  background: #fff;
  padding: 2rem;
  text-align: center;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.choice-card:hover { transform: none; border-color: #93c5fd; filter: brightness(1.03); box-shadow: 0 1px 2px rgba(15, 23, 42, .05); }
.choice-card:focus { outline: none; box-shadow: 0 0 0 4px #dbeafe; }
.choice-icon { display: flex; width: 3.5rem; height: 3.5rem; align-items: center; justify-content: center; border-radius: 9999px; background: #eff6ff; color: #2563eb; font-size: 1.5rem; }

.back-btn { display: inline-flex; align-items: center; padding: .35rem 0; font-size: .875rem; color: #64748b; }
.back-btn:hover { color: #2563eb; }
.download-card { display: flex; min-width: 0; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; border: 1px solid #e2e8f0; border-radius: .75rem; background: #fff; padding: 1rem; box-shadow: 0 1px 2px rgba(15, 23, 42, .05); }
.history-row { display: flex; flex-direction: column; gap: .75rem; padding: 1rem; }
.history-row-main { display: flex; flex-direction: column; gap: .75rem; }
.file-icon { display: inline-flex; width: 2.25rem; height: 2.25rem; flex: none; align-items: center; justify-content: center; border-radius: .5rem; background: #eff6ff; color: #2563eb; }
.icon-btn, .primary-icon-btn { display: inline-flex; width: 2rem; height: 2rem; flex: none; align-items: center; justify-content: center; border-radius: .375rem; color: #2563eb; }
.icon-btn:hover { background: #eff6ff; }
.primary-icon-btn { width: 2.25rem; height: 2.25rem; background: #2563eb; color: #fff; }
.primary-icon-btn:hover { background: #1d4ed8; }
.disabled-icon-btn { display: inline-flex; width: 2.25rem; height: 2.25rem; flex: none; align-items: center; justify-content: center; border-radius: .375rem; background: #f1f5f9; color: #94a3b8; cursor: not-allowed; }
.download-action { width: auto; min-width: 5.25rem; gap: .4rem; padding-right: .65rem; padding-left: .65rem; white-space: nowrap; }
.download-action span { font-size: .75rem; line-height: 1; }
.download-action { transition: filter .18s ease, background-color .18s ease; }
.download-action:not(.disabled-icon-btn):hover { transform: none; filter: brightness(1.08); }
.download-action:not(.disabled-icon-btn):active { transform: none; }
.icon-btn:focus, .primary-icon-btn:focus, .back-btn:focus { outline: none; box-shadow: 0 0 0 3px rgba(37, 99, 235, .14); }
.empty-state { border: 1px dashed #cbd5e1; border-radius: .75rem; background: #fff; padding: 2.5rem; text-align: center; font-size: .875rem; color: #64748b; }

@media (min-width: 640px) {
  .history-row-main { flex-direction: row; align-items: center; justify-content: space-between; }
}

@media (max-width: 639px) {
  .choice-card { min-height: 9.5rem; padding: 1.5rem; }
}

@media (max-height: 680px) {
  .home-page { padding-top: .75rem; padding-bottom: .75rem; }
  .home-page .mb-10 { margin-bottom: 1rem; }
  .home-page h1 { margin-top: .75rem; font-size: 1.5rem; }
  .choice-card { min-height: 7.5rem; padding: 1rem; }
  .choice-card .choice-icon { width: 2.5rem; height: 2.5rem; font-size: 1rem; }
  .choice-card .mt-5 { margin-top: .75rem; }
  .content-page { padding-top: 1rem; padding-bottom: .75rem; }
  .content-page-head { margin-bottom: 1rem; }
  .content-page-head h1 { margin-top: .75rem; font-size: 1.5rem; }
}

.download-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.copy-link-btn { display: inline-flex; min-height: 2.25rem; align-items: center; justify-content: center; gap: .4rem; padding: .45rem .65rem; border: 1px solid #cbd5e1; border-radius: .375rem; background: transparent; color: #475569; font: inherit; font-size: .75rem; white-space: nowrap; cursor: pointer; }
.copy-link-btn:hover { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }
.copy-link-btn:focus-visible, .retry-download-btn:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.copy-link-btn:disabled { cursor: wait; opacity: .7; }
.copy-notice { position: fixed; left: 50%; bottom: 4.5rem; transform: translateX(-50%); z-index: 60; max-width: calc(100vw - 2rem); border-radius: .5rem; background: #0f172a; padding: .75rem 1rem; color: #fff; font-size: .875rem; text-align: center; }
.copy-fallback { position: fixed; right: 1rem; bottom: 4.5rem; left: 1rem; z-index: 50; max-width: 36rem; margin: auto; border: 1px solid #cbd5e1; border-radius: .75rem; background: #fff; padding: 1rem; box-shadow: 0 10px 30px rgba(15, 23, 42, .15); }
.copy-fallback label { display: block; margin-bottom: .5rem; font-size: .875rem; }
.copy-fallback input { width: 100%; margin-bottom: .75rem; border: 1px solid #cbd5e1; border-radius: .375rem; background: #f8fafc; padding: .6rem; color: #0f172a; font-size: .875rem; }
[hidden] { display: none !important; }
.rate-limit-card { margin: 1rem auto; border: 1px solid #e2e8f0; border-radius: .75rem; background: #fff; padding: 2rem; text-align: center; }
.rate-limit-icon { margin: 0 auto 1rem; }
.rate-limit-card h1 { margin: 0 0 1rem; font-size: 1.5rem; font-weight: 700; }
.rate-limit-card p { margin: .75rem 0; color: #64748b; font-size: .875rem; line-height: 1.8; }
.rate-limit-card .retry-message { color: #1d4ed8; font-size: 1rem; }
.rate-limit-card .retry-note { font-size: .75rem; }
.rate-limit-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 1rem; margin-top: 1.5rem; }
.retry-download-btn { min-height: 2.5rem; border: 0; border-radius: .375rem; background: #2563eb; padding: .6rem 1rem; color: #fff; font: inherit; font-size: .875rem; cursor: pointer; }
.retry-download-btn:disabled { background: #e2e8f0; color: #64748b; cursor: not-allowed; }
@media (max-width: 639px) { .rate-limit-card { padding: 1.25rem; } }

/* Dark theme */
html.dark-mode { color-scheme: dark; }
html.dark-mode body { background: #0f172a !important; color: #e2e8f0 !important; }
html.dark-mode .app-header { border-color: #1e293b !important; background: rgba(15, 23, 42, .96) !important; }
html.dark-mode .app-footer { border-color: #1e293b !important; background: #0f172a !important; }
html.dark-mode .text-slate-950,
html.dark-mode .text-slate-900 { color: #f8fafc !important; }
html.dark-mode .text-slate-500 { color: #94a3b8 !important; }
html.dark-mode .text-slate-400 { color: #64748b !important; }
html.dark-mode .border-slate-200 { border-color: #1e293b !important; }
html.dark-mode .choice-card,
html.dark-mode .download-card,
html.dark-mode .empty-state,
html.dark-mode .bg-white { border-color: #334155; background: #1e293b !important; }
html.dark-mode .choice-card { border-color: #334155; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
html.dark-mode .choice-card:hover { border-color: #60a5fa; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
html.dark-mode .choice-card:focus { box-shadow: 0 0 0 4px rgba(96, 165, 250, .24); }
html.dark-mode .choice-icon,
html.dark-mode .file-icon { background: #172554; color: #93c5fd; }
html.dark-mode .back-btn { color: #94a3b8; }
html.dark-mode .back-btn:hover { color: #93c5fd; }
html.dark-mode .icon-btn { color: #93c5fd; }
html.dark-mode .icon-btn:hover { background: #172554; }
html.dark-mode .disabled-icon-btn { background: #334155; color: #94a3b8; }
html.dark-mode .download-action:not(.disabled-icon-btn):hover { filter: brightness(1.14); }
html.dark-mode .divide-slate-200 > :not([hidden]) ~ :not([hidden]) { border-color: #1e293b; }
html.dark-mode .copy-link-btn { border-color: #475569; color: #cbd5e1; }
html.dark-mode .copy-link-btn:hover { border-color: #60a5fa; background: #172554; color: #93c5fd; }
html.dark-mode .copy-fallback, html.dark-mode .rate-limit-card { border-color: #334155; background: #1e293b; color: #f8fafc; }
html.dark-mode .copy-fallback input { border-color: #475569; background: #0f172a; color: #e2e8f0; }
html.dark-mode .rate-limit-card p { color: #94a3b8; }
html.dark-mode .rate-limit-card .retry-message { color: #93c5fd; }
html.dark-mode .retry-download-btn:disabled { background: #334155; color: #94a3b8; }

