/* The site's menus (js/features/nav.js; UI8 - the mock work/ui6/art the user approved, 2026-11-29): the top bar's 라이브러리 ·
   the addons added · 애드온 and the gear, a phone's ≡ column, 디스크 스테이션's own tabs, the 애드온 cards, a game addon's page.
   Loaded after the other sheets: the rules for the top bar's tabs of before (style.css, custom.css: #topbar .tabs) no longer
   have anything to draw. */

/* ---- the top bar: the items as the text tabs of before (style.css .tabs), the gear at the right end */
#topbar .mainnav { display: flex; gap: 2px; flex: 1; min-width: 0; }
#topbar .mainnav button { background: transparent; border-color: transparent; padding: 6px 14px; font-size: 14px; color: var(--muted); }
#topbar .mainnav button.active { background: var(--panel2); border-color: var(--line2); color: var(--fg); }
.navgear { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 32px; padding: 0 7px; background: transparent; border-color: transparent; color: var(--muted); }
.navgear .ico-mask { width: 19px; height: 19px; }
.navgear:hover:not(:disabled) { color: var(--fg); }
.navgear.active { background: var(--panel2); border-color: var(--line2); color: var(--fg); }
.menu-btn { display: none; width: 40px; height: 40px; padding: 0; border: 0; background: transparent; color: var(--fg); align-items: center; justify-content: center; flex: none; }
.menu-btn .ico-mask { width: 24px; height: 24px; }
.menu-btn:hover:not(:disabled) { color: var(--accent); }
/* the game's state: only while it runs - 「실행 중」 · 「일시정지」, pressed: its screen (no 「대기 중」 · 「종료됨」, user 2026-11-29) */
#emu-badge { background: transparent; cursor: pointer; font: inherit; font-size: 12px; line-height: 1.5; white-space: nowrap; }
#emu-badge.idle, #emu-badge.ended { display: none; }
#emu-badge:hover { filter: brightness(1.15); }
/* a tablet (721-1040 px): the items take the bar's second row, as the tabs did (custom.css) */
@media (min-width: 721px) and (max-width: 1040px) { #topbar .mainnav { order: 3; flex: 1 0 100%; } }
/* wider: the same when they do not fit on one row (nav.js fitBar - three addons, the sync chips, 「실행 중」) */
#topbar.rows2 { height: auto; min-height: 48px; flex-wrap: wrap; row-gap: 0; column-gap: 12px; padding: 3px 16px 4px; }
#topbar.rows2 .brand { flex: 1; }
#topbar.rows2 .mainnav { order: 3; flex: 1 0 100%; }
html.rc-bar2 { --topbar-h: 66px; }

/* ---- 디스크 스테이션's own tabs (index.html #ds-tabs): today's tabs, under the bar */
#ds-tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--line); margin: -4px 0 14px; padding-bottom: 8px; }
#ds-tabs[hidden] { display: none; }
#ds-tabs button { background: transparent; border-color: transparent; padding: 5px 12px; font-size: 13.5px; color: var(--muted); }
#ds-tabs button.active { background: var(--panel2); border-color: var(--line2); color: var(--fg); }

/* ---- 애드온: the cards (a picture fading into the card, the name, what it does, 추가 / 추가됨 · 빼기) */
.ad-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 2px 0 12px; }
.ad-head h2 { margin: 0; }
.ad-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.ad-card { position: relative; display: flex; flex-direction: column; min-height: 330px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel); }
.ad-card.on { border-color: #5a4a2a; }
.ad-pic { position: absolute; inset: 0 0 auto 0; height: 190px; background: var(--pic) var(--pos, center) / cover no-repeat; }
.ad-pic::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(29, 32, 38, .15) 0%, rgba(29, 32, 38, .55) 45%, var(--panel) 100%); }
.ad-body { position: relative; display: flex; flex-direction: column; flex: 1; padding: 118px 16px 16px; }
.ad-title { display: flex; align-items: center; gap: 8px; }
.ad-title .ico-mask { width: 20px; height: 20px; color: var(--accent); }
.ad-title h3 { margin: 0; font-size: 18px; color: var(--fg); text-shadow: 0 1px 3px rgba(0, 0, 0, .7); }
.ad-feats { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.ad-feats li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 8px; font-size: 13px; line-height: 1.45; color: var(--fg); word-break: keep-all; overflow-wrap: anywhere; }   /* (a Korean word is not cut at the line's end) */
.ad-feats li .ico-mask { width: 15px; height: 15px; margin-top: 2px; color: var(--accent); }
.ad-feats li b { font-weight: 600; }
.ad-feats li span.d { color: var(--muted); }
.ad-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.ad-foot button { min-width: 88px; min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.ad-foot button .ico-mask { width: 15px; height: 15px; }
.ad-foot .ad-on { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-size: 13.5px; font-weight: 600; margin-right: auto; }
.ad-foot .ad-on .ico-mask { width: 16px; height: 16px; }

/* ---- 파랜드 택틱스 · Supaplex 맵 에디터: the game asked for first, or its editor */
.ad-need { max-width: 560px; margin: 28px auto; padding: 22px 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); text-align: center; }
.ad-need[hidden] { display: none; }
.ad-need .big .ico-mask { width: 40px; height: 40px; color: var(--muted); }
.ad-need h3 { margin: 10px 0 14px; color: var(--fg); font-size: 16px; }
.ad-need .ad-need-t { margin: -8px 0 14px; color: var(--muted); font-size: 14px; }   /* (UI8: under the expansion's name, without its game) */
.ad-need .row { justify-content: center; margin: 0; }
.ad-need .row button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; }
.ad-need .row button .ico-mask { width: 15px; height: 15px; }

