/* options.css — 게임 옵션 창(src/options.js). 전투 일시정지·필드에서는 창(dialog.opt-dialog), 로비 설정 화면에서는 화면 안(.opt-page)에 같은 판이 놓인다.
   크기는 글자 크기(--o) 기준 em: PC 큰 화면은 --ui-z 배 확대, 휴대폰 프레임은 --read-body 로 커진 글자에 맞춰 함께 커진다. */
.opt {
  --o: 14px;
  --opt-gold: #f0d399; --opt-cream: #fff1c8; --opt-ink: #0b1522; --opt-line: #2c4057; --opt-dim: #9fb2c3;
  box-sizing: border-box; display: flex; flex-direction: column; gap: .55em;
  width: min(46em, calc(100vw - 16px)); max-width: none; max-height: calc(100dvh - 12px);
  margin: auto; padding: .2em .5em .3em; overflow: visible;
  border: 24px solid transparent; border-image: var(--px-window) 24 fill / 24px stretch; border-radius: 0;
  background: none; color: #dfe6f2; box-shadow: 6px 6px 0 #05080f99;
  font: var(--o)/1.45 var(--pixel-font, 'Galmuri11', sans-serif); image-rendering: pixelated;
  user-select: none; -webkit-user-select: none;
}
.opt * { font-family: var(--pixel-font, 'Galmuri11', sans-serif); box-sizing: border-box; }
dialog.opt-dialog::backdrop { background: #050b15c4; }
dialog.opt-dialog[open] { animation: optArrive .16s steps(3, end); }
@keyframes optArrive { from { opacity: 0; translate: 0 6px; } }
html.ui-z dialog.opt-dialog { zoom: var(--ui-z); width: min(46em, calc((100vw - 16px) / var(--ui-z))); max-height: calc((100dvh - 12px) / var(--ui-z)); }
html.vp-touch .opt { --o: var(--read-body); width: min(46em, calc(100vw - 12px)); gap: .35em; border-width: 18px; border-image-width: 18px; }

/* 로비 설정 화면: 판을 화면 가운데에 */
.menu .opt-page { flex: 1 1 auto; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr); place-items: center; padding: 10px 12px 14px; overflow: hidden; }
.menu .opt-page .opt { max-height: 100%; }
.menu .opt-page .opt-head { display: none; }   /* 화면 위 리본(mtop)이 이미 제목이다 */

/* 머리: 붉은 리본 제목 */
.opt .opt-head { position: relative; display: flex; justify-content: center; align-items: center; flex: none; margin: -30px 0 -2px; }
/* 리본(96x19 도트)을 2배로: 높이 38px 고정, 양 끝 26px 꼬리는 52px */
.opt .opt-head h2 { box-sizing: border-box; margin: 0; padding: 0 .4em; min-width: 11em; height: 38px; line-height: 33px; text-align: center; font-size: 1.2em; font-weight: 400; letter-spacing: .6em; text-indent: .6em; color: var(--opt-cream); text-shadow: 2px 2px 0 #3a0a10;
  border: 0 solid transparent; border-width: 0 52px; border-image: var(--px-ribbon) 0 26 fill / 0 52px stretch; }
.opt .opt-x { position: absolute; right: -18px; top: 6px; width: 2.2em; height: 2.2em; padding: 0; color: var(--opt-dim); font-size: 1em;
  border: 6px solid transparent; border-image: var(--px-button) 8 fill / 6px stretch; background: none; cursor: pointer; }

