:root {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  color: #203247;
  background: #f3f6fa;
  font-size: 16px;
  line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 0; overflow-x: hidden; }
main { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(420px, 1.2fr); gap: 22px; max-width: 1120px; margin: 0 auto; padding: 28px; }
header { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 18px; min-height: 58px; padding: 0 4px 18px; border-bottom: 1px solid #dce5ee; }
.brand { color: #182b42; font-size: 22px; font-weight: 750; letter-spacing: -.02em; }
#connection { color: #718096; font-size: 14px; }
.control, .camera-panel, details, .activity { border: 1px solid #dce5ee; border-radius: 24px; background: #fff; box-shadow: 0 8px 24px rgba(33,55,79,.06); }
.control { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 520px; padding: 34px 28px; text-align: center; }
.door { position: relative; width: 104px; height: 148px; margin: 0 auto 22px; border: 6px solid #86a0b6; border-radius: 16px 16px 9px 9px; background: #edf3f8; box-shadow: inset 0 0 0 7px #fff; }
.handle { position: absolute; top: 70px; right: 12px; width: 27px; height: 7px; border-radius: 9px; background: #52718b; }
.door.open { border-color: #39a58a; background: #e3f6f0; }
.door.open .handle { background: #208b72; transform: rotate(-35deg); transform-origin: right; }
h1 { margin: 0; color: #182b42; font-size: 30px; font-weight: 750; letter-spacing: -.03em; }
h2 { margin: 0; color: #1d3047; font-size: 21px; font-weight: 750; }
#state { min-height: 26px; margin: 10px 0 18px; color: #718096; }
button { min-height: 44px; margin: 5px 6px 5px 0; padding: 10px 18px; border: 1px solid #c7d5e1; border-radius: 13px; background: #fff; color: #203247; cursor: pointer; font: inherit; font-weight: 650; touch-action: manipulation; }
button:hover:not(:disabled) { border-color: #7594ad; background: #f6f9fc; }
button:disabled { opacity: .48; cursor: not-allowed; }
.primary { width: 220px; margin: 4px auto 8px; border: 0; background: #2b78a8; color: #fff; font-size: 18px; }
.primary:hover:not(:disabled) { background: #236990; }
.secondary { min-width: 150px; background: #f7f9fb; }
.hint { max-width: 620px; margin: 14px auto; color: #718096; font-size: 13px; line-height: 1.7; }
.camera-panel { min-width: 0; padding: 26px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 18px; }
.section-kicker { display: block; margin-bottom: 4px; color: #6b8aa2; font-size: 12px; font-weight: 700; letter-spacing: .08em; }
.camera-status { display: block; min-width: 0; max-width: 100%; padding: 7px 12px; border: 1px solid #ccd9e4; border-radius: 999px; color: #718096; font-size: 13px; line-height: 1.45; white-space: normal; overflow-wrap: anywhere; text-align: center; }
.camera-status.live { border-color: #8ad2be; background: #effbf7; color: #168267; }
.camera-status.error { border-color: #e6a8a8; background: #fff3f3; color: #b43b3b; }
.camera-view { position: relative; display: grid; width: 100%; margin: 0 auto; overflow: hidden; border: 1px solid #d6e1ea; border-radius: 18px; background: #152332; }
.camera-stream { display: block; width: 100%; height: auto; }
.camera-placeholder { display: grid; width: 100%; aspect-ratio: 4 / 3; align-content: center; gap: 8px; justify-items: center; padding: 26px; color: #a9bdce; text-align: center; font-size: 14px; }
.camera-placeholder strong { color: #e3edf5; font-size: 17px; }
.camera-mark { display: grid; width: 54px; height: 54px; place-items: center; border: 1px solid #b9ccda; border-radius: 17px; background: #fff; color: #5a83a0; font-size: 25px; font-weight: 700; }
.camera-form { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 0 12px; align-items: end; margin-top: 18px; }
.camera-remote-url, .camera-actions { grid-column: 1 / -1; }
.camera-form label { margin: 0; color: #50667b; font-size: 13px; font-weight: 650; }
.camera-form input, input { display: block; width: 100%; margin-top: 6px; padding: 11px 13px; border: 1px solid #c8d6e2; border-radius: 12px; background: #fbfdff; color: #203247; font: inherit; font-size: 16px; }
.camera-form input:focus, input:focus { border-color: #6094b7; outline: 3px solid rgba(96,148,183,.18); }
.camera-form input::placeholder { color: #9aaaba; }
.camera-actions { margin-top: 6px; }
.camera-actions button:first-child { background: #eaf4fa; border-color: #b8d4e5; color: #1e6389; }
.camera-port-help { grid-column: 1 / -1; margin: 8px 0 14px; color: #718096; font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.camera-hint { margin-bottom: 0; }
code { padding: 2px 5px; border-radius: 5px; background: #edf3f7; color: #41647d; }
details { grid-column: 1 / -1; padding: 22px 26px; }
summary { color: #243a52; cursor: pointer; font-weight: 750; }
details form { max-width: 700px; }
label { display: block; margin: 16px 0 8px; color: #50667b; font-size: 13px; font-weight: 650; }
.remember { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 500; }
.remember input { width: 19px; height: 19px; margin: 0; }
.activity { grid-column: 1 / -1; padding: 22px 26px; }
ol { padding: 0; margin: 14px 0 0; list-style: none; color: #718096; font-size: 13px; line-height: 1.9; }
li { padding: 6px 0; border-bottom: 1px solid #edf1f5; overflow-wrap: anywhere; }
footer { grid-column: 1 / -1; padding: 2px 4px 10px; color: #8b9aaa; font-size: 12px; }
:focus-visible { outline: 3px solid #74a9c9; outline-offset: 3px; }
@media (max-width: 1000px), (max-device-width: 820px) {
  main { grid-template-columns: 1fr; width: 100%; padding: 18px; }
  header, details, .activity, footer { grid-column: auto; }
  .control { min-height: 0; }
}
@media (max-width: 500px), (max-device-width: 500px) {
  main { gap: 14px; padding: 12px; }
  header { min-height: 48px; padding: 0 3px 12px; }
  .brand { font-size: 20px; }
  #connection { max-width: 116px; text-align: right; }
  .section-heading > div { min-width: 0; flex: 1 1 150px; }
  .camera-status { width: 100%; max-width: 100%; text-align: center; }
  .control, .camera-panel, details, .activity { border-radius: 18px; }
  .control { padding: 26px 16px; }
  h1 { font-size: 27px; }
  .camera-panel, details, .activity { padding: 18px 14px; }
  .camera-view { border-radius: 15px; }
  .camera-form { grid-template-columns: 1fr; gap: 0; }
  .camera-form label + label { margin-top: 12px; }
  .camera-remote-url { grid-column: auto; }
  .camera-actions { display: flex; flex-wrap: wrap; }
  .camera-actions button { flex: 1 1 130px; margin-right: 8px; }
  .primary { width: min(100%, 240px); }
  button { min-height: 46px; }
}

[hidden] { display: none !important; }
