/* Settings and help: fixed-size dialogs with tabs, in the entry screen's card style.
   Width and height are set, never taken from the content, so a tab switch or the
   teacher-only row cannot resize the box. Only a very short window scrolls the tab body. */
.panel-dialog{--pd-w:680px;--pd-h:500px;width:min(var(--pd-w),calc(100vw - 32px));height:min(var(--pd-h),calc(100dvh - 32px));max-width:none;max-height:none;margin:auto;padding:0;overflow:hidden;color:#f3f2e8;background:#0f1923;border:1px solid #4a5967;border-radius:8px;box-shadow:0 24px 64px #02060ba6;word-break:keep-all;overflow-wrap:break-word}
.panel-dialog[open]{display:flex;flex-direction:column}
.help-dialog{--pd-w:900px;--pd-h:600px}

.pd-head{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:20px 28px 6px}
.pd-head h2{margin:0;font-size:26px;line-height:1.2;letter-spacing:-.4px}
.pd-close{min-height:44px;padding:8px 18px;font-size:16px;background:transparent;border:1px solid #4a5967;border-radius:6px}
.pd-close:hover{background:#1a2836;border-color:#8192a0}

.pd-tabs{display:flex;gap:28px;padding:0 28px;border-bottom:1px solid #2c3a47}
.pd-tabs [role=tab]{position:relative;min-height:52px;padding:0 2px;background:none;border:0;border-radius:4px 4px 0 0;color:#9fb0bd;font-size:18px;font-weight:650}
.pd-tabs [role=tab]::after{content:'';position:absolute;left:0;right:0;bottom:-1px;height:3px;border-radius:2px 2px 0 0;background:transparent}
.pd-tabs [role=tab]:hover{background:none;color:#f3f2e8}
.pd-tabs [role=tab][aria-selected=true]{color:#f3f2e8}
.pd-tabs [role=tab][aria-selected=true]::after{background:var(--accent)}
.pd-tabs [role=tab]:focus-visible{outline-offset:2px}

.pd-body{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:6px 28px 20px}
.pd-panel{min-height:100%}
.pd-panel[hidden]{display:none}
.pd-panel:focus-visible{outline:3px solid var(--accent);outline-offset:4px;border-radius:2px}

/* Settings rows: a name, one line on what it does, and the control on the right. */
.set-list{display:flex;flex-direction:column}
.set-row{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:24px;margin:0;padding:16px 0;border-top:1px solid #243240;font-size:16px;color:inherit;cursor:pointer}
.set-row:first-child{border-top:0}
div.set-row{cursor:default}
.set-text{display:flex;flex-direction:column;gap:4px;min-width:0;color:inherit;font-size:inherit}
.set-text b{font-size:19px;font-weight:650;line-height:1.3;color:#f3f2e8}
.set-text small{font-size:16px;line-height:1.45;color:#aebac5}
.set-more{display:flex;flex-wrap:wrap;align-items:center;gap:4px 12px;margin:auto 0 0;padding-top:16px;border-top:1px solid #243240;font-size:16px;line-height:1.5;color:#aebac5}
.set-more .text-button{font-size:16px}

.switch{appearance:none;-webkit-appearance:none;position:relative;flex-shrink:0;width:56px;height:32px;min-height:0;margin:0;padding:0;border:1px solid #6a7a86;border-radius:999px;background:#223140;cursor:pointer;transition:background-color .15s ease-out,border-color .15s ease-out}
.switch::before{content:'';position:absolute;top:3px;left:3px;width:24px;height:24px;border-radius:50%;background:#b9c5ce;box-shadow:0 1px 3px #0007;transition:transform .18s cubic-bezier(.25,1,.5,1),background-color .15s ease-out}
.switch:checked{background:var(--accent);border-color:var(--accent)}
.switch:checked::before{transform:translateX(24px);background:#fffdf4}
.set-row:hover .switch:not(:checked){border-color:#9aa9b4}

.seg{display:inline-grid;grid-auto-flow:column;grid-auto-columns:minmax(78px,auto);gap:4px;padding:4px;background:#0a131c;border:1px solid #3d4c59;border-radius:8px}
.seg label{position:relative;display:block;margin:0;font-size:16px;color:#c9d3dc;cursor:pointer}
.panel-dialog .seg input{position:absolute;inset:0;width:100%;height:100%;min-height:0;margin:0;padding:0;border:0;opacity:0;cursor:pointer}
.seg span{display:grid;place-items:center;min-height:44px;padding:0 14px;border-radius:5px;font-size:16px;font-weight:600;color:inherit;white-space:nowrap}
.seg label:hover span{background:#1a2734;color:#f3f2e8}
.seg input:checked+span{background:#f1f0e5;color:#17232b;font-weight:750}
.seg input:focus-visible+span{outline:3px solid var(--accent);outline-offset:2px}

/* Help › 조작: the keyboard picture (key-guide.js) and a few notes. */
.help-keys{container-type:inline-size;display:flex;flex-direction:column;gap:18px;padding-top:12px}
.keyboard{display:grid;grid-template-columns:repeat(64,minmax(0,1fr));grid-auto-rows:52px;row-gap:6px;padding:12px 9px;background:#0a131c;border:1px solid #2a3846;border-radius:10px}
.kb-key{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;margin:0 3px;min-width:0;border:1px solid #273644;border-radius:6px;background:#141f2a;box-shadow:inset 0 -2px 0 #0b131a;color:#5f6f7c;font-size:15px;line-height:1.05;white-space:nowrap}
.kb-key b{font-weight:600}
.kb-key.is-wide:not(.is-used){align-items:flex-start;padding-left:9px;font-size:12.5px}
.kb-key.is-blank{background:#111b25}
.kb-key.is-used{background:var(--accent);border-color:#f2d27a;box-shadow:inset 0 -3px 0 #b48d2c;color:#17212a}
.kb-key.is-used b{font-size:18px;font-weight:800}
.kb-key.is-used small{font-size:13.5px;font-weight:700;color:#433510}
.key-list{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.key-list,.key-notes{list-style:none}
.key-notes{display:grid;gap:12px;margin:0;padding:0}
.key-notes li{display:grid;grid-template-columns:84px minmax(0,1fr);align-items:start;gap:14px}
.key-notes p{margin:0;font-size:17px;line-height:1.55;color:#d5dde3;padding-top:3px}
.panel-dialog kbd{display:inline-grid;place-items:center;min-width:34px;height:32px;margin:0;padding:0 9px;border:1px solid #5b6b78;border-bottom-width:3px;border-radius:6px;background:#172431;font:700 15px/1 "Segoe UI","Malgun Gothic",sans-serif;color:#f3f2e8;opacity:1}
.note-touch{display:inline-grid;place-items:center;height:32px;padding:0 10px;border:1px dashed #6a7a86;border-radius:6px;font-size:15px;font-weight:700;color:#d5dde3}

/* Help › 경기 규칙, 학생·선생님: two columns of short lines. */
.help-cols{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-content:start;gap:0 40px;padding-top:16px}
.help-cols h3{margin:0 0 10px;font-size:18px;line-height:1.3;color:#f3f2e8}
.help-cols ul+h3{margin-top:20px}
.rule-list{margin:0;padding:0;list-style:none}
.rule-list li{position:relative;margin:0 0 8px;padding-left:16px;font-size:17px;line-height:1.5;color:#d5dde3}
.rule-list li::before{content:'';position:absolute;left:2px;top:.68em;width:5px;height:5px;border-radius:50%;background:#7f909d}
.rule-list .rule-strong{font-weight:700;color:var(--accent)}
.panel-dialog .ui-name{font-weight:700;color:#f3f2e8;white-space:nowrap}
.rule-list a{color:#b9d6e4;font-size:inherit;text-underline-offset:3px}
.rule-list kbd{height:26px;min-width:28px;padding:0 7px;font-size:14px;vertical-align:1px}
.boost-table{width:100%;margin:0 0 14px;border-collapse:collapse;font-size:17px;font-variant-numeric:tabular-nums}
.boost-table th,.boost-table td{padding:7px 10px;border-bottom:1px solid #2c3a47;text-align:left;line-height:1.35;font-family:inherit}
.boost-table thead th{padding-top:0;font-size:14px;font-weight:650;color:#9fb0bd}
.boost-table tbody th{padding-left:0;font-size:16px;font-weight:500;color:#aebac5;white-space:nowrap}
.boost-table td{font-weight:650;color:#f3f2e8}

@container (max-width:759px){
 .keyboard{display:none}
 .key-list{position:static;width:auto;height:auto;margin:0;overflow:visible;clip-path:none;white-space:normal;display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:10px 24px;padding:0}
 .key-list li{display:grid;grid-template-columns:152px minmax(0,1fr);align-items:center;gap:12px;font-size:16px;color:#d5dde3}
 .key-list .keys{display:flex;gap:5px}
}
@media(max-width:640px){
 .panel-dialog{width:calc(100vw - 24px);height:min(var(--pd-h),calc(100dvh - 24px))}
 .settings-dialog{--pd-h:660px}
 .set-row{padding:14px 0}
 .help-dialog{--pd-h:100dvh}
 .pd-head{padding:16px 20px 4px}
 .pd-head h2{font-size:23px}
 .pd-tabs{gap:20px;padding:0 20px;overflow-x:auto}
 .pd-tabs [role=tab]{font-size:17px;white-space:nowrap}
 .pd-body{padding:4px 20px 16px}
 div.set-row{grid-template-columns:minmax(0,1fr);gap:12px}
 .seg{display:grid;grid-auto-columns:minmax(0,1fr);width:100%}
 .set-row{gap:16px}
 .help-cols{grid-template-columns:minmax(0,1fr)}
 .help-cols .rule-col+.rule-col{margin-top:20px}
 .key-notes li{grid-template-columns:64px minmax(0,1fr);gap:10px}
 .key-notes p{font-size:16px}
}
.switch:disabled{opacity:.6;cursor:not-allowed}
