/* Shared foundations for the router center website: the Duiduiti web palette (navy and blue since 2026-11;
   --forest and --mint are historical names for the blue accent and its tint), type, controls,
   top bar and dialogs. Page-specific rules live in home.css and app.css. The service's content
   policy allows no inline styles, so everything visual is a class here. */
:root {
  color-scheme: light;
  --paper: #f6f7f9;
  --canvas: #f0f2f6;
  --forest: #2468e8;
  --deep: #0f1c45;
  --night: #1a2b63;
  --mint: #dfe9ff;
  --mint-light: #eef3ff;
  --sun: #ffc233;
  --sun-light: #fff3d1;
  --sun-ink: #8a5a00;
  --coral: #e5654a;
  --coral-ink: #b42318;
  --coral-light: #fbe6df;
  --online: #17804f;
  --ink: #0e1836;
  --muted: #4a5472;
  --subtle: #8a92a8;
  --line: #e2e5ed;
  --soft: #eef1f8;
  --soft-line: #cdd3e4;
  --shadow: 0 1px 2px #0f1c450a;
  --card-radius: 22px;
  --control-radius: 12px;
  --web-font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  font: 15px var(--web-font);
  color: var(--ink);
  background: var(--canvas);
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; }
[hidden] { display: none !important; }
a { color: inherit; text-underline-offset: 4px; }
h1, h2, h3, p { margin: 0; overflow-wrap: anywhere; }
h1 { font-size: 28px; font-weight: 800; line-height: 1.3; }
h2 { font-size: 18px; font-weight: 800; }
p { line-height: 1.7; }
button, input, select { font: inherit; color: var(--ink); }
button, a, summary, input, select, label { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled, [aria-disabled="true"] { cursor: not-allowed; }
:where(button, a, summary, input, select, [tabindex]):focus-visible { outline: 2px solid var(--deep); outline-offset: 3px; }
h1:focus { outline: none; }

.icon { display: block; flex-shrink: 0; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* Buttons */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 14px; font-weight: 600; line-height: 1.4; text-decoration: none; transition: background .15s, border-color .15s; }
.button:hover { background: var(--soft); border-color: var(--soft-line); }
.button:disabled, .button[aria-disabled="true"] { opacity: .45; }
.button.primary { border-color: var(--deep); background: var(--deep); color: #fff; }
.button.primary:hover { border-color: var(--night); background: var(--night); }
.button.danger { border-color: var(--coral-light); background: #fff; color: var(--coral-ink); }
.button.danger:hover { background: var(--coral-light); }
.button.danger-solid { border-color: var(--coral-ink); background: var(--coral-ink); color: #fff; }
.button.danger-solid:hover { border-color: #8f1c13; background: #8f1c13; }
.button.wide { width: 100%; min-height: 52px; font-size: 16px; }
.text-button { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 4px; border: 0; border-radius: 8px; background: transparent; color: var(--forest); font-size: 13.5px; font-weight: 600; text-decoration: none; }
.text-button:hover { text-decoration: underline; }
.text-button.quiet { color: var(--muted); }
.text-button .icon { width: 14px; height: 14px; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; min-height: 72px; padding: 12px max(24px, calc((100vw - 1120px) / 2)); background: #f6f7f9ed; border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.brand { display: inline-flex; align-items: center; flex-shrink: 0; gap: 10px; text-decoration: none; }
.brand strong { display: block; font-size: 17px; font-weight: 800; line-height: 1.2; }
.brand small { display: block; margin-top: 2px; color: var(--subtle); font-size: 11px; font-weight: 600; letter-spacing: .06em; }
.brand-mark { display: block; width: 36px; height: 36px; border-radius: 28%; object-fit: contain; }
.topbar-end { display: flex; align-items: center; gap: 12px; min-width: 0; margin-left: auto; }
/* The ways back to the main site, the same two on every page with a top bar. */
.topbar-links { display: flex; align-items: center; gap: 4px; min-width: 0; margin-left: auto; }
.topbar-links a { display: inline-flex; align-items: center; min-height: 40px; padding: 8px 12px; border-radius: 10px; color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.topbar-links a:hover { background: var(--soft); color: var(--ink); }
.topbar-links + .topbar-end { margin-left: 4px; }
.topbar .button { min-height: 40px; padding: 8px 18px; font-size: 13px; white-space: nowrap; }

/* Dialogs */
dialog { width: calc(100% - 32px); max-width: 440px; max-height: calc(100dvh - 40px); padding: 0; overflow-y: auto; border: 1px solid var(--line); border-radius: 24px; color: var(--ink); background: #fff; box-shadow: 0 20px 60px #0f1c452e; }
/* The content sits in the form, so a click on the dialog element itself is a click on the backdrop. */
dialog > form { padding: 24px; }
dialog::backdrop { background: #0f1c4580; backdrop-filter: blur(2px); }
dialog h2 { font-size: 19px; line-height: 1.4; }
.dialog-message { margin-top: 8px; color: var(--muted); font-size: 14px; }
.dialog-fields { display: grid; gap: 14px; margin-top: 18px; }
.dialog-checks { display: grid; gap: 6px; margin: 12px 0 0; padding: 12px 14px 12px 34px; border-radius: 14px; background: var(--soft); font-size: 14px; }
.dialog-checks + .dialog-message { font-size: 13px; }
.dialog-error { margin-top: 12px; color: var(--coral-ink); font-size: 13px; }
.dialog-error:empty { display: none; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.dialog-actions.stacked { flex-direction: column; }
.dialog-actions.stacked .button { width: 100%; min-height: 48px; }
.dialog-actions.stacked .button:last-child { border-color: transparent; color: var(--muted); }

.field label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; }
.field select { width: 100%; min-height: 48px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink); font-size: 16px; }
.field select:focus { border-color: var(--ink); box-shadow: 0 0 0 3px #2468e826; outline: none; }
.field input { width: 100%; min-height: 48px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; font-size: 16px; transition: border-color .15s, box-shadow .15s; }
.field input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px #2468e826; outline: none; }
.field input::placeholder { color: var(--subtle); }
.field-problem { margin-top: 6px; color: var(--sun-ink); font-size: 12.5px; }
.field-problem:empty { display: none; }

.caution { display: flex; gap: 10px; padding: 12px 14px; border-radius: 16px; background: var(--sun-light); color: var(--sun-ink); font-size: 13px; line-height: 1.7; }
.caution .icon { margin-top: 3px; }

/* The account menu, the same as on every page of duiduiti.com (web-theme.css there): the phone,
   课程制作中心, 路由器管理中心, 运营后台 for administrators, and 退出登录. */
.account-menu { position: relative; }
.account-menu > summary { display: block; list-style: none; cursor: pointer; border-radius: 50%; }
.account-menu > summary::-webkit-details-marker { display: none; }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; box-shadow: 0 0 0 1px var(--line); }
.avatar svg { display: block; width: 100%; height: 100%; }
.account-menu[open] .avatar, .account-menu > summary:hover .avatar { box-shadow: 0 0 0 3px var(--mint); }
.account-dropdown { position: absolute; z-index: 40; top: calc(100% + 8px); right: 0; width: 184px; padding: 6px; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink); box-shadow: 0 12px 32px #0f1c4520; }
.account-dropdown :is(a, button) { display: flex; align-items: center; justify-content: flex-start; width: 100%; min-height: 40px; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font: inherit; font-size: 14px; font-weight: 400; line-height: 1.4; text-align: left; text-decoration: none; cursor: pointer; }
.account-dropdown :is(a, button):hover { background: var(--paper); }
.account-dropdown a[aria-current=page] { font-weight: 700; }
.account-dropdown button { color: var(--muted); }
.account-dropdown button:disabled { opacity: .6; cursor: wait; }
.account-dropdown .account-phone { margin: 0 0 4px; padding: 6px 10px 8px; border-bottom: 1px solid var(--line); color: var(--subtle); font-size: 12px; overflow-wrap: anywhere; }

.site-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 24px; padding: 0 24px 40px; color: var(--subtle); font-size: 13px; }

@media (max-width: 767px) {
  .topbar { min-height: 60px; gap: 12px; padding-inline: 16px; }
  .topbar-links { gap: 0; }
  .topbar-links a { padding-inline: 8px; }
  .topbar .button { padding-inline: 12px; }
  dialog > form { padding: 20px; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .button { width: 100%; min-height: 48px; }
  .dialog-actions.stacked { flex-direction: column; }
}
/* On a narrow phone the brand keeps only its name, so the links and the button fit on one line. */
@media (max-width: 400px) {
  .topbar:has(.topbar-links) .brand small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
