.appearance-editor details { padding: 10px 0; border-bottom: 1px solid var(--control-border); }
.appearance-editor summary { font-size: 15px; font-weight: 700; cursor: pointer; min-height: 32px; padding-top: 8px; }
.style-group { min-width: 0; margin: 12px 0; padding: 12px; border: 1px solid var(--control-border); border-radius: 8px; display: grid; gap: 10px; }
.style-group legend { font-weight: 700; padding: 0 4px; }
.style-field, .check-field { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.style-field > span:first-child { flex: 1; }
.style-field input[type="number"] { width: 88px; }
.style-field select { max-width: 60%; }
.style-field input[type="text"] { width: 55%; }
.color-row { display: inline-flex; align-items: center; gap: 8px; }
.editor-note { font-size: 13px; line-height: 1.5; color: var(--muted-fg); }
.editor-note.is-error { color: #c62828; }
.appearance-row { padding: 10px; margin: 8px 0; background: var(--control-bg); border: 1px solid var(--control-border); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; border-radius: 8px; }
.appearance-row label, .sample-fields label, .variable-options label { min-width: 0; display: grid; gap: 4px; }
.appearance-row input, .sample-fields input, .sample-fields select { box-sizing: border-box; max-width: 100%; }
.appearance-editor button, .appearance-editor input:not([type="checkbox"]), .appearance-editor select { min-height: 36px; }
.appearance-editor button { cursor: pointer; }
.appearance-editor :focus-visible { outline: 2px solid #1976d2; outline-offset: 2px; }
.appearance-editor button:disabled { opacity: .5; cursor: default; }
.secondary-previews { display: grid; align-content: start; gap: 16px; min-width: 0; max-height: 100%; overflow: auto; }
.timer-preview-panel { padding: 14px; background: var(--panel-bg); color: var(--panel-fg); border: 1px solid var(--panel-border); border-radius: 10px; min-width: 0; }
.timer-preview-panel h2 { margin: 0 0 12px; font-size: 16px; }
#timerPreviewViewport { position: relative; aspect-ratio: 16 / 9; width: 100%; overflow: hidden; border-radius: 6px; }
#timerPreviewStage { position: absolute; width: 1920px; height: 1080px; transform-origin: top left; }
.timer-preview-header { height: var(--header-height); background: #111; color: #fff; font-size: 48px; padding: 12px; box-sizing: border-box; }
.sample-fields, .variable-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 10px 0; font-size: 13px; }
.sample-fields input, .sample-fields select { width: 100%; min-height: 36px; }
.editor-status-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 800; line-height: 1.15; text-align: center; overflow-wrap: anywhere; }
.score-layer > .editor-status-label.is-in-layer { position: static; inset: auto; justify-self: center; align-self: center; white-space: nowrap; }
.score-layer > .editor-status-label.is-in-layer span { white-space: nowrap; }
.editor-status-label[hidden], .score-layer[hidden], .editor-win-badge[hidden], .editor-score-bar[hidden], .editor-wrong-marks[hidden] { display: none; }
.editor-wrong-marks { flex-shrink: 0; }  /* 大きさは shared/scores.css の .wrong-marks（基準幅200pxで16px）で本番と共通 */
.editor-score-bar[data-side="right"] { left:auto; right:0; }
.editor-win-badge { position:absolute; top:8px; right:8px; z-index:4; width:1.6em; height:1.6em; display:grid; place-items:center; border-radius:50%; color:#111; background:var(--sample-adv-color); box-shadow:0 0 12px var(--sample-adv-color); font-size:20px; }
 .card.is-advanced[data-advancing="highlight"] > .card-fx { background:color-mix(in srgb,var(--sample-adv-color) 22%,transparent); }
.card.is-lose[data-elimination="dim"] { filter:brightness(var(--sample-elim-brightness, .45)); }  /* 本番と同じくカード全体を暗くする */
.card.is-lose[data-elimination="cross"] > .card-fx { background:linear-gradient(to top right,transparent calc(50% - 3px),var(--sample-elim-color) calc(50% - 3px),var(--sample-elim-color) calc(50% + 3px),transparent calc(50% + 3px)),linear-gradient(to bottom right,transparent calc(50% - 3px),var(--sample-elim-color) calc(50% - 3px),var(--sample-elim-color) calc(50% + 3px),transparent calc(50% + 3px)),rgba(0,0,0,.42); }
.card.is-locked[data-lock-style="dim"]::before { background:var(--page-bg); opacity:.48; box-shadow:none; z-index:2; }
.editor-custom-header { position: absolute; overflow: hidden; pointer-events: none; white-space: pre-wrap; z-index: 10; }
@media (max-width: 800px) {
  body { overflow: auto; height: auto; min-height: 100svh; }
  main { flex: none; height: auto; }
  .workspace { display: flex; flex-direction: column; }
  .preview-stack { width: 100%; min-height: 540px; }
  .panel { width: 100%; max-height: none; }
}

.appearance-editor .style-field { display: flex; flex-direction: row; justify-content: space-between; align-items: center; }
.appearance-editor .check-field { display: flex; flex-direction: row; justify-content: flex-start; align-items: center; }
.appearance-editor .style-field select { width: 56%; max-width: 56%; min-width: 90px; }
.appearance-editor .style-field input[type="number"] { flex: 0 0 88px; width: 88px; }
.appearance-editor .style-field input[type="text"] { width: 56%; }
.appearance-editor .color-row { flex: 0 0 auto; }
.appearance-editor .style-field input[type="color"] { width: 48px; }

#editorTimerLayer { position: fixed; inset: 0; z-index: 55; pointer-events: none; }
#editorTimerPreview { pointer-events: auto; }
.timer-drag-handle { position: absolute; inset: 0; width: 100%; height: 100%; border: 1px dashed transparent; background: transparent; cursor: grab; touch-action: none; -webkit-user-select: none; user-select: none; border-radius: inherit; color: inherit; }
.timer-drag-handle:hover, .timer-drag-handle:focus-visible { border-color: currentColor; background: transparent; outline: 2px solid #1976d2; outline-offset: 2px; }
.timer-drag-handle.is-dragging { cursor: grabbing; }
.is-setting-selected { outline: 2px solid #1976d2; outline-offset: 4px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.editor-custom-header { pointer-events: auto; cursor: pointer; }

.preview-stack .name { position: relative; }
.preview-stack .name-text { position: absolute; top: 50%; left: 50%; transform-origin: center; }

/* 既存パネルの入力・ボタンと同じ寸法、色、間隔に統一する。 */
.appearance-editor .room-link-section { display: block; }
.room-link-section[open] > :not(summary) { margin-top: 12px; margin-bottom: 0; }
.room-link-section #editorRoomForm { display: grid; gap: 12px; }
.appearance-editor .room-link-section label { display: grid; gap: 6px; font-size: 13px; font-weight: 500; }
.appearance-editor .room-link-section input:not([type="checkbox"]),
.appearance-editor .room-link-section select { display: block; box-sizing: border-box; width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--control-border); border-radius: 6px; background: var(--field-bg); color: var(--panel-fg); font: inherit; }
.appearance-editor .room-link-section .button-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; gap: 8px; }
.appearance-editor .room-link-section button { display: flex; align-items: center; justify-content: center; box-sizing: border-box; width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--control-border); border-radius: 6px; background: var(--control-bg); color: var(--panel-fg); font: inherit; font-size: 13px; line-height: 1.5; text-align: center; cursor: pointer; }
.appearance-editor .room-link-section button:not(:disabled):hover { background: var(--hover-bg); }
.appearance-editor .room-link-section #editorConnect,
.appearance-editor .room-link-section #applyRoomAppearance,
.appearance-editor .room-link-section #savePhaseAppearance { background: #1976d2; border-color: #1976d2; color: #fff; }
.appearance-editor .room-link-section #editorConnect:not(:disabled):hover,
.appearance-editor .room-link-section #applyRoomAppearance:not(:disabled):hover,
.appearance-editor .room-link-section #savePhaseAppearance:not(:disabled):hover { background: #1565c0; }
.appearance-editor .room-link-section .toggle-row { display: flex; flex-direction: row; align-items: center; gap: 8px; min-height: 32px; }
.appearance-editor .room-link-section input[type="checkbox"] { flex: 0 0 auto; width: 18px; height: 18px; margin: 0; accent-color: #1976d2; }
.room-link-section #editorLinkStatus { padding: 10px 12px; border-radius: 6px; background: var(--control-bg); overflow-wrap: anywhere; }

#visibilityEditorForm { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; padding: 12px 0; }
.appearance-editor .visibility-toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; line-height: 1.5; min-width: 0; }
.visibility-toggle input { margin: 0; flex: 0 0 auto; accent-color: #1976d2; }
.header-box.is-content-hidden [data-header-text], .header-box.is-content-hidden .header-logo-image { visibility:hidden; }
.header-box.is-content-hidden::after { content: '非表示'; font-size: 10px; position: absolute; right: 0; top: 0; opacity: .6; }
header.is-preview-hidden { opacity: .25; }
.name-text[hidden], .score-number[hidden] { display: none !important; }

.card > .card-top, .card > .name, .card > .score-area, .card > .editor-wrong-marks { position: relative; z-index: 1; }
.card[data-layout="score"] > .card-top { order: 0; }
.card[data-layout="score"] > .score-area { order: 1; border-top-width: 0; border-bottom: 1px solid; }
.card[data-layout="score"] > .name { order: 2; }
.card[data-layout="score"] > .editor-wrong-marks { order: 3; }
.card.has-rank-band { padding-top: calc(var(--sample-rank-band-height) + 8px); }
.card.has-rank-band > .card-top { position: static; }
.card.has-rank-band .rank { position: absolute; inset: 0 0 auto; height: var(--sample-rank-band-height); display: grid; place-items: center; z-index: 2; background: rgba(127,127,127,.18); }

#componentNavigator { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 8px 0 16px; }
#componentNavigator button { min-height: 38px; padding: 6px; border: 1px solid var(--control-border); border-radius: 6px; background: var(--field-bg); color: var(--panel-fg); font: inherit; font-size: 12px; cursor: pointer; }
#componentNavigator button[aria-pressed="true"] { color: #fff; background: #1976d2; border-color: #1976d2; }
.part-settings-body { display: grid; gap: 12px; padding: 12px 0; }
.part-settings .control-section { padding: 0; border: 0; margin: 0; }
.part-settings-body > label { display: grid; gap: 6px; }
.part-settings-body [data-part-visibility] { display: grid; gap: 6px; }
.part-settings .visibility-toggle { display: flex; gap: 8px; align-items: center; min-height: 32px; }
#scoreComponentList { display: flex; gap: 6px; flex-wrap: wrap; }
#scoreComponentList button { min-height: 36px; padding: 6px 10px; border: 1px solid var(--control-border); background: var(--field-bg); color: var(--panel-fg); border-radius: 6px; cursor: pointer; }
#componentSelectionBox { position: fixed; z-index: 70; box-sizing: border-box; border: 2px solid #1976d2; pointer-events: none; }
#componentSelectionBox[hidden] { display: none; }
#componentSelectionBox > span { position: absolute; left: -2px; bottom: 100%; padding: 3px 6px; background: #1976d2; color: #fff; font-size: 11px; line-height: 1.3; white-space: nowrap; }
.draggable-card-part { cursor: grab; touch-action: none; -webkit-user-select: none; user-select: none; }
.draggable-card-part.is-dragging { cursor: grabbing; }

.part-settings label[hidden] { display: none !important; }

.editor-history-actions { display: flex; align-items: center; gap: 6px; }
.editor-history-actions button { min-height: 34px; padding: 6px 10px; border: 1px solid var(--control-border); border-radius: 6px; background: var(--field-bg); color: var(--panel-fg); font: inherit; font-size: 13px; cursor: pointer; }
.editor-history-actions button:disabled { opacity: .4; cursor: default; }

.panel { background: var(--page-bg); }

/* 設定パネルを保ったまま、見えている部品に同じ等比縮小を適用する。 */
body > header, .preview-stack, #editorTimerLayer { scale:var(--editor-stage-scale, 1); transform-origin:center; }
.preview-stack { position:relative; background:var(--editor-stage-bg, #000000); }
#editorTimerLayer.is-header-position { transform-origin:50% calc(var(--header-height) / 2); }

/* ── 見本の表示領域（2026-11-26）。閲覧画面はこの見本に合わせる（style.css の .score-board / 縮小）。
   表示領域＝ヘッダーの下から画面下端まで。上余白12px・下余白28px、カードの高さ＝領域の高さ−40px−底辺を上げる。
   画面周囲の余白の縮小は、ヘッダー・表示領域それぞれの中心が基準（ヘッダーは上端に残る）。 */
@media (min-width: 801px) {
  body {
    --editor-header-actual: max(76px, var(--header-height));
    --editor-panel-space: calc(clamp(340px, 36vw, 480px) + 32px);
  }
  .preview-stack {
    position: fixed;
    top: var(--editor-header-actual);
    left: 0;
    width: calc(100vw - var(--editor-panel-space));
    height: calc(100vh - var(--editor-header-actual));
    margin: 0;
    padding: 12px 20px 28px;
    box-sizing: border-box;
    align-content: start;
    transform-origin: center;
  }
  .preview-stack > .card {
    height: max(260px, calc(100vh - var(--editor-header-actual) - 40px - var(--card-bottom-offset)));
  }
  /* 表示領域を固定配置にしても、設定パネルは右の列に置く（左列へ回り込んで見本の裏に入らないように）。 */
  .workspace > .panel { grid-column: 2; }
  /* 注意の帯は設定パネルの下端に出す（見本の表示領域に重ねない）。 */
  .maximize-note {
    position: fixed;
    right: 0;
    bottom: 0;
    z-index: 70;
    width: var(--editor-panel-space);
  }
}

/* 高さ調整のつまみは、指したとき・キーボードで選んだとき・操作中だけ見せる（本番に無い線を見本に出さない）。 */
.header-resize-handle::before, .score-resize-handle::before { opacity: 0; transition: opacity .15s; }
.header-resize-handle:hover::before, .header-resize-handle:focus-visible::before, .header-resize-handle:active::before,
.score-resize-handle:hover::before, .score-resize-handle:focus-visible::before, .score-resize-handle:active::before { opacity: .45; }

/* 本番は誤答バーを毎回描き直すため伸びるアニメーションが無い。見本も同じにする。 */
.editor-wrong-marks .wrong-bar-fill { transition: none; }

/* 変数・表示文字の一覧：各項目の右に削除（×）。 */
#scoreComponentList .score-list-item { display: inline-flex; align-items: stretch; }
#scoreComponentList .score-list-item > button:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
#scoreComponentList .score-list-delete { min-width: 36px; padding: 6px 8px; border-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; font-weight: 700; }
#scoreComponentList .score-list-delete:hover, #scoreComponentList .score-list-delete:focus-visible { color: #c62828; }
.score-delete-row button:not(:disabled) { color: #c62828; }
