/* Mode-specific parts translated from Paper (file 01M7HCSX8PA6B4BTCTC3DAK1MS, page p-3-0):
   setup dialogs (08 Duel / 10 สนามแข่ง · ตั้งค่า), Duel score row + round dots (09),
   exam nav + set panel (11), practice progress (12). Desktop default, mobile <=760px.
   Load after final.css. `#modal` is in selectors because unslop.css styles `#modal .set-option`. */

/* ---------- Setup dialog · desktop modal ---------- */
dialog#modal.f-dialog{width:min(640px,calc(100vw - 32px));max-width:none;padding:30px 32px 32px;border:0;border-radius:32px;background:#fffaf1;box-shadow:0 8px 0 #c9c3b3,0 30px 60px rgba(0,0,0,.25);color:#273740;font:400 12px/16px IBM,sans-serif}
dialog#modal.f-dialog::backdrop{background:rgba(39,55,64,.55)}
dialog#modal.f-dialog .modal-top{display:flex;align-items:center;justify-content:space-between;gap:16px;margin:0 0 20px}
dialog#modal.f-dialog .modal-top h2{display:flex;align-items:center;gap:16px;margin:0;font:700 32px/40px IBM,sans-serif;color:#273740}
dialog#modal.f-dialog .f-modal-icon{width:72px;height:72px;flex-shrink:0;border-radius:20px;background-color:#e3eefb;background-position:50%;background-repeat:no-repeat;background-size:118%}
dialog#modal.f-dialog .f-modal-icon[style*="icon-arena"]{background-color:#fde7d2;background-size:86%}
dialog#modal.f-dialog .f-modal-name{display:flex;flex-direction:column}
dialog#modal.f-dialog .f-modal-name b{display:block;font:700 32px/40px IBM,sans-serif;color:#273740}
dialog#modal.f-dialog .f-modal-name small{display:block;font:400 16px/20px IBM,sans-serif;color:#5f7179}
dialog#modal.f-dialog .modal-top .icon-button{display:flex;align-items:center;justify-content:center;flex-shrink:0;width:44px;height:44px;padding:0;border:1px solid #d6dcdc;border-radius:14px;background:#fff;box-shadow:0 3px 0 #c7cfcf;color:#273740;font:400 18px/22px IBM,sans-serif;cursor:pointer}
dialog#modal.f-dialog .modal-top .icon-button .ui-mark{font-size:18px;line-height:22px;font-weight:400}
dialog#modal.f-dialog .modal-body{margin:0;font:400 12px/16px IBM,sans-serif}

dialog#modal.f-dialog .f-rules{display:flex;gap:10px;margin:0}
dialog#modal.f-dialog .f-rules>div{flex:1 1 0;min-width:0;display:flex;flex-direction:column;gap:2px;padding:12px 14px;border:1px solid #e3e7ea;border-radius:16px;background:#fff}
dialog#modal.f-dialog .f-rules>div:nth-child(3){flex-grow:1.4}
dialog#modal.f-dialog .f-rules b{display:block;font:700 24px/30px IBM,sans-serif;color:#273740}
dialog#modal.f-dialog .f-rules small{display:block;font:400 13px/16px IBM,sans-serif;color:#5f7179}