/* ---- (UI8 통일) a game card's 「애드온」 for an expansion not added: its card here glowing a moment, in the 애드온 button's colours */
.ad-card.ad-flash { animation: adFlash 1.1s ease-in-out 3; }
@keyframes adFlash { 0%, 100% { box-shadow: 0 0 0 2px rgba(232, 80, 143, .35), 0 0 6px 0 rgba(181, 63, 214, .25); }
  50% { box-shadow: 0 0 0 4px #e8508f, 0 0 30px 8px rgba(181, 63, 214, .65); } }
@media (prefers-reduced-motion: reduce) { .ad-card.ad-flash { animation: none; box-shadow: 0 0 0 4px #e8508f; } }
/* a card whose picture the user has not picked yet (마이무 한글 패치): no picture */
.ad-card.nopic .ad-pic { display: none; }
.ad-card.nopic { min-height: 0; }
.ad-card.nopic .ad-body { padding-top: 16px; }

/* ---- an expansion's first screen (UI8 2026-11-30): its tools as a list - an icon, the name, a short line, ›  (설정's list look) */
.ad-need.ad-home { text-align: left; padding: 16px 16px 10px; }
.ad-home-head { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.ad-home-head .ico-mask { width: 24px; height: 24px; color: var(--accent); }
.ad-home-head h3 { margin: 0; font-size: 17px; color: var(--fg); }
.ad-tools { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.ad-tool { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 4px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  background: transparent; color: var(--fg); text-align: left; white-space: normal; }
.ad-tool:last-child { border-bottom: 0; }
.ad-tool:hover:not(:disabled) { background: var(--panel2); }
.ad-tool > .ico-mask:first-child { width: 20px; height: 20px; color: var(--accent); }
.ad-tool-t { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 2px; }
.ad-tool-t b { font-size: 14.5px; font-weight: 600; }
.ad-tool-t small { font-size: 12.5px; color: var(--muted); word-break: keep-all; overflow-wrap: anywhere; }
.ad-tool-go { width: 16px; height: 16px; color: var(--muted); }
@media (max-width: 720px) { .ad-tool { min-height: 60px; } }

/* ---- 디스크 스테이션 > 라이브러리: 「가진 것만 보기」 (user 2026-11-30; the same value as its 설정's 「디스크가 없는 호도 보기」, app.js):
   a PC: in the filter row before the view switch; a phone: a row of its own under 플랫폼 · 호수 · 시리즈 */
.libfilter .lib-owned { white-space: nowrap; cursor: pointer; }
.libfilter .lib-owned input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
@media (max-width: 720px) {
  .libfilter .lib-owned { order: 9; grid-column: 1 / -1; min-height: 40px; font-size: 14px; }
  .libfilter .lib-owned input { width: 18px; height: 18px; }
}

/* ---- 디스크 스테이션 > 설정: one part of 설정's look (css/settings.css .set-panel) */
#tab-dsset .ds-setpanel { display: block; }

/* ---- 설정 > 도움말: the help window of before (style.css table.keys); a Korean word is not cut at the line's end */
.set-help h4:first-child { margin-top: 0; }
.set-help table.keys { font-size: 13px; }
.set-help table.keys td { padding: 6px 4px; border-bottom: 1px solid var(--line); word-break: keep-all; overflow-wrap: anywhere; }
.set-help p { line-height: 1.6; margin: 6px 0; font-size: 13px; word-break: keep-all; overflow-wrap: anywhere; }
.set-help table.keys td.kk { white-space: nowrap; }   /* (「Ctrl + 1 ~ 6」 not broken in two) */

/* ---- the column (a phone) */
.drawer, .drawer-back { display: none; }

/* ---- a phone (720 px wide or less): ≡ · the logo in the bar, the items in the column */
@media (max-width: 720px) {
  #topbar { flex-wrap: nowrap; height: 52px; min-height: 52px; gap: 4px; padding: 0 max(10px, env(safe-area-inset-right, 0px)) 0 max(6px, env(safe-area-inset-left, 0px)); }
  #topbar .menu-btn { display: inline-flex; }
  #topbar .mainnav, #topbar .topright { display: none !important; }
  #topbar .brand { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  #ds-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin: -2px 0 12px; padding-bottom: 10px; }
  #ds-tabs button { min-width: 0; min-height: 40px; padding: 3px 1px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
  .ad-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .ad-card { min-height: 0; }
  .ad-pic { height: 150px; }
  .ad-body { padding-top: 92px; }
  .ad-foot button { min-height: 42px; }
  .ad-foot button.primary { flex: 1; }
  .ad-need { margin: 16px 0; }
  .ad-need .row button { min-height: 44px; flex: 1 1 auto; }
  .set-help table.keys td { padding: 6px 2px; }

  .drawer { display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; width: max-content; max-width: 84vw; z-index: 61; background: var(--panel);   /* (as wide as its words - user 2026-11-30) */
    border-right: 1px solid var(--line2); transform: translateX(-100%); transition: transform .22s ease, visibility 0s linear .22s; visibility: hidden;
    padding: env(safe-area-inset-top, 0px) 0 max(10px, env(safe-area-inset-bottom, 0px)) env(safe-area-inset-left, 0px); }
  body.menu-open .drawer { transform: none; visibility: visible; transition: transform .22s ease; box-shadow: 8px 0 28px rgba(0, 0, 0, .45); }
  .drawer-back { display: block; position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .5); opacity: 0; pointer-events: none; transition: opacity .22s ease; }
  body.menu-open .drawer-back { opacity: 1; pointer-events: auto; }
  body.menu-open { overflow: hidden; }
  .dr-head { display: flex; align-items: center; gap: 4px; height: 52px; padding: 0 8px 0 6px; border-bottom: 1px solid var(--line); flex: none; }
  .dr-head .menu-btn { display: inline-flex; }
  .dr-head .brand { font-size: 16px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .dnav { display: flex; flex-direction: column; padding: 8px; gap: 2px; overflow: auto; flex: 1; }
  .dnav button { display: flex; align-items: center; width: 100%; min-height: 48px; padding: 0 14px; border: 0; border-radius: 8px; background: transparent; color: var(--fg);
    font-size: 15px; text-align: left; white-space: nowrap; }   /* (the longest, 「디스크 스테이션 확장팩」, on one line: it sets the column's width) */
  .dnav button:hover:not(:disabled) { background: var(--panel2); }
  .dnav button[aria-current="true"] { background: var(--panel3); box-shadow: inset 3px 0 0 var(--accent); color: var(--accent); font-weight: 600; }
  .dr-foot { display: flex; align-items: center; padding: 6px 10px 0; flex: none; }
  .dr-foot .navgear { width: 44px; height: 44px; min-width: 44px; padding: 0; color: var(--fg); border-radius: 10px; }
  .dr-foot .navgear .ico-mask { width: 24px; height: 24px; }
  .dr-foot .navgear.active { color: var(--accent); background: var(--panel3); border-color: var(--line2); }
}
@media (max-width: 720px) and (prefers-reduced-motion: reduce) { .drawer, .drawer-back { transition: none; } }
/* a phone: notices under the bar, and a tap goes through them to what is under (they sat on ≡, then on 디스크 스테이션's tabs, for
   their few seconds; they go by themselves).  While a game is played the bar is gone and they keep their place and their tap */
@media (max-width: 720px) {
  html:not(.rc-touch-play) #toasts { inset: calc(env(safe-area-inset-top, 0px) + 60px) 12px auto 12px; }
  html:not(.rc-touch-play) #toasts .toast { pointer-events: none; }
}
/* the smallest phones (320 px): 설정's list lines on two rows rather than cut, 디스크 스테이션's 파일 불러오기 title broken
   between words, 플랫폼 · 호수 · 시리즈 whole beside the view switch */
@media (max-width: 360px) {
  .set-nav small { white-space: normal; word-break: keep-all; overflow-wrap: anywhere; }
  .drop h2 { word-break: keep-all; overflow-wrap: anywhere; }
  .libfilter .dropbtn { font-size: 14px; padding: 0 3px; }
  .libfilter .viewsw .vbtn { width: 36px; }
}
/* playing: the game takes the screen (css/touch.css) - the tabs under the bar go with the bar */
html.rc-touch-play #ds-tabs { display: none; }
/* ---- 2단계 (user 2026-11-29: 「난 기본적으로 저 플레이 탭이 없어졌으면 함 … PC에서도 태블릿처럼 버튼들 위주로」): a game is played in the
   button frame on every screen (touch.js framed); the play tab of before shows only while nothing runs - 디스크 스테이션 > 플레이:
   what to do (playbar.js) - without its bar and panes (each of their buttons is in the frame: PLAYTAB_CHECK.md) */
html:not(.rc-playing) #tab-play > .playhead, html:not(.rc-playing) #tab-play > .toolbar, html:not(.rc-playing) #play-keys,
html:not(.rc-playing) #play-notes, html:not(.rc-playing) #playpanel { display: none !important; }
/* a mouse on the game's screen (a PC): its pointer as the play tab showed it (css/touch.css hides it for fingers) */
@media (hover: hover) and (pointer: fine) { html.rc-touch-play #screen { cursor: crosshair; } }
/* (UI9 f2) the top bar stays at the top of every screen but the game's (user 2026-11-30 「페이지 맨 위의 헤더는 고정이야. 스크롤을 내려도
   계속 떠야해. 단 게임 플레이 시에는 기존처럼 안 보여도 됨.」 - html.rc-touch-play hides it, as before).  It was sticky only for the first
   screen's height (the page was as high as the window: style.css html, body { height: 100% }) and not at all on a phone (position:
   relative).  Above the page (and its open menus as they pass under it), under the drawer, the toasts, the dialogs and the full viewer.
   A place on the page gone to (#자리, scrollIntoView) stops below it. */
body { height: auto; min-height: 100%; }
#topbar { position: sticky; top: 0; z-index: 25; }
@media (max-width: 720px) { #topbar { position: sticky; } }
html { scroll-padding-top: calc(var(--topbar-h) + 8px); }
@media (max-width: 720px) { html { scroll-padding-top: 60px; } }
/* (UI8 f5) the expansions' tool windows (맵 · 캐릭터 · 아이템 에디터 · 외전 만들기 = dialog.me, Supaplex 맵 에디터 = dialog.sx, the 마켓 opened in
   them = dialog.sh-dlg) under the fixed top bar, not over it - opened with show() (features/mapedit.js · spxedit.js · share.js): the bar and a
   phone's ≡ stay; above the page, under the bar (25), the drawer (60) and the toasts.  --rc-bar-h: the bar's height (features/nav.js) */
dialog.rc-tool[open] { position: fixed; inset: var(--rc-bar-h, var(--topbar-h)) 0 0 0; width: auto; height: auto; max-width: none; max-height: none; margin: 0; z-index: 24; overscroll-behavior: contain; }
dialog.sh-dlg.rc-tool[open] { margin: auto; width: min(560px, calc(100vw - 32px)); height: fit-content; max-height: calc(100dvh - var(--rc-bar-h, var(--topbar-h)) - 24px); }
@media (max-width: 720px) { dialog.sh-dlg.rc-tool[open] { width: 100vw; max-width: 100vw; margin: auto 0 0; max-height: calc(100dvh - var(--rc-bar-h, var(--topbar-h)) - 16px); } }

/* (UI8 f8) a 「세이브」 list's lines with the picture of their moment (features/card.js fillSaves; the picture 슬롯 고르기 shows - css/savepick.css
   .sp-pic): a small one at the left, so a phone's line stays low; the expansion's 「세이브」 under its tools (features/nav.js); 설정 > 세이브 데이터's
   rows of a game's runs under its own (features/savedata.js) */
.gc-item > .gc-pic { flex: none; width: 72px; border-radius: 4px; overflow: hidden; }
.gc-item > .gc-pic .sp-nopic { font-size: 10.5px; }
.gc-item > .gc-pic + span { flex: 1; }
@media (max-width: 720px) { .gc-item > .gc-pic { width: 56px; } .gc-item > .gc-pic .sp-nopic { font-size: 10px; } }
.ad-saves { margin-top: 12px; }
.ad-saves .ad-savebtn.active { border-color: var(--accent); }
.ad-savepane { max-height: none; }
.sd tr.sd-sub td { border-top: 0; padding-top: 2px; padding-bottom: 4px; }
.sd tr.sd-sub td:nth-child(2) { padding-left: 22px; }
.sd .sd-subn { position: relative; font-size: 13px; }
.sd .sd-subn::before { content: ''; position: absolute; left: -13px; top: -2px; width: 8px; height: 11px; border-left: 1.5px solid var(--line2, var(--line)); border-bottom: 1.5px solid var(--line2, var(--line)); }
