/* Shared home position. Page content can have its own width; navigation cannot. */
:root{--ddakpan-header-height:60px;--ddakpan-header-inset:max(24px,env(safe-area-inset-left,0px));--ddakpan-logo-size:28px;--ddakpan-brand-size:19px}
.ddakpan-header{box-sizing:border-box;min-height:var(--ddakpan-header-height);padding:0 var(--ddakpan-header-inset);align-items:center}
.ddakpan-header-inner{box-sizing:border-box;width:100%;max-width:none;margin:0;min-height:var(--ddakpan-header-height);height:var(--ddakpan-header-height);padding:0 var(--ddakpan-header-inset);align-items:center}
.ddakpan-header:has(>.ddakpan-header-inner){padding:0}
a.ddakpan-home{display:inline-flex!important;flex:0 0 auto;align-items:center;justify-content:flex-start;gap:8px!important;width:auto!important;height:44px!important;min-height:44px!important;margin:0!important;padding:0!important;border:0!important;border-radius:0;background:transparent!important;color:inherit;text-decoration:none!important;font-family:Pretendard,system-ui,sans-serif;font-size:var(--ddakpan-brand-size)!important;font-weight:800!important;line-height:1!important;letter-spacing:-.04em!important;white-space:nowrap;touch-action:manipulation}
a.ddakpan-home img{display:block!important;flex:none;width:var(--ddakpan-logo-size)!important;height:var(--ddakpan-logo-size)!important;object-fit:contain}
a.ddakpan-home strong{display:inline!important;margin:0!important;color:inherit;font-size:var(--ddakpan-brand-size)!important;font-weight:800!important;line-height:1!important;letter-spacing:-.04em!important}
a.ddakpan-home:hover{color:#176b4a!important;text-decoration:underline!important;text-underline-offset:4px}
a.ddakpan-home:focus-visible{outline:2px solid #176b4a!important;outline-offset:3px}
a.ddakpan-home[aria-disabled="true"]{opacity:.45;cursor:default!important}
a.ddakpan-home[aria-disabled="true"]:hover{color:inherit!important;text-decoration:none!important}
/* Navigation stays outside active gameplay, including the floating menu. */
body.game-active .ddak-quick-nav,body.ddakpan-dodge-page.playing .ddak-quick-nav,body:has(.site-shell>.game-screen) .ddak-quick-nav,body:has(a.ddakpan-home[aria-disabled="true"]) .ddak-quick-nav{display:none!important}
body.ddakpan-flappy-page:has(a.ddakpan-home[aria-disabled="true"]) .game-nav{visibility:hidden}
.ddakpan-context{padding-left:10px;border-left:1px solid #d9dedb;color:#667069;font-size:12px;font-weight:600;white-space:nowrap}
.ddakpan-menu-toggle{display:none}
.ddakpan-simple-header{position:relative;z-index:40;display:flex;flex:none;width:100%;height:var(--ddakpan-header-height);justify-content:flex-start;gap:14px;border-bottom:1px solid #d9dedb;background:#fff;color:#172019}

/* Existing menus retain their own controls and content. */
.site-head.ddakpan-header .ddakpan-header-inner{gap:28px}
.site-header.ddakpan-header{height:var(--ddakpan-header-height);min-height:var(--ddakpan-header-height);padding:0 var(--ddakpan-header-inset)}
.app-header.ddakpan-header .ddakpan-header-inner{gap:28px}
body.ddakpan-board-page>main{padding-top:0}
#ddakRealtime .room-top.ddakpan-header,#ddakRealtime .lobby-head.ddakpan-header{width:100vw;margin-left:calc((100% - 100vw)/2);min-height:var(--ddakpan-header-height);padding:0 var(--ddakpan-header-inset)}
#ddakRealtime .lobby-identity{display:flex;align-items:center;min-height:var(--ddakpan-header-height);gap:14px}
#ddakRealtime .room-identity{min-height:var(--ddakpan-header-height)}
#ddakRealtime .room-brand-lockup{order:-1}
#ddakRealtime .room-meta{display:contents}

/* Scoreboard controls share the existing header rather than adding another row. */
.app-header.ddakpan-score-header{height:var(--ddakpan-header-height);min-height:var(--ddakpan-header-height);padding:0 var(--ddakpan-header-inset);grid-template-columns:auto minmax(0,1fr)}
.ddakpan-score-header .scoreboard-title{position:absolute;left:50%;transform:translateX(-50%)}
.ddakpan-score-header .header-actions{min-width:0}
.header-tools-toggle{display:none}
.header-tools-panel{position:absolute;z-index:60;top:calc(100% + 6px);right:12px;display:grid;width:min(330px,calc(100vw - 24px));padding:8px;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;border:1px solid #aaa89f;border-radius:8px;background:#f1eee5;color:#11110f;box-shadow:0 8px 24px rgba(17,17,15,.18)}
.header-tools-panel[hidden]{display:none!important}
.header-tools-panel .icon-button:not([hidden]){display:flex!important;width:auto!important;min-width:0;height:auto!important;min-height:48px!important;padding:8px;align-items:center;justify-content:center;gap:8px;border:1px solid #c8c5bc;border-radius:5px;background:#fffef8;color:#11110f;font-size:18px}
.header-tools-panel .icon-button::after{content:attr(aria-label);font-size:12px;font-weight:600}
.header-tools-panel .icon-button svg{flex:none;width:20px;height:20px}
.ddakpan-score-header .ddakpan-home:hover{color:#fff!important}
.ddakpan-score-header~main .match-screen{height:calc(100dvh - var(--ddakpan-header-height));min-height:0}
.ddakpan-score-header~main .setup-screen{min-height:calc(100dvh - var(--ddakpan-header-height))}
html:fullscreen .ddakpan-score-header~main .match-screen{height:100dvh!important}
html.forced-landscape{--ddakpan-header-height:44px;--ddakpan-header-inset:max(12px,env(safe-area-inset-left,0px));--ddakpan-logo-size:26px;--ddakpan-brand-size:17px}
html.forced-landscape .app-header.ddakpan-score-header{height:var(--ddakpan-header-height);min-height:var(--ddakpan-header-height);padding:0 var(--ddakpan-header-inset)}
html.forced-landscape .ddakpan-score-header~main{height:calc(100% - var(--ddakpan-header-height))}

/* Full-height tools reserve the common header in their viewport. */
.ddakpan-tactical-shell.app-shell{grid-template-rows:var(--ddakpan-header-height) minmax(0,1fr) 40px}
body.ddakpan-bounce-page{flex-direction:column;align-items:center}
body.ddakpan-bounce-page>main{height:calc(100dvh - var(--ddakpan-header-height))}
body.ddakpan-flappy-page{padding-top:calc(var(--ddakpan-header-height) + clamp(6px,2vh,20px))}
body.ddakpan-flappy-page>.ddakpan-header,body.ddakpan-dodge-page>.ddakpan-header{position:fixed;top:0;left:0}
body.ddakpan-dodge-page.playing>.ddakpan-header{display:none}
.site-shell>.rally-site-header{position:fixed;top:0;left:0}
.site-shell:has(>.rally-site-header){padding-top:var(--ddakpan-header-height)}
.site-shell:has(>.rally-site-header)>.screen{min-height:calc(100svh - var(--ddakpan-header-height))}
.site-shell:has(>.rally-site-header) .topbar{justify-content:flex-end}
@media(min-width:640px){.site-shell:has(>.rally-site-header){padding-top:calc(var(--ddakpan-header-height) + 1.5rem)}.site-shell:has(>.rally-site-header)>.screen{min-height:min(52rem,calc(100svh - var(--ddakpan-header-height) - 3rem))}}

@media(max-width:1100px){.ddakpan-score-header .scoreboard-title{display:none}}
@media(max-width:720px){
  :root{--ddakpan-header-height:52px;--ddakpan-header-inset:max(12px,env(safe-area-inset-left,0px));--ddakpan-logo-size:26px;--ddakpan-brand-size:17px}
  .site-head.ddakpan-header .ddakpan-header-inner{height:auto;min-height:var(--ddakpan-header-height);gap:0;flex-wrap:wrap}
  .site-head.ddakpan-header .ddakpan-home{height:var(--ddakpan-header-height)!important}
  .site-head.ddakpan-header .site-nav{display:grid;width:100%;height:40px;flex:0 0 100%;grid-template-columns:repeat(6,minmax(0,1fr));gap:0}
  .site-head.ddakpan-header .site-nav:has(.tournament-nav-link){grid-template-columns:repeat(7,minmax(0,1fr))}
  .site-head.ddakpan-header .site-nav a{min-width:0;padding:0 1px;justify-content:center;font-size:9.5px;white-space:nowrap}
  .site-head.ddakpan-header .site-nav .tournament-nav-link{font-size:0}
  .site-head.ddakpan-header .site-nav .tournament-nav-link::after{content:'대회표';font-size:9.5px}
  .app-header.ddakpan-header .ddakpan-header-inner{height:auto;gap:0;flex-wrap:wrap}
  .app-header.ddakpan-header .section-brand{height:var(--ddakpan-header-height)!important}
  .app-header.ddakpan-header .top-actions{display:grid;width:100%;height:40px;flex:0 0 100%;grid-template-columns:repeat(6,minmax(0,1fr));gap:0}
  .app-header.ddakpan-header .top-actions a{min-width:0;padding:0 1px;justify-content:center;font-size:9.5px}
  .ddakpan-context{font-size:11px}
  #ddakRealtime .room-top.ddakpan-header{height:auto;grid-template-columns:auto minmax(0,1fr);grid-template-areas:"identity tabs" "meta meta" "actions actions";gap:0 8px;padding-bottom:6px}
  #ddakRealtime .room-identity{display:contents}
  #ddakRealtime .room-brand-lockup{grid-area:identity;min-height:var(--ddakpan-header-height)}
  #ddakRealtime .room-meta{grid-area:meta;display:flex;align-items:center;justify-content:space-between;gap:8px;padding-bottom:6px}
  #ddakRealtime .room-meta:not(:has(>:not(.hidden))){display:none}
  #ddakRealtime .room-meta .room-title{padding-left:0;border-left:0}
  #ddakRealtime .room-meta .back-btn{flex:none}
  #ddakRealtime .room-brand-section{display:none}
  #ddakRealtime .lobby-head.ddakpan-header{align-items:stretch;gap:0;padding-bottom:6px}
  #ddakRealtime .lobby-head .head-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
  #ddakRealtime .lobby-head .head-actions button{min-width:0;padding:0 4px;font-size:13px;white-space:nowrap}
  .ddakpan-score-header .header-actions{gap:3px}
  .ddakpan-score-header .header-match-button,.ddakpan-score-header .icon-button{width:44px;height:44px;min-height:44px}
  .ddakpan-score-header .header-match-button span{font-size:20px}
  .ddakpan-score-header .header-match-button b{display:none}
  .ddakpan-score-header .header-tools-toggle:not([hidden]){display:grid;font-size:24px}
  .ddakpan-tactical-shell.app-shell{grid-template-rows:var(--ddakpan-header-height) minmax(0,1fr) 36px}
  .ddakpan-mobile-nav .ddakpan-header-inner{position:relative;height:var(--ddakpan-header-height)!important;min-height:var(--ddakpan-header-height);flex-wrap:nowrap!important;justify-content:space-between;gap:12px!important}
  .ddakpan-mobile-nav .ddakpan-menu-toggle{display:flex;flex:none;align-items:center;justify-content:center;gap:8px;min-width:76px;height:44px;padding:0 10px;border:1px solid #d9dedb;border-radius:5px;background:#fff;color:#172019;font:600 14px Pretendard,system-ui,sans-serif;line-height:1;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent}
  .ddakpan-menu-toggle svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round}
  .ddakpan-menu-toggle[aria-expanded="true"]{border-color:#176b4a;background:#e9f3ed;color:#0d4932}
  .ddakpan-mobile-nav .ddakpan-service-menu{position:absolute;z-index:80;top:calc(100% + 6px);right:12px;left:12px;display:grid!important;width:auto!important;height:auto!important;max-height:calc(100dvh - var(--ddakpan-header-height) - 24px);margin:0!important;padding:6px;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:4px;overflow:auto!important;border:1px solid #bec9c2;border-radius:7px;background:#fff;box-shadow:0 8px 24px rgba(23,32,25,.14)}
  .ddakpan-mobile-nav .ddakpan-service-menu[hidden]{display:none!important}
  .ddakpan-mobile-nav .ddakpan-service-menu a{display:flex;min-width:0;min-height:48px;height:auto!important;padding:0 12px!important;justify-content:flex-start!important;border:0;border-radius:3px;color:#34453a;font-size:14px!important;font-weight:600;letter-spacing:-.02em;white-space:nowrap}
  .ddakpan-mobile-nav .ddakpan-service-menu a::after{display:none!important}
  .ddakpan-mobile-nav .ddakpan-service-menu a:is(:hover,:active,[aria-current="page"]){background:#e9f3ed;color:#0d4932;text-decoration:none}
  .ddakpan-mobile-nav :is(.ddakpan-menu-toggle,.ddakpan-service-menu a):focus-visible{outline:2px solid #176b4a;outline-offset:2px}
  body.ddakpan-bounce-page :is(#pause,#sound){min-width:44px;min-height:44px}
  body.ddakpan-bounce-page .game-title h1{font-size:18px}
  body.ddakpan-flappy-page .topbar{gap:8px;margin-bottom:8px}
  body.ddakpan-flappy-page .topbar-actions{display:grid;width:100%;grid-template-columns:repeat(4,minmax(0,1fr));gap:4px}
  body.ddakpan-flappy-page .topbar-actions button{min-width:44px;min-height:44px;padding:6px 4px;font-size:12px;white-space:nowrap}
  body.ddakpan-flappy-page:has(a.ddakpan-home[aria-disabled="true"]) .topbar>.title{display:none}
  body.ddakpan-dodge-page .audio-dock button{min-width:44px;min-height:44px;font-size:13px}
}
/* A phone turned sideways keeps the established compact navigation row. */
@media(max-height:620px) and (orientation:landscape){:root{--ddakpan-header-height:44px;--ddakpan-header-inset:max(12px,env(safe-area-inset-left,0px));--ddakpan-logo-size:26px;--ddakpan-brand-size:17px}}
