:root { color-scheme: dark; font-family: "Microsoft YaHei", system-ui, sans-serif; background: #121418; color: #ece4d4; }
* { box-sizing: border-box; }
body { margin: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
button, input, select { font: inherit; }
button, .file-button { cursor: pointer; }
button:focus-visible, select:focus-visible, input:focus-visible, .file-button:focus-within, #overlay:focus-visible { outline: 2px solid #d48c4a; outline-offset: 2px; }
button { color: #ece4d4; border: 1px solid #353b46; border-radius: 5px; background: #232730; padding: .48rem .7rem; }
button:hover:not(:disabled), .file-button:hover { background: #2e333e; border-color: #535b6a; }
button:disabled { opacity: .4; cursor: default; }
button.primary { background: linear-gradient(180deg,#c98242,#a8622a); border-color: #d89657; color: #1b120b; font-weight: 700; }
button.primary:hover { background: linear-gradient(180deg,#d8904f,#b76d31); }
.topbar { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 18px; border-bottom: 1px solid #2b303a; background: #16191f; }
.topbar strong { font-size: 1.02rem; letter-spacing: .08em; }
.topbar span { color: #978f82; margin-left: 1em; font-size: .82rem; }
.top-actions { display: flex; gap: 7px; }
.workspace { display: grid; grid-template-columns: 270px minmax(0, 1fr); min-height: 0; flex: 1; }
.sidebar { overflow: auto; background: #191c22; border-right: 1px solid #2d323c; padding: 17px; font-size: .85rem; }
.sidebar > label:first-child { display: block; margin-bottom: 7px; color: #d8d0c5; }
select { display: block; width: 100%; padding: 8px; color: #ece4d4; border: 1px solid #353b46; border-radius: 5px; background: #12151a; }
.subtle { width: 100%; margin-top: 8px; }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin: 23px 0 8px; }
.section-title span { color: #978f82; font-size: .73rem; }
.section-title button { padding: 2px 4px; border: 0; color: #d48c4a; background: transparent; font-size: .76rem; }
.layers { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.layers button { text-align: left; font-size: .8rem; padding: .45rem .55rem; border-color: transparent; background: #232730; }
.layers button.active { background: #35261b; border-color: #d48c4a; color: #f6e3be; }
.coordinates { display: grid; gap: 6px; }
.coordinates label { display: flex; align-items: center; justify-content: space-between; color: #c1bab0; }
.coordinates input { width: 66px; padding: 5px; border: 1px solid #353b46; border-radius: 4px; background: #12151a; color: #f1eee7; text-align: right; }
.scale-label { display: flex; justify-content: space-between; margin: 14px 0 4px; color: #d2c6b3; }
#scale { width: 100%; accent-color: #d48c4a; }
.hint { color: #978f82; font-size: .75rem; line-height: 1.65; }
.files { display: grid; gap: 6px; margin-top: 18px; }
.files button, .file-button { padding: .5rem; border: 1px solid #353b46; border-radius: 5px; background: #1d2129; color: #d9d4cd; font-size: .8rem; text-align: center; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.preview { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #0d0f13; }
.preview-bar { min-height: 50px; display: flex; align-items: center; gap: 16px; padding: 8px 15px; border-bottom: 1px solid #2b303a; background: #16191f; }
.view-switch, .edit-switch { display: flex; gap: 3px; padding: 3px; border-radius: 5px; background: #232730; }
.view-switch button, .edit-switch button { padding: .32rem .65rem; border: 0; background: transparent; font-size: .8rem; color: #a7a096; }
.view-switch button.active, .edit-switch button.active { color: #f6e3be; background: #4a3523; }
#status { overflow: hidden; margin-left: auto; color: #bfb5a5; font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.stage-area { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 22px; overflow: auto; background-color: #0d0f13; background-image: radial-gradient(#262b35 1px, transparent 1px); background-size: 14px 14px; }
.stage-wrap { position: relative; flex: none; overflow: hidden; background: #211810; box-shadow: 0 12px 30px #0008; }
.stage-wrap iframe { position: absolute; top: 0; left: 0; border: 0; transform-origin: top left; }
#overlay { position: absolute; inset: 0; z-index: 2; cursor: crosshair; touch-action: none; }
#overlay.playing { pointer-events: none; }
#selection { position: absolute; border: 2px solid #8ed4ed; box-shadow: 0 0 0 1px #193846; pointer-events: none; }
#selection-label { position: absolute; left: -2px; bottom: 100%; padding: 3px 6px; color: #122a36; background: #8ed4ed; font-size: 12px; white-space: nowrap; }
.resize-handle { position: absolute; width: 16px; height: 16px; right: -8px; bottom: -8px; border: 2px solid #193846; background: #8ed4ed; cursor: nwse-resize; pointer-events: auto; }
[hidden] { display: none !important; }
@media (max-width: 760px) {
  body { height: auto; min-height: 100dvh; overflow: auto; }
  .topbar { align-items: flex-start; flex-wrap: wrap; }
  .top-actions { flex-wrap: wrap; }
  .workspace { display: flex; flex-direction: column-reverse; }
  .sidebar { border-right: 0; border-top: 1px solid #424242; overflow: visible; }
  .preview { min-height: 420px; }
  .preview-bar { flex-wrap: wrap; }
  #status { width: 100%; margin: 0; }
  .stage-area { min-height: 340px; padding: 12px; }
}