dialog#modal.f-dialog .set-picker-label{margin:20px 0 10px;font:700 15px/18px IBM,sans-serif;color:#5f7179}
dialog#modal.f-dialog .set-picker{display:flex;gap:12px;margin:0;grid-template-columns:none}
dialog#modal.f-dialog .set-option{flex:1 1 0;min-width:0;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:0;padding:12px 0;border:1px solid #e3e7ea;border-radius:18px;background:#fff;box-shadow:0 5px 0 #d6dcdc;color:#273740;cursor:pointer;transform:none}
dialog#modal.f-dialog .set-option:hover{background:#fff}
dialog#modal.f-dialog .set-option strong{font:700 19px/24px IBM,sans-serif;color:inherit}
dialog#modal.f-dialog .set-option small{font:400 14px/18px IBM,sans-serif;color:#5f7179}
dialog#modal.f-dialog .set-option[aria-checked="true"]{border-color:transparent;background:#2e87fb;box-shadow:0 5px 0 #1d5fb8;color:#fff}
dialog#modal.f-dialog .set-option[aria-checked="true"] small{color:#dbeaff}
dialog#modal.f-dialog .set-option:active{transform:translateY(3px);box-shadow:0 2px 0 #d6dcdc;border-bottom-width:1px}
dialog#modal.f-dialog .set-option[aria-checked="true"]:active{box-shadow:0 2px 0 #1d5fb8}

dialog#modal.f-dialog .modal-actions{display:flex;align-items:center;justify-content:flex-start;gap:12px;margin:24px 0 0;flex-wrap:nowrap}
dialog#modal.f-dialog .f-modal-note{flex:1 1 0;min-width:0;font:400 14px/18px Mali,IBM,sans-serif;color:#5f7179;text-align:left}
dialog#modal.f-dialog .modal-actions .btn{display:flex;align-items:center;justify-content:center;width:auto;height:58px;min-height:58px;min-width:0;margin:0;border-radius:18px;font-family:IBM,sans-serif;font-weight:700;transform:none}
dialog#modal.f-dialog .modal-actions .btn.ghost,dialog#modal.f-dialog .modal-actions .btn.ghost:hover{padding:0 24px;border:1px solid #d6dcdc;background:#fff;box-shadow:0 4px 0 #c7cfcf;color:#273740;font-size:18px;line-height:22px}
dialog#modal.f-dialog .modal-actions .btn.primary,dialog#modal.f-dialog .modal-actions .btn.primary:hover{padding:0 32px;border:0;background:#ffc83d;box-shadow:0 5px 0 #c99516;color:#273740;font-size:20px;line-height:24px}
dialog#modal.f-dialog .modal-actions .btn.ghost:active{transform:translateY(3px);box-shadow:0 1px 0 #c7cfcf}
dialog#modal.f-dialog .modal-actions .btn.primary:active{transform:translateY(4px);box-shadow:0 1px 0 #c99516}

/* ---------- Duel · score row ---------- */
#app.f-game .f-score.f-score{display:flex;align-items:center;gap:12px;width:100%;margin:0;padding:0;background:none}
#app.f-game .f-score .player{flex:1 1 0;min-width:0;display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:10px;padding:10px 16px;border:0;border-radius:16px;background:#1b3245;box-shadow:inset 0 0 0 2px #2e87fb;color:#fff;text-align:left}
#app.f-game .f-score .player>div{display:flex;flex-direction:column}
#app.f-game .f-score .player.bot{gap:8px;background:#3d2d1a;box-shadow:none}
#app.f-game .f-score .player.bot>div{flex:1 1 auto;align-items:flex-end;text-align:right}
#app.f-game .f-score .player strong{display:block;font:700 17px/22px IBM,sans-serif;color:#fff}
#app.f-game .f-score .player small{display:block;font:400 12px/16px IBM,sans-serif;color:#b5dcf7}
#app.f-game .f-score .player.bot small{color:#ffd9a6}
#app.f-game .f-score .player-score{margin:0;font:700 36px/40px IBM,sans-serif;color:#8fd0ff}
#app.f-game .f-score .player.bot .player-score{color:#ffc070}
#app.f-game .f-score .player img{display:block;flex-shrink:0;width:44px;height:34px;object-fit:contain}
#app.f-game .f-score .versus{flex-shrink:0;font:700 16px/20px IBM,sans-serif;color:#8d9aab}

/* ---------- Duel · round dots ---------- */
#app.f-game .round-dots{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;margin:0}
#app.f-game .round-dots .round-dot{flex-shrink:0;width:10px;height:10px;border:0;border-radius:5px;background:#3a3e44;box-shadow:none}
#app.f-game .round-dots .round-dot.active{width:26px;background:#2ffafe}

