:root {
  color-scheme: light;
  --paper: #f7f9f9;
  --paper-deep: #eef2f3;
  --ink: #17202a;
  --muted: #66747f;
  --line: #cfd8dc;
  --blue: #1769e0;
  --blue-dark: #0d4fae;
  --green: #20a36a;
  --amber: #bd7a14;
  --red: #c54343;
  --shadow: 0 24px 70px rgba(41, 61, 73, 0.12);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--paper-deep); }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.72)),
    repeating-linear-gradient(0deg, transparent 0 27px, rgba(34, 67, 89, 0.035) 28px);
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: 0.58; }

:focus-visible {
  outline: 3px solid rgba(23, 105, 224, 0.32);
  outline-offset: 3px;
}

.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;
}

.shell { min-height: 100vh; }

.login-panel {
  width: min(520px, calc(100% - 40px));
  margin: 0 auto;
  padding-top: clamp(12vh, 150px, 22vh);
}

.brand-mark {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  width: 42px;
  height: 30px;
  margin-bottom: 28px;
}

.brand-mark span {
  display: block;
  width: 8px;
  border-radius: 8px;
  background: var(--blue);
}

.brand-mark span:nth-child(1) { height: 16px; }
.brand-mark span:nth-child(2) { height: 29px; }
.brand-mark span:nth-child(3) { height: 22px; }

.product-name {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.login-panel h1 {
  margin: 0;
  font-size: clamp(36px, 8vw, 58px);
  line-height: 1.08;
  letter-spacing: -0.055em;
}

.login-copy {
  max-width: 390px;
  margin: 20px 0 42px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.login-form label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.password-row { display: flex; gap: 10px; }

.password-row input {
  min-width: 0;
  flex: 1;
  height: 52px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
}

.password-row button {
  min-width: 92px;
  border: 0;
  border-radius: 12px;
  color: white;
  background: var(--ink);
  font-weight: 700;
}

.form-error { min-height: 24px; margin: 10px 0 0; color: var(--red); font-size: 14px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1120px, calc(100% - 48px));
  height: 86px;
  margin: 0 auto;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.wordmark-dot { width: 13px; height: 13px; border-radius: 50%; background: var(--blue); box-shadow: 10px 0 0 rgba(23, 105, 224, 0.28); }
.topbar-actions { display: flex; gap: 8px; }

.quiet-button, .refresh-button, .copy-button {
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 14px;
  font-weight: 650;
}

.quiet-button { padding: 10px 12px; border-radius: 8px; }
.quiet-button:hover, .refresh-button:hover, .copy-button:hover { color: var(--blue); background: rgba(23, 105, 224, 0.06); }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(290px, 0.8fr);
  gap: clamp(40px, 7vw, 96px);
  width: min(1050px, calc(100% - 48px));
  margin: 0 auto;
  padding: clamp(58px, 8vw, 100px) 0 90px;
}

.device-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 34px;
  color: var(--muted);
  font-size: 14px;
}

.status-light {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 8px;
  border-radius: 50%;
  background: #93a0a8;
  box-shadow: 0 0 0 5px rgba(147, 160, 168, 0.12);
}

.status-light.online { background: var(--green); box-shadow: 0 0 0 5px rgba(32, 163, 106, 0.13); }
.status-light.waiting { background: var(--amber); box-shadow: 0 0 0 5px rgba(189, 122, 20, 0.13); }
.device-id { font-variant-numeric: tabular-nums; }

.composer h1 {
  max-width: 620px;
  margin: 0 0 32px;
  font-size: clamp(34px, 5vw, 57px);
  line-height: 1.13;
  letter-spacing: -0.055em;
}

.composer textarea {
  display: block;
  width: 100%;
  min-height: 168px;
  resize: vertical;
  padding: 22px 24px;
  border: 1px solid #bdc9cf;
  border-radius: 18px 18px 4px 18px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  font-size: 20px;
  line-height: 1.65;
}

