:root {
  color-scheme: dark;
  --bg: #111312;
  --surface: #191c1a;
  --surface-2: #222623;
  --border: #343a36;
  --text: #f4f6f4;
  --muted: #a6afa9;
  --accent: #e7533f;
  --green: #44a56f;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; min-width: 320px; min-height: 100%; margin: 0; }
body { overflow: hidden; background: var(--bg); color: var(--text); }
button, input { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.topbar {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr) auto;
  align-items: center;
  min-height: 64px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(20, 23, 21, .97);
}

.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 7px; background: var(--accent); font-weight: 800; }
.brand strong, .brand small { display: block; white-space: nowrap; }
.brand strong { font-size: 15px; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }

.quick-nav { display: flex; justify-content: center; gap: 4px; }
.quick-link { min-height: 36px; padding: 0 14px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.quick-link:hover, .quick-link.active { background: var(--surface-2); color: var(--text); }

.toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.icon-button, .boss-button {
  display: inline-flex;
  height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}
.icon-button { width: 38px; flex: 0 0 38px; }
.mobile-clean-button { display: none; }
.boss-button { gap: 7px; padding: 0 12px; }
.icon-button:hover, .boss-button:hover { border-color: #59625c; background: var(--surface-2); }
.icon-button svg, .boss-button svg, .address-form svg, .access-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

#main-content { height: calc(100dvh - 64px); }
.center-view { display: grid; height: 100%; place-content: center; justify-items: center; padding: 24px; text-align: center; }
.center-view h1 { margin: 16px 0 8px; font-size: clamp(20px, 4vw, 30px); letter-spacing: 0; }
.center-view p { max-width: 460px; margin: 0 0 20px; color: var(--muted); line-height: 1.7; }
.access-icon { display: grid; width: 64px; height: 64px; place-items: center; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--accent); }
.access-icon svg { width: 30px; height: 30px; }
.sound-icon { color: #f1b849; }
.warning-label { margin: 16px 0 0 !important; color: #f1b849 !important; font-size: 12px; font-weight: 800; }
.primary-button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; border: 0; padding: 0 20px; border-radius: 6px; background: var(--accent); color: #fff; font-weight: 700; text-decoration: none; cursor: pointer; }
.text-link { margin-top: 16px; color: var(--muted); text-decoration: none; }

.loader { width: 28px; height: 28px; border: 3px solid #3a403c; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.player-view { display: grid; height: 100%; grid-template-rows: auto minmax(0, 1fr); }
.address-row { display: flex; min-height: 52px; align-items: center; gap: 14px; padding: 7px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
.address-form { display: flex; min-width: 0; max-width: 720px; flex: 1; align-items: center; border: 1px solid var(--border); border-radius: 6px; background: #101210; }
.address-form > svg { width: 18px; margin-left: 11px; color: var(--muted); }
.address-form input { min-width: 0; height: 36px; flex: 1; border: 0; outline: 0; padding: 0 10px; background: transparent; color: var(--text); }
.address-form input::placeholder { color: #768079; }
.address-form button { align-self: stretch; border: 0; border-left: 1px solid var(--border); padding: 0 15px; background: var(--surface-2); cursor: pointer; }
.traffic-note { display: inline-flex; align-items: center; gap: 7px; margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.traffic-note i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(68,165,111,.13); }

.frame-shell { position: relative; min-height: 0; overflow: hidden; background: #fff; }
#hongguo-frame { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
.frame-loading { position: absolute; z-index: 2; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; background: #f5f6f5; color: #4d5650; }
.frame-loading .loader { border-color: #d9ddda; border-top-color: var(--accent); }
.frame-loading p { margin: 0; font-size: 14px; }
.frame-notice { position: absolute; z-index: 3; right: 18px; bottom: 18px; max-width: 330px; padding: 14px 16px; border: 1px solid #d8ddd9; border-radius: 7px; background: #fff; color: #303631; box-shadow: 0 12px 32px rgba(0,0,0,.18); }
.frame-notice p { margin: 0 0 8px; font-size: 13px; line-height: 1.6; }
.frame-notice a { color: #b13b2d; font-weight: 700; }

.history-panel { position: fixed; z-index: 31; top: 0; right: 0; width: min(390px, 92vw); height: 100dvh; padding: 18px; border-left: 1px solid var(--border); background: #171a18; box-shadow: -20px 0 50px rgba(0,0,0,.3); }
.panel-backdrop { position: fixed; z-index: 30; inset: 0; background: rgba(0,0,0,.48); }
.panel-head { display: flex; align-items: center; justify-content: space-between; }
.panel-head p { margin: 0 0 3px; color: var(--accent); font-size: 10px; font-weight: 800; }
.panel-head h2 { margin: 0; font-size: 20px; }
.history-list { display: grid; max-height: calc(100dvh - 145px); gap: 8px; overflow: auto; margin: 22px 0 14px; }
.history-item { display: grid; gap: 5px; width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); text-align: left; cursor: pointer; }
.history-item strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.history-item span { color: var(--muted); font-size: 11px; }
.history-empty { padding: 32px 12px; color: var(--muted); text-align: center; }
.clear-button { width: 100%; min-height: 40px; border: 1px solid #593b38; border-radius: 6px; background: transparent; color: #ef897b; cursor: pointer; }

.boss-screen { position: fixed; z-index: 100; inset: 0; overflow: auto; background: #f3f5f7; color: #17212b; font-family: Inter, "PingFang SC", sans-serif; }
.work-header { display: flex; height: 60px; align-items: center; justify-content: space-between; padding: 0 28px; border-bottom: 1px solid #dce2e7; background: #fff; }
.work-header > div { display: flex; align-items: center; gap: 10px; }
.work-logo { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 5px; background: #246b55; color: #fff; }
.work-user { color: #66727c; font-size: 13px; }
.work-user span { width: 8px; height: 8px; border-radius: 50%; background: #3da66f; }
.work-main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 38px 0; }
.work-title { display: flex; align-items: end; justify-content: space-between; }
.work-title p { margin: 0 0 4px; color: #76828d; font-size: 13px; }
.work-title h1 { margin: 0; font-size: 28px; letter-spacing: 0; }
.work-title button { min-height: 36px; border: 1px solid #cdd5db; border-radius: 5px; padding: 0 13px; background: #fff; color: #43515d; cursor: pointer; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 24px 0; }
.metrics article { padding: 18px; border: 1px solid #dce2e7; border-radius: 7px; background: #fff; }
.metrics span, .metrics small { display: block; color: #74808a; font-size: 12px; }
.metrics strong { display: block; margin: 10px 0; font-size: 30px; }
.work-table { overflow: hidden; border: 1px solid #dce2e7; border-radius: 7px; background: #fff; }
.table-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid #e4e8eb; }
.table-head h2 { margin: 0; font-size: 16px; }
.table-head span { color: #84909a; font-size: 12px; }
.task-row { display: grid; grid-template-columns: minmax(240px, 2fr) 1fr 1fr 1fr; align-items: center; min-height: 58px; padding: 0 20px; border-bottom: 1px solid #edf0f2; font-size: 13px; }
.task-row:last-child { border: 0; }
.task-row.labels { min-height: 42px; background: #f8f9fa; color: #7a8690; font-size: 11px; }
.status { width: fit-content; border-radius: 4px; padding: 4px 8px; font-style: normal; }
.status.doing { background: #e7f1ff; color: #286da8; }
.status.review { background: #fff3dc; color: #a76c14; }
.status.done { background: #e5f5ec; color: #277a50; }

.toast { position: fixed; z-index: 120; left: 50%; bottom: 24px; transform: translate(-50%, 16px); padding: 10px 14px; border-radius: 6px; background: #fff; color: #1d231f; box-shadow: 0 10px 30px rgba(0,0,0,.25); opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 860px) {
  .topbar { grid-template-columns: 1fr auto; }
  .quick-nav { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; overflow-x: auto; padding-top: 7px; }
  #main-content { height: calc(100dvh - 107px); }
  .brand small { display: none; }
  .toolbar .icon-button:nth-child(1), .toolbar .icon-button:nth-child(2) { display: none; }
  .boss-button span { display: none; }
  .boss-button { width: 38px; padding: 0; }
  .address-row { padding: 7px 10px; }
  .traffic-note { display: none; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-row { grid-template-columns: minmax(170px, 2fr) 1fr 1fr; }
  .task-row > :nth-child(2) { display: none; }
  .mobile-clean-button { display: inline-flex; }
  .clean-mobile-frame #hongguo-frame {
    position: absolute;
    top: -112px;
    left: 0;
    height: calc(100% + 240px);
  }
}

@media (max-width: 520px) {
  .topbar { padding-inline: 10px; }
  .toolbar { gap: 4px; }
  .toolbar #official-link { display: none; }
  .quick-link { padding-inline: 11px; }
  .address-form input { font-size: 12px; }
  .address-form button { padding-inline: 12px; }
  .work-main { width: calc(100% - 24px); padding-top: 24px; }
  .work-header { padding-inline: 14px; }
  .metrics { gap: 8px; }
  .metrics article { padding: 14px; }
  .task-row { grid-template-columns: minmax(150px, 2fr) 1fr; padding-inline: 12px; }
  .task-row > :nth-child(2), .task-row > :nth-child(4) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .loader { animation-duration: 1.8s; }
  .toast { transition: none; }
}