/* 탭 */
.opt .opt-tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: .35em; flex: none; }
.opt .opt-tabs button { min-height: 2.5em; padding: 0 .2em; font-size: 1em; color: var(--opt-dim); cursor: pointer;
  border: 8px solid transparent; border-image: var(--px-button) 8 fill / 8px stretch; border-radius: 0; background: none; box-shadow: 2px 2px 0 #05080f88; }
.opt .opt-tabs button.on { border-image-source: var(--px-gold); color: var(--opt-cream); text-shadow: 1px 1px 0 #3a2408; translate: 0 1px; box-shadow: none; }

/* 항목 */
.opt .opt-body { flex: 1 1 17.2em; min-height: 6.8em; overflow-y: auto; overscroll-behavior: contain; padding: .15em .2em;
  background: #0b1522; box-shadow: inset 0 0 0 2px #05080f, inset 0 0 0 3px #2c4057; scrollbar-width: thin; scrollbar-color: #657885 #0b1522; }
.opt .opt-row { position: relative; display: flex; align-items: center; gap: .8em; min-height: 3.4em; padding: .25em .7em .25em 2.9em; border-bottom: 1px dashed var(--opt-line); }
.opt .opt-row:last-child { border-bottom: 0; }
.opt .opt-row::before { content: ''; position: absolute; left: .45em; top: 50%; width: 24px; height: 30px; margin-top: -15px; background: var(--px-cursor, url(../../assets/ui/kit/cursor.png)) center / 24px 30px no-repeat; opacity: 0; }
.opt .opt-row.sel { background: linear-gradient(90deg, #f0d39926, #f0d39908 70%, transparent); box-shadow: inset 3px 0 0 var(--opt-gold); }
.opt .opt-row.sel::before { opacity: 1; animation: optPoint .7s steps(2, end) infinite; }
@keyframes optPoint { 50% { translate: 2px 0; } }
.opt .opt-name { flex: 1 1 auto; min-width: 0; color: var(--opt-cream); word-break: keep-all; }
.opt .opt-name small { display: block; font-size: .8em; color: #ffb38a; }
.opt .opt-ctl { flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end; gap: .4em; min-width: 21em; }
.opt .opt-row.locked .opt-ctl { opacity: .38; filter: saturate(.3); pointer-events: none; }
.opt .opt-row.locked .opt-name { color: var(--opt-dim); }

.opt .opt-arrow { width: 2.3em; height: 2.3em; padding: 0; font-size: .95em; line-height: 1; color: var(--opt-gold); cursor: pointer;
  border: 6px solid transparent; border-image: var(--px-button) 8 fill / 6px stretch; border-radius: 0; background: none; }
.opt .opt-arrow:active { translate: 0 1px; filter: brightness(1.3); }
.opt .opt-val { position: relative; flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 2.5em; padding: .1em .4em .45em; text-align: center;
  background: #101c2c; box-shadow: inset 0 0 0 1px #05080f, inset 0 0 0 2px #46607a; }
.opt .opt-val b { font-weight: 400; color: var(--opt-cream); white-space: nowrap; }
.opt .opt-val small { font-size: .75em; line-height: 1.2; color: var(--opt-dim); }
.opt .opt-pips { position: absolute; left: 0; right: 0; bottom: 3px; display: flex; justify-content: center; gap: 3px; }
.opt .opt-pips i { width: 4px; height: 2px; background: #33475c; }
.opt .opt-pips i.on { background: var(--opt-gold); }

.opt .opt-seg { display: flex; gap: 0; flex: 1 1 auto; }
.opt .opt-seg button { flex: 1 1 0; min-height: 2.5em; padding: 0 .3em; font-size: 1em; color: var(--opt-dim); cursor: pointer; white-space: nowrap;
  border: 8px solid transparent; border-image: var(--px-button) 8 fill / 8px stretch; border-radius: 0; background: none; }
.opt .opt-seg button[aria-checked="true"] { border-image-source: var(--px-gold); color: var(--opt-cream); text-shadow: 1px 1px 0 #3a2408; }

.opt .opt-bar { flex: 1 1 auto; display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; height: 2.3em; padding: 4px; cursor: pointer; touch-action: none;
  background: #101c2c; box-shadow: inset 0 0 0 1px #05080f, inset 0 0 0 2px #46607a; }
.opt .opt-bar i { background: #1d2c40; box-shadow: inset 0 -2px 0 #131f30; }
.opt .opt-bar i.on { background: #e2b85a; box-shadow: inset 0 2px 0 #ffeaa8, inset 0 -2px 0 #a8782c; }
.opt .opt-num { flex: 0 0 3.2em; text-align: right; font-weight: 400; color: var(--opt-cream); font-variant-numeric: tabular-nums; }

.opt .opt-btn, .opt .opt-ctl button[data-fullscreen] { min-height: 2.5em; padding: 0 1em; font-size: 1em; color: #dfe6f2; cursor: pointer; white-space: nowrap;
  border: 8px solid transparent; border-image: var(--px-button) 8 fill / 8px stretch; border-radius: 0; background: none; box-shadow: 2px 2px 0 #05080f88; }
.opt .opt-ctl button[data-fullscreen], .opt .opt-ctl .opt-btn { flex: 1 1 auto; }
.opt .opt-btn.gold { border-image-source: var(--px-gold); color: var(--opt-cream); text-shadow: 1px 1px 0 #3a2408; }
.opt .opt-btn:disabled, .opt .opt-ctl button:disabled { opacity: .5; cursor: default; }
.opt :is(.opt-btn, .opt-arrow, .opt-seg button, .opt-tabs button, .opt-x, button[data-fullscreen]):hover { filter: brightness(1.15); }
.opt :is(button):focus-visible { outline: 2px solid #ffedaa; outline-offset: 2px; }
.opt .opt-note { flex: 1 1 auto; text-align: right; color: var(--opt-dim); word-break: keep-all; }

/* 조작 탭 */
.opt .opt-keys { display: grid; grid-template-columns: 1.15fr 1fr; gap: .2em 1.2em; padding: .5em .7em; }
.opt .opt-keys h3 { margin: 0 0 .3em; padding-bottom: .2em; font-size: .9em; font-weight: 400; letter-spacing: .2em; color: var(--opt-gold); border-bottom: 1px solid var(--opt-line); }
.opt .opt-keys dl { margin: 0; display: grid; gap: .28em; }
.opt .opt-keys dl > div { display: flex; align-items: baseline; gap: .6em; }
.opt .opt-keys dt { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 3px; min-width: 7.2em; }
.opt .opt-keys dd { margin: 0; font-size: .9em; color: #c5d2e0; word-break: keep-all; }
.opt kbd { display: inline-block; min-width: 1.5em; padding: 0 .35em; font: inherit; font-size: .82em; line-height: 1.5; text-align: center; color: #2a1804; background: #e8d6a4; box-shadow: 0 2px 0 #7c6840, inset 0 0 0 1px #fff2c8; }

/* 설명 · 아래 줄 */
.opt .opt-hint { flex: none; margin: 0; min-height: 3.75em; padding: .35em .7em .35em 2.2em; font-size: .88em; line-height: 1.5; color: #c5d2e0; word-break: keep-all;
  background: #101c2ccc; box-shadow: inset 3px 0 0 #6d9dba; position: relative; }
.opt .opt-hint::before { content: 'i'; position: absolute; left: .7em; top: .45em; width: 1.2em; height: 1.2em; line-height: 1.2em; text-align: center; font-size: .9em; color: #0b1522; background: #6d9dba; }
.opt .opt-foot { flex: none; display: flex; align-items: center; justify-content: flex-end; gap: .5em; }
.opt .opt-guide { margin-right: auto; display: flex; align-items: center; gap: .25em; font-size: .8em; color: var(--opt-dim); white-space: nowrap; }
.opt .opt-guide kbd { margin-left: .5em; } .opt .opt-guide kbd + kbd { margin-left: 0; }
html.vp-touch:not(.kbd) .opt .opt-guide { visibility: hidden; }
.opt .opt-reset { color: var(--opt-dim); }
.opt [hidden] { display: none !important; }

@media (max-width: 620px) {
  .opt .opt-ctl { min-width: 0; flex: 1 1 58%; }
  .opt .opt-keys { grid-template-columns: 1fr; }
  .opt .opt-guide { display: none; }
}
@media (max-height: 430px) {
  .opt { gap: .3em; }
  .opt .opt-row { min-height: 2.9em; }
  .opt .opt-hint { min-height: 1.9em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* 일시정지 창: 메뉴 단추 묶음 */
#pause .pbox button { display: flex; align-items: center; justify-content: center; padding-block: 0; line-height: 1; }

/* 휴대폰 프레임: 닫기 단추가 아래에 있으니 모서리 ✕ 는 감추고, 항목이 한 줄이라도 더 보이게 줄 높이를 줄인다 */
html.vp-touch .opt .opt-x { display: none; }
html.vp-touch .opt .opt-row { min-height: 2.9em; padding-block: .15em; }
html.vp-touch .opt .opt-tabs button { min-height: 2.2em; }
html.vp-touch .opt .opt-hint { min-height: 2.1em; padding-block: .25em; }