.composer textarea::placeholder { color: #9aa6ad; }
.composer textarea:focus { border-color: var(--blue); outline: 3px solid rgba(23, 105, 224, 0.12); }

.message-meta {
  display: flex;
  justify-content: space-between;
  margin: 10px 4px 30px;
  color: var(--muted);
  font-size: 13px;
}

.sound-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 19px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.switch-label { display: inline-flex; align-items: center; gap: 11px; font-weight: 650; cursor: pointer; }
.speech-hint { color: var(--muted); font-size: 13px; }
.switch-label input { position: absolute; opacity: 0; pointer-events: none; }

.switch {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 20px;
  background: #aab5ba;
  transition: background 150ms ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
  transition: transform 150ms ease;
}

.switch-label input:checked + .switch { background: var(--blue); }
.switch-label input:checked + .switch::after { transform: translateX(18px); }
.switch-label input:focus-visible + .switch { outline: 3px solid rgba(23, 105, 224, 0.3); outline-offset: 3px; }

.duration-label { color: var(--muted); font-size: 14px; }
.duration-label select { margin-left: 8px; padding: 8px 28px 8px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: white; }

.send-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 24px;
  padding: 18px 20px 18px 24px;
  border: 0;
  border-radius: 13px;
  color: white;
  background: var(--blue);
  box-shadow: 0 10px 24px rgba(23, 105, 224, 0.2);
  font-size: 17px;
  font-weight: 750;
}

.send-button:hover { background: var(--blue-dark); }
.send-button svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.send-feedback { min-height: 26px; margin: 12px 2px 0; color: var(--green); font-size: 14px; }
.send-feedback.error { color: var(--red); }

.activity { padding-top: 62px; }
.activity-heading { display: flex; align-items: center; justify-content: space-between; padding-bottom: 13px; border-bottom: 1px solid var(--ink); }
.activity-heading h2 { margin: 0; font-size: 17px; letter-spacing: -0.02em; }
.command-list { list-style: none; margin: 0; padding: 0; }

.command-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.command-copy { min-width: 0; }
.command-copy p { overflow: hidden; margin: 0 0 7px; text-overflow: ellipsis; white-space: nowrap; line-height: 1.45; }
.command-copy time { color: var(--muted); font-size: 12px; }
.command-status { flex: none; margin-top: 2px; padding: 4px 7px; border-radius: 5px; color: var(--muted); background: rgba(102, 116, 127, 0.1); font-size: 11px; }
.command-status.success { color: #087849; background: rgba(32, 163, 106, 0.12); }
.command-status.failed { color: var(--red); background: rgba(197, 67, 67, 0.1); }
.command-status.delivered { color: var(--blue-dark); background: rgba(23, 105, 224, 0.1); }
.empty-state { padding: 28px 0; color: var(--muted); line-height: 1.6; }

.pair-dialog { width: min(560px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 20px; background: transparent; }
.pair-dialog::backdrop { background: rgba(17, 29, 39, 0.56); backdrop-filter: blur(4px); }
.dialog-card { position: relative; padding: 38px; border-radius: 20px; background: var(--paper); box-shadow: 0 35px 100px rgba(0, 0, 0, 0.3); }
.dialog-close { position: absolute; top: 16px; right: 18px; width: 36px; height: 36px; border: 0; border-radius: 50%; color: var(--muted); background: transparent; font-size: 27px; line-height: 1; }
.dialog-kicker { margin: 0 0 5px; color: var(--blue); font-size: 14px; font-weight: 750; }
.dialog-card h2 { margin: 0; font-size: 30px; letter-spacing: -0.04em; }
.pair-steps { margin: 24px 0; padding-left: 22px; color: var(--muted); line-height: 1.75; }
.pair-steps li + li { margin-top: 8px; }
.pair-values label { display: flex; justify-content: space-between; margin: 14px 0 6px; color: var(--muted); font-size: 13px; }
.pair-values code { display: block; overflow-wrap: anywhere; padding: 11px 13px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: white; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.pair-values .pair-code { color: var(--blue-dark); font-size: 22px; font-weight: 750; letter-spacing: 0.12em; text-align: center; }
.pair-values p { color: var(--muted); font-size: 12px; text-align: center; }
.copy-button { padding: 0 4px; color: var(--blue); font-size: 12px; }
.pair-generate { width: 100%; margin-top: 8px; padding: 14px; border: 0; border-radius: 10px; color: white; background: var(--ink); font-weight: 700; }

@media (max-width: 760px) {
  .topbar { width: calc(100% - 32px); height: 72px; }
  .quiet-button { padding-inline: 8px; }
  .workspace { grid-template-columns: 1fr; width: calc(100% - 32px); gap: 48px; padding-top: 42px; }
  .activity { padding-top: 0; }
  .composer h1 { font-size: 38px; }
  .composer textarea { min-height: 150px; padding: 18px; font-size: 18px; }
  .sound-row { align-items: flex-start; flex-direction: column; }
  .duration-label { display: flex; align-items: center; justify-content: space-between; width: 100%; }
  .dialog-card { padding: 32px 22px 24px; }
}

@media (max-width: 420px) {
  .password-row { flex-direction: column; }
  .password-row button { height: 50px; }
  .device-id { display: none; }
  .topbar-actions { gap: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