/* ---------- Practice · progress bar ---------- */
#app.f-game .practice-progress.f-track{display:flex;width:100%;height:12px;margin:0;border-radius:6px;background:#3a3e44;overflow:hidden}
#app.f-game .practice-progress.f-track>span{height:12px;border-radius:6px;background:#2ffafe}

/* ---------- สนามแข่ง · prev/next row ---------- */
#app.f-game .f-exam-nav.f-exam-nav{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;margin:0}
#app.f-game .f-exam-nav button{min-height:0;margin:0;padding:10px 16px;border:0;border-radius:14px;background:#2d3035;box-shadow:none;color:#d6e2f0;font:600 15px/18px IBM,sans-serif;cursor:pointer}
#app.f-game .f-exam-nav button.f-send{background:#4a3b16;box-shadow:inset 0 0 0 2px #ffc83d;color:#ffd77a;font-weight:700}
#app.f-game .f-exam-nav button:disabled{opacity:.4;cursor:default}
#app.f-game .f-exam-nav .exam-answered-line{margin:0;padding:0;font:400 16px/20px IBM,sans-serif;color:#a9b9cf}
#app.f-game .f-exam-nav .exam-answered-line b{font-weight:700;color:#fff}

/* ---------- สนามแข่ง · set panel below the game ---------- */
/* Paper puts the set panel directly under the game, above the keyboard hint. */
#app.f-game:has(> #exam-controls){display:flex;flex-direction:column}
#app.f-game:has(> #exam-controls)>:not(.countdown){width:100%}
#app.f-game:has(> #exam-controls)>#exam-controls{order:1}
#app.f-game:has(> #exam-controls)>.f-kbd-hint{order:2}
#app.f-game #exam-controls{max-width:1180px;margin:28px auto 0;padding:0}
#app.f-game #exam-controls .panel{position:relative;display:grid;grid-template-columns:170px minmax(0,1fr) auto;align-items:center;column-gap:20px;row-gap:0;margin:0;padding:18px 24px;border:1px solid #e3e7ea;border-radius:24px;background:#fff;box-shadow:0 5px 0 #dfe3e8}
#app.f-game #exam-controls .exam-controls-top{grid-column:1;grid-row:1;display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;gap:0;flex-wrap:nowrap;margin:0}
#app.f-game #exam-controls .exam-controls-top h2{margin:0;font:700 20px/24px IBM,sans-serif;color:#273740}
#app.f-game #exam-controls .exam-controls-top p{margin:0;font:400 13px/16px Mali,IBM,sans-serif;color:#5f7179}
#app.f-game #exam-controls .exam-sections{grid-column:2;grid-row:1;display:flex;gap:10px;margin:0;flex-wrap:nowrap}
#app.f-game #exam-controls .exam-sections button{position:relative;flex:1 1 0;min-width:0;min-height:0;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;row-gap:6px;column-gap:4px;margin:0;padding:10px 14px;border:0;border-radius:16px;background:#f7f8f6;box-shadow:none;color:#273740;font:700 15px/18px IBM,sans-serif;text-align:left;cursor:pointer}
#app.f-game #exam-controls .exam-sections button br{display:none}
#app.f-game #exam-controls .exam-sections button small{font:400 13px/16px IBM,sans-serif;color:#5f7179;text-align:right}
#app.f-game #exam-controls .exam-sections button::after{content:"";grid-column:1/-1;height:6px;border-radius:3px;background:#e6e9ea}
/* Fill reads --p (0–1) on the button; see report — app.js does not set it yet. */
#app.f-game #exam-controls .exam-sections button::before{content:"";position:absolute;z-index:1;left:14px;bottom:10px;height:6px;width:calc((100% - 28px) * var(--p, 0));border-radius:3px;background:#2e87fb}
#app.f-game #exam-controls .exam-sections button[aria-current]{background:#e3eefb;box-shadow:inset 0 0 0 2px #2e87fb;color:#1e61af;font-weight:700}
#app.f-game #exam-controls .exam-sections button[aria-current] small{color:#1e61af;font-weight:600}
#app.f-game #exam-controls .exam-sections button[aria-current]::after{background:#c7dbf3}
#app.f-game #exam-controls details{grid-column:3;grid-row:1;margin:0}
#app.f-game #exam-controls details summary{display:block;min-height:0;list-style:none;font:700 15px/18px IBM,sans-serif;color:#1e61af;white-space:nowrap;cursor:pointer}
#app.f-game #exam-controls details summary::-webkit-details-marker{display:none}
#app.f-game #exam-controls details summary::before,#app.f-game #exam-controls details[open] summary::before{content:none}
#app.f-game #exam-controls details summary::after{content:" ▾"}
#app.f-game #exam-controls details[open] summary::after{content:" ▴"}
#app.f-game #exam-controls details .exam-question-grid{position:absolute;z-index:5;top:calc(100% + 12px);left:0;right:0;margin:0;padding:18px 24px;border:1px solid #e3e7ea;border-radius:24px;background:#fff;box-shadow:0 5px 0 #dfe3e8}
#app.f-game #exam-controls .submit-exam{display:none}

