* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: #f4f7fc; color: #0b1a33; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif; }
.screen-header { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px; flex-shrink: 0; min-height: 66px; padding: 10px 28px; background: #fff; border-bottom: 1px solid #e7edf5; }
.screen-plan { justify-self: start; display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 8px; font-size: .8rem; font-weight: 500; }
.screen-plan strong { font-size: .85rem; font-style: italic; font-weight: 800; }
.screen-plan.is-free { color: #16803d; background: #eaf8ef; }
.screen-title { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0; font-size: 1.325rem; font-weight: 700; line-height: 1.4; }
.screen-title-icon { display: grid; place-items: center; width: 36px; height: 36px; color: #006acd; font-size: 1.5rem; }
.screen-title-icon > i { display: flex; align-items: center; justify-content: center; line-height: 1; }
.screen-open-link { display: inline-flex; align-items: center; gap: 6px; justify-self: end; color: #69798d; font-size: .9rem; text-decoration: none; white-space: nowrap; }
.screen-open-link:hover { color: #006acd; text-decoration: none; }
.screen-main { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 24px; width: 100%; padding: 32px 24px 16px; }
.screen-wrapper { display: flex; flex: 1 0 auto; align-items: center; justify-content: center; width: 100%; }
.screen-card { width: 100%; max-width: 1100px; min-width: 0; padding: 24px 22px 28px; background: #fff; border: 1px solid #e5ebf3; border-radius: 24px; box-shadow: 0 12px 40px rgba(18, 61, 107, .06); }
.screen-intro { margin: 0 0 24px; color: #66758a; font-size: .9rem; line-height: 1.7; text-align: center; }
.screen-info { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.screen-info > div { min-width: 0; padding: 14px 16px; border: 1px solid #eef2f8; border-radius: 14px; background: #f8faff; }
.screen-info span { display: block; margin-bottom: 8px; color: #66758a; font-size: .75rem; }
.screen-info strong { display: block; color: #315d8d; font-size: 1.1rem; font-weight: 650; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.screen-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 320px); gap: 24px; }
.screen-layout > div { min-width: 0; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.screen-layout h2 { margin: 0; font-size: 1rem; font-weight: 650; line-height: 1.5; }
.settings-panel > h2 { margin-bottom: 14px; }
.muted { color: #8895a7; font-size: .8rem; font-variant-numeric: tabular-nums; }
.preview-area { position: relative; overflow: hidden; border: 1px solid #d2dce9; border-radius: 18px; background: #fff; }
#screenPreview { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; }
.preview-start { position: absolute; right: 14px; bottom: 14px; display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 8px 12px; border: 1px solid #d2dce9; border-radius: 10px; background: rgba(255,255,255,.95); color: #006acd; font: inherit; font-size: .82rem; cursor: pointer; }
.preview-caption { margin-top: 14px; }
.preview-caption strong { color: #315d8d; font-size: .9rem; font-weight: 600; }
.preview-caption p, .help { margin: 7px 0 0; color: #66758a; font-size: .8rem; line-height: 1.8; }
.pattern-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.pattern-option { display: flex; min-width: 0; flex-direction: column; align-items: center; justify-content: center; gap: 7px; padding: 9px 4px; border: 1px solid #e0e7f0; border-radius: 10px; background: #fff; color: #66758a; font: inherit; font-size: .75rem; cursor: pointer; }
.pattern-option:hover { border-color: #8ec7ff; background: #f8faff; }
.pattern-option[aria-pressed="true"] { color: #006acd; border-color: #006acd; background: #eef4fe; box-shadow: 0 0 0 1px #006acd; }
.pattern-swatch { width: 28px; height: 22px; border: 1px solid #d2dce9; border-radius: 5px; }
.auto-settings { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 18px 0; color: #4b5a6a; font-size: .8rem; }
.auto-settings label { display: inline-flex; align-items: center; gap: 7px; }
.auto-settings input { width: 16px; height: 16px; accent-color: #006acd; }
.auto-settings select { min-height: 34px; padding: 5px 6px; border: 1px solid #d2dce9; border-radius: 8px; background: #fff; color: #4b5a6a; font: inherit; }
.screen-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; padding: 10px 16px; border: 1px solid #e0e7f0; border-radius: 10px; background: #f4f7fc; color: #4b5a6a; font: inherit; font-size: .86rem; font-weight: 500; cursor: pointer; }
.screen-btn.primary { color: #fff; background: #006acd; border-color: #006acd; box-shadow: 0 4px 14px rgba(0,106,205,.15); }
.screen-btn.primary:hover { background: #0059b3; }
.full-width { width: 100%; }
.screen-status { min-height: 22px; margin: 16px 0 0; color: #16803d; font-size: .82rem; line-height: 1.7; overflow-wrap: anywhere; }
.screen-status.is-error { color: #c43d4b; }
.test-guide { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 8px; padding-top: 20px; border-top: 1px solid #eef2f8; }
.test-guide strong { color: #315d8d; font-size: .85rem; font-weight: 600; }
.test-guide p { margin: 7px 0 0; color: #66758a; font-size: .8rem; line-height: 1.8; }
.screen-tips { flex-shrink: 0; width: 100%; max-width: 1100px; margin-top: auto; padding: 18px 16px 0; border-top: 1px solid #eef2f8; color: #66758a; font-size: .9rem; line-height: 1.8; text-align: center; }
.screen-tips p { margin: 0; }
.screen-stage { position: fixed; inset: 0; width: 100%; height: 100%; overflow: hidden; z-index: 2147483647; background: #fff; outline: 0; touch-action: manipulation; }
.screen-stage:fullscreen { width: 100vw; height: 100vh; padding: 0; border: 0; }
.screen-stage::backdrop { background: #000; }
#stageCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: pointer; }
.screen-stage.controls-hidden, .controls-hidden #stageCanvas { cursor: none; }
.stage-controls { position: absolute; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(760px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow-y: auto; padding: 18px 20px; border: 1px solid rgba(255,255,255,.25); border-radius: 18px; background: rgba(15,23,42,.92); color: #f8fafc; box-shadow: 0 8px 30px rgba(0,0,0,.16); }
.stage-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.stage-heading > div { display: flex; align-items: baseline; gap: 12px; }
.stage-heading strong { font-size: 1rem; }
#stageCounter, #stageMode { color: #cbd5e1; font-size: .78rem; font-variant-numeric: tabular-nums; }
#stageDescription { margin: 10px 0; color: #e2e8f0; font-size: .82rem; line-height: 1.7; }
.stage-notice { margin: 0; color: #fcd9a0; font-size: .78rem; line-height: 1.7; }
.stage-notice:empty { display: none; }
.stage-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.stage-actions button { min-height: 38px; padding: 8px 10px; border: 1px solid #64748b; border-radius: 8px; background: #334155; color: #fff; font: inherit; font-size: .78rem; cursor: pointer; }
.stage-actions button:hover { background: #475569; }
.stage-actions button[aria-pressed="true"] { background: #006acd; border-color: #8ec7ff; }
.stage-actions button:disabled { opacity: .5; cursor: wait; }
.stage-footer { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; margin-top: 12px; color: #cbd5e1; font-size: .72rem; line-height: 1.6; }
.stage-footer a { color: #a6d7ff; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #8ec7ff; outline-offset: 3px; }
@media (max-width: 991.98px) { .screen-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 280px); gap: 20px; } }
@media (max-width: 767.98px) {
    .screen-header { padding: 8px 16px; gap: 10px; }
    .screen-plan { padding: 5px 8px; font-size: .72rem; }
    .screen-title { gap: 7px; font-size: 1.175rem; }
    .screen-title-icon { width: 32px; height: 32px; font-size: 1.3rem; }
    .screen-open-link { font-size: .8rem; }
    .screen-main { padding: 24px 16px 16px; gap: 20px; }
    .screen-card { padding: 18px 16px 22px; border-radius: 22px; }
    .screen-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .screen-info { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .test-guide { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .stage-controls { padding: 14px 12px; bottom: max(12px, env(safe-area-inset-bottom)); }
}
@media (max-width: 575.98px) {
    .screen-header { grid-template-columns: minmax(0, 1fr) auto; }
    .screen-title { grid-column: 1 / -1; grid-row: 1; }
    .screen-plan { grid-column: 1; grid-row: 2; }
    .screen-open-link { grid-column: 2; grid-row: 2; }
    .screen-tips { padding: 18px 12px 0; font-size: .8rem; }
    .screen-info > div { padding: 12px; }
    .screen-info span { font-size: .7rem; }
    .screen-info strong { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
