.rdsc {
  --rdsc-blue: #224d8c;
  --rdsc-orange: #f16d10;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.45;
  color: #182a43;
  color-scheme: light;
  background: #f5f7fb;
  border: 1px solid #dbe3ef;
  border-radius: 26px;
  width: 100%;
  max-width: 1120px;
  margin: 20px auto;
  padding: 24px;
  box-sizing: border-box;
}
.rdsc *, .rdsc *::before, .rdsc *::after { box-sizing: border-box; }
.rdsc button, .rdsc select, .rdsc input { font: inherit; }
.rdsc button { appearance: none; text-transform: none; letter-spacing: normal; min-width: 0; margin: 0; cursor: pointer; box-shadow: none; line-height: 1.25; -webkit-tap-highlight-color: transparent; }
.rdsc button:focus-visible, .rdsc select:focus-visible, .rdsc input:focus-visible, .rdsc a:focus-visible, .rdsc summary:focus-visible { outline: 3px solid var(--rdsc-orange); outline-offset: 4px; }
.rdsc-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.rdsc-brand { display: inline-flex; align-items: center; gap: 8px; font-size: .75em; font-weight: 800; letter-spacing: .17em; color: var(--rdsc-blue); }
.rdsc-brand::before { content: ""; width: 8px; height: 8px; border-radius: 3px; background: var(--rdsc-orange); transform: rotate(-12deg); }
.rdsc h2 { font: inherit; font-weight: 800; font-size: 1.65em; letter-spacing: -.035em; line-height: 1.15; color: #182a43; margin: 5px 0 0; }
.rdsc h2 span { color: #6c7b91; font-weight: 500; font-size: .65em; letter-spacing: normal; margin-left: 10px; white-space: nowrap; }
.rdsc .rdsc-expand { padding: 10px 14px; background: white; color: var(--rdsc-blue); border: 1px solid #c9d6e7; border-radius: 12px; font-size: .875em; font-weight: 650; min-height: 42px; }
.rdsc-connection { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: white; padding: 10px 12px; border: 1px solid #dbe3ef; border-radius: 16px; }
.rdsc-mode { display: flex; align-items: center; gap: 10px; margin: 0; font-size: .875em; font-weight: 650; }
.rdsc select { width: auto; max-width: 100%; height: 44px; padding: 8px 30px 8px 10px; margin: 0; background-color: #f5f7fb; color: #182a43; border: 1px solid #c9d6e7; border-radius: 10px; box-shadow: none; }
.rdsc .rdsc-connect { background: var(--rdsc-blue); color: white; min-height: 44px; border: 1px solid var(--rdsc-blue); border-radius: 10px; padding: 10px 18px; font-weight: 700; font-size: .9375em; }
.rdsc-status { display: inline-flex; align-items: center; gap: 7px; font-size: .8125em; font-weight: 650; color: #53647b; margin-left: auto; background: #edf1f7; border-radius: 100px; padding: 6px 10px; }
.rdsc-status::before { content: ""; width: 7px; height: 7px; flex-shrink: 0; border-radius: 50%; background: #7d8da3; }
.rdsc-status[data-connected="true"] { color: #176444; background: #e5f5ed; }
.rdsc-status[data-connected="true"]::before { background: #188655; }
.rdsc .rdsc-message { font-size: .875em; margin: 12px 2px 18px; line-height: 1.5; color: #55647b; }
.rdsc .rdsc-message[data-error="true"] { color: #9a2426; }
.rdsc-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-areas: ". forward ." "left stop right" ". backward .";
  gap: 10px;
  max-width: 450px;
  margin: 0 auto;
  padding: 18px;
  background: linear-gradient(145deg, #213b5f, #102641);
  border: 1px solid #284666;
  border-radius: 26px;
  box-shadow: 0 8px 24px #10264114;
}
.rdsc-group-label { display: none; }
.rdsc .rdsc-direction { background: #fff; color: var(--rdsc-blue); border: 2px solid #fff; border-bottom-color: #b8cce5; border-radius: 18px; min-height: 110px; padding: 10px 6px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 5px; font-size: .9375em; font-weight: 750; box-shadow: 0 4px 0 #081c32; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.rdsc-arrow { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px; background: #e8eff9; }
.rdsc-arrow svg { display: block; width: 28px; height: 28px; }
.rdsc .rdsc-left .rdsc-arrow, .rdsc .rdsc-right .rdsc-arrow { background: #fff1e5; color: #bc5208; }
.rdsc .rdsc-direction[aria-pressed="true"] { background: var(--rdsc-orange); color: #fff; border-color: #ffb779; box-shadow: 0 0 0 3px #f16d1040; transform: translateY(2px); }
.rdsc button[aria-pressed="true"] .rdsc-arrow { background: #ffffff24; color: #fff; }
.rdsc kbd { background: #edf2f8; border: 1px solid #d6e0ed; border-radius: 5px; box-shadow: none; color: #60748f; font-family: ui-monospace, monospace; font-size: .75em; line-height: 1.2; min-width: 20px; padding: 2px 5px; }
.rdsc button[aria-pressed="true"] kbd { color: #fff; background: #ffffff24; border-color: #ffffff50; }
.rdsc-forward { grid-area: forward; }
.rdsc-backward { grid-area: backward; }
.rdsc-left { grid-area: left; }
.rdsc-right { grid-area: right; }
.rdsc .rdsc-stop { grid-area: stop; align-self: center; justify-self: center; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 10px; width: min(100%, 108px); aspect-ratio: 1; background: #c73540; color: white; border: 4px solid #e45e68; border-radius: 50%; padding: 8px; font-size: .875em; font-weight: 750; box-shadow: 0 0 0 5px #0b2039, 0 5px 0 5px #081c32; touch-action: manipulation; }
.rdsc-stop-icon { width: 18px; height: 18px; border-radius: 4px; background: currentColor; }
.rdsc button:disabled { cursor: default; }
.rdsc .rdsc-direction:disabled { color: #4b607a; background: #e6edf6; border-color: #d8e2ef; border-bottom-color: #aabed7; }
.rdsc .rdsc-stop:disabled { background: #ad434f; border-color: #c46a74; color: #fff; }
.rdsc .rdsc-connect:disabled { opacity: .65; }
.rdsc-options { margin-top: 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: .875em; color: #55647b; }
.rdsc-options label, .rdsc-scan { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 0; }
.rdsc-options label { background: white; border: 1px solid #dbe3ef; border-radius: 9px; padding: 7px 10px; }
.rdsc input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--rdsc-blue); flex-shrink: 0; }
.rdsc details { font-size: .875em; margin-top: 18px; }
.rdsc summary { cursor: pointer; padding: 6px 0; font-weight: 650; }
.rdsc details p { margin: 10px 0; font-size: inherit; }
.rdsc .rdsc-help { border-top: 1px solid #d8e1ed; padding-top: 10px; }
.rdsc a { color: #164d9a; text-decoration: underline; }
.rdsc .rdsc-safety { color: #97272d; }
.rdsc .rdsc-error { color: #9a2426; }
.rdsc-error pre { color: inherit; font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; padding: 12px; background: #ffebea; border-radius: 9px; margin: 8px 0; }
.rdsc[hidden], .rdsc [hidden] { display: none !important; }
body.rdsc-canvas { margin: 0; background: #e2e9f3; }
.rdsc-canvas .rdsc { border: 0; border-radius: 0; margin: 0 auto; min-height: 100vh; min-height: 100svh; padding-top: max(20px, env(safe-area-inset-top)); padding-bottom: max(20px, env(safe-area-inset-bottom)); }
.rdsc.is-expanded { position: fixed; inset: 0; z-index: 2147483646; margin: 0; max-width: none; width: 100%; height: 100%; border: 0; border-radius: 0; overflow: auto; overscroll-behavior: contain; padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); }
.rdsc:fullscreen { max-width: none; overflow: auto; border: 0; border-radius: 0; }
@media (hover: hover) {
  .rdsc .rdsc-direction:hover:not(:disabled):not([aria-pressed="true"]) { border-color: #f8b77f; }
  .rdsc .rdsc-connect:hover:not(:disabled) { background: #183e75; }
  .rdsc .rdsc-expand:hover { background: #edf2f9; }
  .rdsc .rdsc-stop:hover:not(:disabled) { background: #af2632; }
}
@media (max-width: 520px) and (orientation: portrait) {
  .rdsc { padding: 18px 14px; }
  .rdsc h2 { font-size: 1.4em; }
  .rdsc h2 span { display: block; margin: 5px 0 0; }
  .rdsc-connection { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 10px; }
  .rdsc-mode { flex: 1; }
  .rdsc-mode > span { display: none; }
  .rdsc select { width: 100%; }
  .rdsc-status { grid-column: 1 / -1; justify-self: start; margin-left: 0; }
  .rdsc-controls { gap: 8px; padding: 14px 10px; border-radius: 22px; }
  .rdsc .rdsc-direction { min-height: 108px; font-size: .8125em; border-radius: 15px; }
  .rdsc-options { justify-content: center; text-align: center; }
}
@media (orientation: landscape) {
  .rdsc-controls {
    max-width: none;
    grid-template-columns: minmax(0, 2fr) minmax(85px, .9fr) minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "drive-label . steer-label steer-label" "forward stop left right" "backward stop left right";
    grid-template-rows: auto repeat(2, minmax(78px, auto));
    gap: 10px 16px;
  }
  .rdsc-group-label { display: block; font-size: .6875em; line-height: 1.25; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; color: #bfd3ec; text-align: center; }
  .rdsc-drive-label { grid-area: drive-label; }
  .rdsc-steer-label { grid-area: steer-label; color: #ffc292; }
  .rdsc .rdsc-left, .rdsc .rdsc-right { align-self: center; min-height: 130px; }
  .rdsc .rdsc-forward, .rdsc .rdsc-backward { min-height: 84px; }
}
@media (orientation: landscape) and (max-height: 540px) {
  .rdsc { padding: 12px 18px; margin: 0 auto; border-radius: 0; }
  .rdsc-header { margin-bottom: 8px; }
  .rdsc h2 { font-size: 1.25em; margin-top: 2px; }
  .rdsc-brand { font-size: .6875em; }
  .rdsc-connection { padding: 6px 8px; gap: 10px; border-radius: 12px; }
  .rdsc .rdsc-message { margin: 6px 0 8px; }
  .rdsc-controls { gap: 8px 12px; padding: 12px; border-radius: 20px; grid-template-rows: 14px repeat(2, minmax(66px, auto)); }
  .rdsc .rdsc-left, .rdsc .rdsc-right { min-height: 110px; }
  .rdsc .rdsc-forward, .rdsc .rdsc-backward { min-height: 66px; flex-direction: row; gap: 12px; }
  .rdsc-arrow { width: 36px; height: 36px; }
  .rdsc-arrow svg { width: 26px; height: 26px; }
  .rdsc kbd { display: none; }
  .rdsc .rdsc-stop { max-width: 92px; }
  .rdsc-options { margin-top: 10px; }
  .rdsc-options label { padding: 4px 8px; }
  .rdsc details { margin-top: 10px; }
  .rdsc .rdsc-help { padding-top: 2px; }
  .rdsc-canvas .rdsc { padding-top: max(10px, env(safe-area-inset-top)); padding-bottom: max(10px, env(safe-area-inset-bottom)); }
}
@media (orientation: landscape) and (max-height: 360px) {
  .rdsc { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; }
  .rdsc-header { grid-column: 1; margin: 0; gap: 6px; }
  .rdsc-header > div { min-width: 0; }
  .rdsc .rdsc-expand { min-height: 36px; padding: 6px 9px; }
  .rdsc h2 { font-size: 1.1em; }
  .rdsc h2 span { display: none; }
  .rdsc-connection { grid-column: 2; flex-wrap: nowrap; gap: 8px; padding: 0; border: 0; background: none; }
  .rdsc-mode > span, .rdsc-status { display: none; }
  .rdsc select { max-width: 160px; }
  .rdsc .rdsc-connect { font-size: .875em; padding: 10px 12px; }
  .rdsc .rdsc-message { grid-column: 1 / -1; margin: 5px 0 7px; }
  .rdsc-controls { grid-column: 1 / -1; width: 100%; height: clamp(138px, calc(100svh - 160px), 180px); padding: 10px; gap: 6px 10px; grid-template-rows: 14px repeat(2, minmax(44px, 1fr)); }
  .rdsc .rdsc-forward, .rdsc .rdsc-backward { min-height: 44px; padding: 5px; gap: 8px; }
  .rdsc .rdsc-left, .rdsc .rdsc-right { min-height: 88px; }
  .rdsc .rdsc-direction { border-radius: 12px; font-size: .875em; }
  .rdsc-arrow { width: 30px; height: 30px; border-radius: 9px; }
  .rdsc-arrow svg { width: 23px; height: 23px; }
  .rdsc .rdsc-stop { max-width: 72px; gap: 6px; font-size: .8125em; border-width: 3px; }
  .rdsc-options { grid-column: 1 / -1; margin-top: 7px; }
  .rdsc-options label { padding: 2px 6px; }
  .rdsc details, .rdsc noscript { grid-column: 1 / -1; }
  .rdsc .rdsc-help { margin-top: 7px; }
}
