@font-face {
  font-family: "Mailbox Display";
  src: url("/static/fonts/ZCOOLQingKeHuangYou-Regular.ttf") format("truetype");
  font-display: swap;
  font-weight: 400;
}

:root {
  color-scheme: light;
  --canvas: #f3f6fa;
  --paper: #ffffff;
  --ink: #11243e;
  --muted: #62738b;
  --line: #d7e0eb;
  --line-strong: #b9c8da;
  --blue: #1769d2;
  --blue-deep: #0e4fa5;
  --blue-pale: #eaf3ff;
  --mint: #087b59;
  --mint-pale: #e5f7f0;
  --danger: #b42318;
  --shadow: 0 18px 44px rgba(28, 49, 78, .10);
  --radius: 14px;
  font-family: "Segoe UI Variable", "Microsoft YaHei UI", "PingFang SC", ui-sans-serif, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); min-height: 100vh; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(23,105,210,.25); outline-offset: 2px; }

.topbar { background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar-inner { width: min(1240px, calc(100% - 40px)); margin: 0 auto; min-height: 112px; display: flex; align-items: center; gap: 22px; }
.topbar h1 { margin: 0; font-family: "Mailbox Display", "Microsoft YaHei UI", sans-serif; font-weight: 400; font-size: clamp(34px, 3vw, 48px); letter-spacing: .01em; }
.topbar p { margin: 7px 0 0; color: var(--muted); }
.service-state { margin-left: auto; display: flex; gap: 9px; align-items: center; color: var(--mint); font-weight: 700; font-size: 14px; }
.service-state span, .refresh-state span { width: 9px; height: 9px; border-radius: 50%; background: #11a875; box-shadow: 0 0 0 5px var(--mint-pale); }
.text-button { border: 0; background: transparent; color: var(--muted); padding: 10px 2px 10px 16px; }
.text-button:hover { color: var(--ink); }

.workspace { width: min(1240px, calc(100% - 40px)); margin: 34px auto 70px; display: grid; gap: 22px; }
.work-panel, .results-panel, .message-stream { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 30px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.section-heading h2 { margin: 0; font-family: "Mailbox Display", "Microsoft YaHei UI", sans-serif; font-weight: 400; font-size: 25px; letter-spacing: .01em; }
.section-heading p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.domain-rail, .generate-rail { display: flex; align-items: end; gap: 16px; }
.domain-rail { padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.generate-rail { padding-top: 24px; }
.field { display: grid; gap: 8px; }
.field.grow { flex: 1; }
.domain-field { flex: 1; }
.count-field { width: 155px; }
.prefix-field { width: 240px; }
.sub-prefix-field { width: 175px; }
.sub-start-field { width: 125px; }
.sub-count-field { width: 140px; }
label { color: #324962; font-size: 14px; font-weight: 700; }
input, select { width: 100%; height: 48px; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; color: var(--ink); padding: 0 14px; transition: border-color .18s ease, box-shadow .18s ease; }
input::placeholder { color: #8291a5; }
input:hover, select:hover { border-color: #8ca5c1; }
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(23,105,210,.09); outline: none; }
button[type="submit"], #copy-address { min-height: 48px; border: 0; border-radius: 9px; padding: 0 26px; background: var(--blue); color: white; font-weight: 800; box-shadow: 0 8px 18px rgba(23,105,210,.20); transition: background .18s ease, transform .18s ease, box-shadow .18s ease; }
button[type="submit"]:hover, #copy-address:hover { background: var(--blue-deep); transform: translateY(-1px); box-shadow: 0 11px 22px rgba(23,105,210,.25); }
.form-status { min-height: 22px; padding-top: 12px; color: var(--muted); font-size: 14px; }
.form-status.error { color: var(--danger); }
.form-status.success { color: var(--mint); }
.domain-guidance { margin: 13px 0 -5px; color: var(--blue-deep); font-size: 13px; }

.result-heading { align-items: center; }
.result-actions { display: flex; gap: 10px; }
.secondary-button, .row-button { min-height: 38px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 14px; color: #24405f; background: #fff; font-weight: 700; }
.secondary-button:hover, .row-button:hover { background: var(--blue-pale); border-color: #91b8e8; color: var(--blue-deep); }
.empty-state { min-height: 215px; border: 1px dashed var(--line-strong); border-radius: 11px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; color: var(--muted); }
.empty-state strong { color: var(--ink); margin: 18px 0 6px; }
.empty-state span { max-width: 100%; padding: 0 20px; overflow-wrap: anywhere; word-break: break-word; line-height: 1.6; }
.empty-lines { display: grid; gap: 7px; width: 54px; }
.empty-lines i { height: 4px; border-radius: 3px; background: #b9cbe0; }
.empty-lines i:nth-child(2) { width: 70%; }
.empty-lines i:nth-child(3) { width: 42%; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th { color: var(--muted); font-size: 12px; letter-spacing: .06em; text-align: left; text-transform: uppercase; padding: 0 12px 12px; border-bottom: 1px solid var(--line); }
td { padding: 16px 12px; border-bottom: 1px solid #e7edf4; vertical-align: middle; }
td:first-child { font-weight: 750; }
.url-cell { max-width: 520px; color: var(--blue-deep); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-badge { display: inline-flex; min-width: 28px; height: 28px; border-radius: 14px; background: var(--mint-pale); color: var(--mint); align-items: center; justify-content: center; font-size: 13px; font-weight: 800; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 18px); padding: 12px 18px; border-radius: 9px; background: #10243f; color: white; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; z-index: 10; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

.login-body { display: grid; place-items: center; background: #edf2f8; }
.login-shell { width: min(430px, calc(100% - 32px)); padding: 40px 0; }
.login-panel { background: white; border-radius: var(--radius); padding: 42px; box-shadow: var(--shadow); }
.login-panel h1 { margin: 22px 0 8px; font-family: "Mailbox Display", "Microsoft YaHei UI", sans-serif; font-weight: 400; font-size: 44px; letter-spacing: .01em; }
.login-panel > p { color: var(--muted); margin: 0 0 30px; }
.login-panel form { display: grid; gap: 10px; }
.login-panel button { margin-top: 8px; }
.brand-mark { display: flex; gap: 5px; height: 24px; align-items: end; }
.brand-mark span { width: 8px; border-radius: 4px 4px 2px 2px; background: var(--blue); }
.brand-mark span:nth-child(1) { height: 14px; }
.brand-mark span:nth-child(2) { height: 24px; }
.brand-mark span:nth-child(3) { height: 19px; background: #18a879; }
.brand-mark.muted span { background: #91a1b5; }
.delivery-route { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); margin: 24px 28px 0; color: #6c7d92; font-size: 12px; text-align: center; }
.delivery-route::before { content: ""; position: absolute; top: 6px; left: 16.5%; right: 16.5%; height: 1px; background: #b8c9dd; }
.delivery-route span { position: relative; display: grid; justify-items: center; gap: 9px; }
.delivery-route i { width: 13px; height: 13px; border: 3px solid #edf2f8; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 1px #8eb3df; z-index: 1; }
.delivery-route span:last-child i { background: #13a477; box-shadow: 0 0 0 1px #7bc9ae; }

.inbox-body { background: #edf3f9; }
.inbox-shell { width: min(960px, calc(100% - 40px)); margin: 46px auto 80px; }
.inbox-header { position: relative; overflow: hidden; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0 42px 42px; }
.inbox-band { margin: 0 -42px 34px; min-height: 58px; padding: 0 42px; display: flex; align-items: center; gap: 12px; background: var(--blue); color: white; }
.inbox-band strong { font-size: 14px; }
.inbox-band em { margin-left: auto; font-size: 11px; font-style: normal; letter-spacing: .13em; opacity: .78; }
.lock-mark { width: 12px; height: 14px; border: 2px solid currentColor; border-radius: 3px; position: relative; }
.lock-mark::before { content: ""; position: absolute; width: 7px; height: 6px; border: 2px solid currentColor; border-bottom: 0; border-radius: 7px 7px 0 0; top: -8px; left: 1px; }
.inbox-header h1 { overflow-wrap: anywhere; margin: 0 0 9px; font-family: "Mailbox Display", "Microsoft YaHei UI", sans-serif; font-weight: 400; font-size: clamp(38px, 5.5vw, 68px); line-height: 1.02; letter-spacing: .005em; }
.inbox-header > p { color: var(--muted); margin: 0; }
.inbox-tools { margin-top: 30px; display: flex; align-items: center; gap: 22px; }
.refresh-state { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.refresh-state b { font-weight: 650; }
.message-stream { margin-top: 22px; }
.message-card { border-top: 1px solid var(--line); padding: 23px 0; }
.message-card:first-child { border-top: 0; padding-top: 0; }
.message-meta { display: flex; justify-content: space-between; gap: 20px; color: var(--muted); font-size: 13px; }
.message-card h3 { margin: 10px 0 12px; font-size: 19px; }
.otp-block { display: inline-flex; align-items: center; gap: 12px; background: var(--mint-pale); color: #075e45; padding: 10px 14px; border-radius: 9px; margin: 0 0 16px; }
.otp-block strong { font-size: 24px; letter-spacing: .08em; }
.otp-block button { border: 0; background: transparent; color: var(--mint); font-weight: 800; }
.message-body { white-space: pre-wrap; overflow-wrap: anywhere; color: #304963; line-height: 1.7; max-height: 420px; overflow: auto; padding-right: 8px; }
.result-row, .message-arrival { animation: delivery-arrival .48s cubic-bezier(.16,1,.3,1) both; }
@keyframes delivery-arrival {
  from { opacity: .35; clip-path: inset(0 0 100% 0); filter: blur(3px); }
  to { opacity: 1; clip-path: inset(0); filter: blur(0); }
}
.inbox-empty { text-align: center; padding: 65px 20px; color: var(--muted); }
.inbox-empty strong { display: block; color: var(--ink); margin-bottom: 7px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 760px) {
  .topbar-inner { width: min(100% - 28px, 1240px); min-height: 96px; flex-wrap: wrap; padding: 18px 0; }
  .topbar p { display: none; }
  .service-state { order: 3; width: 100%; margin: 0; }
  .text-button { margin-left: auto; }
  .workspace, .inbox-shell { width: min(100% - 24px, 1240px); margin-top: 18px; }
  .work-panel, .results-panel, .message-stream { padding: 20px; }
  .domain-rail, .generate-rail { display: grid; grid-template-columns: 1fr; }
  .count-field, .prefix-field, .sub-prefix-field, .sub-start-field, .sub-count-field { width: auto; }
  .domain-rail button, .generate-rail button { width: 100%; }
  .section-heading, .result-heading { align-items: stretch; flex-direction: column; }
  .result-actions { width: 100%; }
  .result-actions button { flex: 1; }
  .login-panel { padding: 30px 24px; }
  .login-panel h1 { font-size: 40px; }
  .inbox-header { padding: 0 26px 34px; }
  .inbox-band { margin: 0 -26px 30px; padding: 0 26px; }
  .inbox-band em { display: none; }
  .inbox-tools { align-items: stretch; flex-direction: column; }
  #copy-address { width: 100%; }
  .message-meta { flex-direction: column; gap: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
