:root { color-scheme: light; font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; color: #1d1d1f; background: #f5f5f7; --muted: #737378; --brand: #a8502f; --brand-hover: #883f27; --brand-soft: #faf0ea; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: var(--brand); }
button, input, select { font: inherit; max-width: 100%; }
button { min-height: 40px; border: 1px solid #dedee3; background: #fff; color: #333338; border-radius: 9px; padding: 9px 13px; cursor: pointer; transition: background .15s; }
button:hover:enabled { background: var(--brand-soft); }
button:disabled { opacity: .4; cursor: default; }
:is(button, input, select, summary, a):focus-visible, .file-button:focus-within { outline: 3px solid var(--brand); outline-offset: 4px; }
.app-header { height: 82px; padding: 0 40px; max-width: 1440px; margin: auto; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; text-decoration: none; color: inherit; }
.brand-mark { display: block; width: 32px; height: 32px; }
.privacy { font-size: 12px; color: var(--muted); }
.workspace { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 28px; max-width: 1280px; margin: 12px auto 0; padding: 0 32px; align-items: start; }
.sidebar { background: #fff; border: 1px solid #e6e6eb; border-radius: 20px; overflow: hidden; }
.setup { padding: 28px 25px 14px; }
.eyebrow { margin: 0 0 13px; font-size: 10px; font-weight: 600; letter-spacing: .14em; color: var(--muted); }
h1 { font-size: 28px; line-height: 1.28; letter-spacing: -.045em; font-weight: 600; margin: 0; white-space: pre-line; }
.intro { font-size: 13px; color: var(--muted); margin: 13px 0 25px; line-height: 1.7; }
.field { display: block; margin: 0 0 16px; font-size: 12px; font-weight: 550; }
.field-title { display: block; font-size: 12px; font-weight: 550; margin-bottom: 9px; }
.optional { font-weight: 400; color: #909096; margin-left: 5px; }
select { width: 100%; padding: 11px 9px; margin-top: 8px; border: 1px solid #d9d9df; border-radius: 9px; background: #fbfbfc; font-size: 13px; color: #333338; }
input[type=file] { display: block; width: 100%; margin-top: 8px; border: 1px dashed #d5d5dd; border-radius: 9px; padding: 8px; font-size: 11px; color: var(--muted); background: #fcfcfd; }
input::file-selector-button { font: inherit; color: #303035; background: #ededf1; border: 0; padding: 7px 8px; border-radius: 5px; margin-right: 8px; cursor: pointer; }
.small { font-size: 11px; line-height: 1.7; color: var(--muted); overflow-wrap: anywhere; }
#browser-firmware-field .small { margin: -8px 0 20px; }
.file-actions { display: flex; gap: 8px; }
.file-button { position: relative; border: 1px solid #dedee4; border-radius: 7px; font-size: 12px; color: #55555c; padding: 9px 13px; cursor: pointer; overflow: hidden; }
.file-button:hover { background: var(--brand-soft); }
.file-button:has(input:disabled) { opacity: .45; cursor: default; }
.file-button input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: inherit; }
#browser-progress-status { margin: 9px 0 17px; }
progress { width: 100%; height: 5px; accent-color: var(--brand); }
.primary { width: 100%; background: var(--brand); border-color: var(--brand); color: #fff; min-height: 46px; font-size: 14px; font-weight: 550; }
.primary:is(:hover, :active):enabled { background: var(--brand-hover); border-color: var(--brand-hover); }
.status { font-size: 11px; color: var(--muted); line-height: 1.7; min-height: 19px; margin: 12px 0 0; }
.error { background: #fff1ef; color: #a12618; font-size: 12px; border: 1px solid #f3d5d0; }
.text-button { background: transparent; border: 0; min-height: 30px; color: var(--brand); padding: 4px 0; font-size: 12px; }
.text-button:is(:hover, :active):enabled { color: var(--brand-hover); }
.management { padding: 4px 25px 11px; }
details { border-top: 1px solid #ebebef; }
summary { padding: 15px 0; font-size: 12px; list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; color: #515158; }
summary::-webkit-details-marker { display: none; }
summary > span { color: #9999a0; font-size: 15px; }
details[open] > summary > span { transform: rotate(45deg); }
.detail-content { padding-bottom: 14px; }
.hardware-settings { margin: -4px 0 16px; }
.hardware-settings .field { margin-bottom: 8px; }
.hardware-settings .small { margin: 0; }
.controls { display: flex; flex-wrap: wrap; gap: 7px; }
.controls button { font-size: 11px; padding: 7px 9px; min-height: 35px; }
.check { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.check input { accent-color: var(--brand); }
.danger { color: #b32929; font-size: 12px; }
h2 { font-size: 12px; font-weight: 550; }
pre { background: #f5f5f7; color: #52525a; border-radius: 8px; padding: 12px; max-height: 240px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 10px; line-height: 1.6; }
.device-area { min-width: 0; }
.stage-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 1px 5px 10px; }
.device-state { display: flex; gap: 7px; align-items: center; font-size: 11px; color: var(--muted); }
.device-state i { width: 5px; height: 5px; border-radius: 50%; background: #aeafb6; }
body[data-session=running] .device-state i { background: #3e9868; }
.view-actions { display: flex; align-items: center; gap: 8px; }
.segmented { display: flex; border: 1px solid #e0e0e6; padding: 3px; border-radius: 9px; background: #eaeaef; }
.segmented button { padding: 4px 14px; min-height: 27px; font-size: 11px; background: transparent; border: 0; border-radius: 6px; color: #76767f; }
.segmented button[aria-pressed=true] { background: white; box-shadow: 0 1px 3px #00000010; color: #242429; }
.home-view { min-height: 34px; width: 34px; padding: 0; background: transparent; border: 0; font-size: 21px; color: #74747b; }
.stage { position: relative; height: min(570px, calc(100svh - 205px)); min-height: 380px; border: 1px solid #e4e4ea; border-radius: 24px; background: radial-gradient(ellipse at 50% 40%, #fff 0%, #fafafb 65%, #f0f0f4 100%); overflow: hidden; }
.model-host { position: absolute; inset: 0; touch-action: none; }
.model-host canvas { width: 100%; height: 100%; display: block; }
.stage[data-view=flat] .model-host { display: none; }
.flat-device { position: absolute; inset: 32px; display: grid; place-items: center; }
.flat-shell { position: relative; flex: none; }
.flat-body { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; user-select: none; filter: drop-shadow(0 15px 18px #20212c20); }
.flat-shell[data-skin=missing] { background: #292a2d; border-radius: 10px; }
.flat-shell[data-skin=missing] .flat-body { visibility: hidden; }
.screen { position: absolute; border: 0; padding: 0; overflow: hidden; background: #e8e6dd; }
#browser-screen { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.flat-keys { position: absolute; inset: 0; pointer-events: none; }
.flat-key { position: absolute; min-height: 0; min-width: 0; max-width: none; border: 0; padding: 0; border-radius: 3px; background: transparent; touch-action: none; pointer-events: auto; }
.flat-key::before { content: ''; position: absolute; width: 100%; height: 100%; min-width: 24px; min-height: 24px; left: 50%; top: 50%; transform: translate(-50%, -50%); border-radius: inherit; }
.flat-key:hover:enabled { background: transparent; }
.flat-key:hover:enabled::before { background: #ffffff26; }
.flat-key[aria-pressed=true]:enabled::before { background: #a8502f5e; box-shadow: 0 0 0 1px var(--brand); }
.flat-key:focus-visible { outline: none; }
.flat-key:focus-visible::before { outline: 3px solid var(--brand); outline-offset: 2px; }
.flat-key.round-key { border-radius: 50%; }
.stage[data-view="3d"] .flat-device { visibility: hidden; pointer-events: none; }
.model-hint { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); border-radius: 20px; font-size: 11px; padding: 7px 13px; background: #ffffffed; color: #55555c; pointer-events: none; white-space: nowrap; }
.model-hint:empty { display: none; }
.stage-caption { display: flex; justify-content: space-between; gap: 10px; padding: 11px 5px 13px; color: #8a8a93; font-size: 10px; line-height: 1.6; }
.stage-caption p { margin: 0; }
.stage-caption > span { text-align: right; }
.log-panel, .keyboard-panel { margin: 0 5px; }
.log-panel summary, .keyboard-panel summary { padding: 11px 0; font-size: 11px; }
.keyboard-panel[open] > summary > span { transform: none; }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-width: 360px; margin: 4px auto 12px; }
.keys button { min-height: 44px; touch-action: none; user-select: none; font-size: 11px; }
.keys button[aria-pressed=true] { background: var(--brand-hover); color: white; border-color: var(--brand-hover); }
.keyboard-panel .small { text-align: center; }
.save-note { margin: 8px 0; color: #92929a; font-size: 10px; text-align: center; }
footer { padding: 28px; text-align: center; font-size: 10px; color: #a1a1a8; }
@media (max-width: 800px) {
  .app-header { padding: 0 20px; height: 65px; }
  .privacy { display: none; }
  .workspace { grid-template-columns: 1fr; padding: 0 16px; margin-top: 7px; gap: 22px; }
  .setup { padding: 24px 22px 18px; }
  h1 { font-size: 28px; white-space: normal; }
  h1 br { display: none; }
  .intro { margin: 9px 0 20px; }
  .management { padding: 0 22px 6px; }
  .stage { height: 510px; min-height: 380px; }
  body[data-session=running] .sidebar { display: contents; }
  body[data-session=running] .setup { grid-row: 1; background: #fff; border: 1px solid #e6e6eb; border-radius: 17px; padding: 16px; }
  body[data-session=running] .setup :is(.eyebrow, h1, .intro, .field, .books-picker, .hardware-settings) { display: none; }
  body[data-session=running] .device-area { grid-row: 2; }
  body[data-session=running] .management { grid-row: 3; padding: 0 12px; }
  .stage-caption { font-size: 9px; }
  footer { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