/* ---------- Mobile ---------- */
@media (max-width:760px){
  /* Setup dialog · bottom sheet */
  dialog#modal.f-dialog[open]{display:flex;flex-direction:column;gap:16px}
  dialog#modal.f-dialog{position:fixed;inset:auto 0 0 0;width:100vw;max-width:100vw;margin:0;padding:12px 18px 28px;border-radius:28px 28px 0 0;box-shadow:0 -10px 30px rgba(0,0,0,.2)}
  dialog#modal.f-dialog::before{content:"";display:block;align-self:center;flex-shrink:0;width:44px;height:5px;margin:0;border-radius:3px;background:#d6dcdc}
  dialog#modal.f-dialog .modal-top{gap:12px;margin:0}
  dialog#modal.f-dialog .modal-top h2{flex:1 1 0;min-width:0;gap:12px}
  dialog#modal.f-dialog .f-modal-icon{width:58px;height:58px;border-radius:16px}
  dialog#modal.f-dialog .f-modal-name{flex:1 1 0;min-width:0}
  dialog#modal.f-dialog .f-modal-name b{font-size:26px;line-height:32px}
  dialog#modal.f-dialog .f-modal-name small{font-size:14px;line-height:18px}
  dialog#modal.f-dialog .modal-top .icon-button{width:auto;height:auto;border:0;border-radius:0;background:none;box-shadow:none;color:#5f7179}
  dialog#modal.f-dialog .modal-body{display:flex;flex-direction:column;gap:16px}
  dialog#modal.f-dialog .f-rules{gap:8px}
  dialog#modal.f-dialog .f-rules>div{gap:0;padding:10px 12px;border-radius:14px}
  dialog#modal.f-dialog .f-rules>div:nth-child(3){flex-grow:1.3}
  dialog#modal.f-dialog .f-rules b{font-size:19px;line-height:24px}
  dialog#modal.f-dialog .f-rules small{font-size:12px;line-height:16px}
  dialog#modal.f-dialog .set-picker-label{margin:0;font-size:14px;line-height:18px}
  dialog#modal.f-dialog .set-picker{gap:8px}
  dialog#modal.f-dialog .set-option{padding:10px 0;border-radius:16px;box-shadow:0 4px 0 #d6dcdc}
  dialog#modal.f-dialog .set-option[aria-checked="true"]{box-shadow:0 4px 0 #1d5fb8}
  dialog#modal.f-dialog .set-option strong{font-size:16px;line-height:20px}
  dialog#modal.f-dialog .set-option small{font-size:12px;line-height:16px}
  dialog#modal.f-dialog .modal-actions{flex-direction:column;align-items:stretch;gap:16px;margin:4px 0 0}
  dialog#modal.f-dialog .modal-actions .btn.ghost{display:none}
  dialog#modal.f-dialog .modal-actions .btn.primary,dialog#modal.f-dialog .modal-actions .btn.primary:hover{order:1;width:100%;height:60px;min-height:60px;padding:0;border-radius:20px;box-shadow:0 5px 0 #c99516;font-size:21px;line-height:26px}
  dialog#modal.f-dialog .f-modal-note{order:2;flex:none;align-self:center;font-size:13px;line-height:16px;text-align:center}

  /* Duel score row */
  #app.f-game .f-score.f-score{gap:6px}
  #app.f-game .f-score .player{padding:6px 10px;border-radius:12px}
  #app.f-game .f-score .player.bot{flex-grow:1.3}
  #app.f-game .f-score .player small,#app.f-game .f-score .player img{display:none}
  #app.f-game .f-score .player strong{font-size:14px;line-height:18px}
  #app.f-game .f-score .player.bot strong{font-size:13px;line-height:16px}
  #app.f-game .f-score .player-score{font-size:24px;line-height:28px}
  #app.f-game .f-score .versus{font-size:12px;line-height:16px}

  /* Round dots */
  #app.f-game .round-dots{gap:6px}
  #app.f-game .round-dots .round-dot{width:8px;height:8px;border-radius:4px}
  #app.f-game .round-dots .round-dot.active{width:20px}

  /* Bars: 8px on mobile (practice progress, Duel and สนามแข่ง timers) */
  #app.f-game .practice-progress.f-track,#app.f-game .time-track.f-track.cyan,#app.f-game:has(> #exam-controls) .time-track.f-track{height:8px;border-radius:4px}
  #app.f-game .practice-progress.f-track>span,#app.f-game .time-track.f-track.cyan .time-fill,#app.f-game:has(> #exam-controls) .time-track.f-track .time-fill{height:8px;border-radius:4px}

  /* Exam prev/next */
  #app.f-game .f-exam-nav.f-exam-nav{gap:6px}
  #app.f-game .f-exam-nav button{padding:7px 10px;border-radius:10px;font-size:12px;line-height:16px}
  #app.f-game .f-exam-nav .exam-answered-line{font-size:12px;line-height:16px}

  /* Exam set panel */
  #app.f-game #exam-controls{margin-top:16px}
  #app.f-game #exam-controls .panel{grid-template-columns:minmax(0,1fr) auto;column-gap:10px;row-gap:10px;padding:14px 16px;border-radius:20px;box-shadow:0 4px 0 #dfe3e8}
  #app.f-game #exam-controls .exam-controls-top h2{font-size:17px;line-height:22px}
  #app.f-game #exam-controls .exam-controls-top p{display:none}
  #app.f-game #exam-controls details{grid-column:2;grid-row:1}
  #app.f-game #exam-controls details summary{font-size:14px;line-height:18px}
  #app.f-game #exam-controls .exam-sections{grid-column:1/-1;grid-row:2;gap:6px}
  #app.f-game #exam-controls .exam-sections button{grid-template-columns:minmax(0,1fr);justify-items:center;row-gap:0;column-gap:0;padding:6px 0;border-radius:12px;font-size:13px;line-height:16px;text-align:center}
  #app.f-game #exam-controls .exam-sections button small{font-size:11px;line-height:14px;text-align:center}
  #app.f-game #exam-controls .exam-sections button[aria-current] small{font-weight:400}
  #app.f-game #exam-controls .exam-sections button::before,#app.f-game #exam-controls .exam-sections button::after{display:none}
  #app.f-game #exam-controls details .exam-question-grid{top:calc(100% + 8px);padding:14px 16px;border-radius:20px;box-shadow:0 4px 0 #dfe3e8}
}
