/* ---------- modals (dialog best practices) ----------
   One decision per dialog: the title states it, the body shows the consequence
   BEFORE the buttons, there is exactly one filled primary action named with a
   verb + object, the cost rides as a caption line inside the primary button
   (never crammed into the label, so it can never wrap mid-phrase), secondary
   actions are quiet ghost buttons, destructive actions are red and confirmed,
   and non-critical dialogs dismiss via ×, backdrop tap, or Escape. */
.modal-back{
  position:fixed; inset:0; background:rgba(30,20,10,.52); display:none;
  align-items:center; justify-content:center; z-index:50; padding:16px;
  backdrop-filter:blur(3px); -webkit-backdrop-filter:blur(3px);
}
.modal-back.open{display:flex}
/* sheet modals (settings / zukan / shop) share one structure: a fixed
   header that never scrolls away, and a body that scrolls under it.
   The modal itself is a flex column with no padding; header and body
   own their padding so the header divider spans the full width */
.modal{
  background:var(--panel); color:var(--ink); border-radius:20px; padding:0;
  border:2px solid var(--line);
  max-width:420px; width:100%; max-height:86dvh; overflow:hidden; box-shadow:var(--shadow);
  display:flex; flex-direction:column;
}
.modal-body{
  overflow-y:auto; padding:4px 20px 20px; min-height:0;
  -webkit-overflow-scrolling:touch; overscroll-behavior:contain;
}
.modal.dlg{display:block; padding:22px 20px; overflow-y:auto}
.modal h2{font-size:22px; margin-bottom:8px}
.modal p{line-height:1.6; font-size:14.5px}
.modal-head{
  flex:none; display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:16px 20px 12px; border-bottom:1.5px solid var(--line);
}
.modal-head h2{margin:0}
.x-btn{
  flex:none; width:40px; height:40px; min-width:40px; min-height:40px; border-radius:50%;
  background:var(--bg); border:2px solid var(--line); color:var(--muted);
  font-size:16px; font-weight:900; display:flex; align-items:center; justify-content:center; padding:0;
}
.dlg{text-align:center}
.dlg h2{font-size:21px; line-height:1.35}
.dlg p{margin:8px 0 0}
.dlg-icon{
  width:58px; height:58px; border-radius:50%; margin:0 auto 10px;
  display:flex; align-items:center; justify-content:center;
}
.dlg-icon.danger{background:#F9D9DE; color:var(--danger)}
@media (prefers-color-scheme:dark){
  .dlg-icon.danger{background:#5A2730; color:#FF9DB0}
}
.dlg-actions{display:flex; flex-direction:column; gap:10px; margin-top:18px}
.dlg-actions.row{flex-direction:row}
.dlg-actions.row button{flex:1}
.btn-primary,.btn-ghost,.btn-danger{
  min-height:54px; border-radius:14px; font-weight:900; font-size:16px; padding:10px 14px;
  display:flex; align-items:center; justify-content:center; gap:6px; width:100%;
}
.btn-primary{background:var(--shu); color:#FFF; border:2px solid #A92436; flex-direction:column; gap:2px}
.btn-primary .btn-main{font-size:17px; line-height:1.25; white-space:nowrap}
.btn-primary .btn-sub{font-size:12.5px; font-weight:700; line-height:1.3; opacity:.94; display:flex; align-items:center; gap:5px; white-space:nowrap}
.btn-ghost{background:transparent; color:var(--ink); border:2px solid var(--line)}
.btn-danger{background:var(--danger); color:#FFF; border:2px solid #8E1F2C}
.danger-btn{
  flex:none; border:2px solid var(--danger); color:var(--danger); background:transparent;
  border-radius:999px; font-weight:900; font-size:14.5px; padding:6px 18px; min-height:44px;
}
.set-note{display:block; font-size:12px; color:var(--muted); font-weight:600; margin-top:2px; line-height:1.45}
button:focus-visible{outline:3px solid var(--gold); outline-offset:2px}
.set-row{display:flex; align-items:center; justify-content:space-between; gap:10px; padding:10px 0; border-bottom:1px dashed var(--line)}
.set-row:last-of-type{border-bottom:none}
/* both ON/OFF pills are the SAME fixed width in a fixed right-hand
   slot, so the two rows' labels always line up: the pill never grows
   or shrinks with its text or with the row it sits in, and the BGM
   row's slider (below) absorbs all the width variation instead */
.toggle{width:76px; flex:none; text-align:center; border-radius:999px; border:2px solid var(--line); background:var(--bg); font-weight:900; color:var(--muted); padding:6px 0}
.toggle.on{background:var(--ok); border-color:#2C7A38; color:#FFF}
.vol-wrap{display:flex; align-items:center; gap:10px; flex:1 1 auto; min-width:0; justify-content:flex-end}
.vol-wrap input[type="range"]{flex:1 1 auto; max-width:190px; min-width:0; width:100%; height:32px; accent-color:var(--shu); cursor:pointer}
.vol-val{font-weight:900; min-width:42px; text-align:right; flex:none}
.set-label{display:flex; align-items:center; gap:8px; font-weight:800; flex:none}
.set-ic{display:inline-flex; align-items:center; justify-content:center; color:var(--muted); flex:none}
.set-ic svg{width:22px; height:22px}

/* settings: quiet group labels (sound / data) instead of explanatory
   paragraphs; the destructive reset sits last, visually separated */
.set-group{
  font-size:12px; font-weight:900; letter-spacing:.14em; color:var(--muted);
  margin:16px 0 2px;
}
.set-group:first-child{margin-top:8px}
.set-row.set-danger{margin-top:14px; border-top:1.5px solid var(--line); border-bottom:none; padding-top:14px}
