/* Shared application UI contracts. Geometry of chessboards belongs to board styles. */
html { scroll-padding-top:24px; }
body { font-size:14px; line-height:1.5; }
body { --nav-width:72px; }
body.navigation-expanded { --nav-width:208px; }
.skip-link { position:fixed; z-index:3000; top:8px; left:80px; padding:10px 16px; background:var(--bg-surface); color:var(--text-main); border:2px solid var(--accent); transform:translateY(-160%); }
.skip-link:focus { transform:none; }
#workspace-nav { padding:16px 12px; gap:6px; }
#workspace-nav .nav-controls { display:flex; align-items:center; justify-content:space-between; gap:4px; flex:0 0 44px; height:44px; margin:0; }
.nav-brand { display:none; align-items:center; grid-template-columns:32px minmax(0,1fr); gap:4px; height:44px; min-width:0; color:var(--text-main); text-decoration:none; font-weight:700; }
.nav-brand img { justify-self:center; }
.nav-brand .nav-label { font-size:16px; padding-left:0 !important; }
.navigation-expanded .nav-brand { display:grid; flex:1; }
#workspace-nav .nav-menu { position:relative; display:grid; place-items:center; grid-template-columns:1fr; flex:0 0 44px; width:44px; height:44px; }
#workspace-nav .nav-menu .nav-menu-logo { width:24px; height:28px; border-radius:0; }
#workspace-nav .nav-menu > :is(img,span) { grid-column:1; grid-row:1; transition:opacity .12s ease; }
.nav-menu-open { --nav-icon:url('/icons/panel-left-open.svg'); opacity:0; }
.nav-menu-panel { --nav-icon:url('/icons/panel-left.svg'); opacity:0; }
.nav-menu-close { --nav-icon:url('/icons/panel-left-close.svg'); opacity:0; }
#workspace-nav .nav-menu:is(:hover,:focus-visible) .nav-menu-logo { opacity:0; }
#workspace-nav .nav-menu:is(:hover,:focus-visible) .nav-menu-open { opacity:1; }
.navigation-expanded #workspace-nav .nav-menu .nav-menu-logo,
.navigation-expanded #workspace-nav .nav-menu .nav-menu-open { display:none; }
.navigation-expanded #workspace-nav .nav-menu .nav-menu-panel { opacity:1; }
.navigation-expanded #workspace-nav .nav-menu:is(:hover,:focus-visible) .nav-menu-panel { opacity:0; }
.navigation-expanded #workspace-nav .nav-menu:is(:hover,:focus-visible) .nav-menu-close { opacity:1; }
#workspace-nav .workspace-link { border-radius:6px; font-size:13px; }
#workspace-main .workspace-content { max-width:var(--content-width); margin-inline:auto; padding:32px; }
#workspace-main .workspace-page-label, .settings-workspace .settings-page-heading { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
:where(input,select,textarea) { border-radius:6px; }
button { font-size:13px; }
:is(button,a,input,textarea,select,summary):focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
:is(button,a) { touch-action:manipulation; }
/* Shared section titles and readable analysis, without additional card layers. */
.panel-title { font-size:18px; margin-bottom:20px; padding-bottom:0; border-bottom:0; }
.col { border-radius:10px; }
#analysis-body { line-height:1.65; }
#analysis-body .sentence { background:transparent; border:0; padding:14px 0; border-radius:0; }
#analysis-body .cat { border:0; border-bottom:1px solid var(--border); border-radius:0; background:transparent; margin:0; }
#analysis-body .cat-head { min-height:40px; padding:8px 2px; }
#analysis-body .stat-chip { background:transparent; border:0; border-radius:0; padding:2px 10px 2px 0; }
#analysis-body .stat-row { gap:4px 8px; padding-bottom:12px; border-bottom:1px solid var(--border); }
#pv-panel { border-color:transparent; border-radius:8px; }
/* Preference rows are label/control pairs, not independent cards. */
.setting-row { border:0; border-bottom:1px solid var(--border); border-radius:0; background:transparent; padding:16px 0; margin:0; }
.setting-row:hover { background:transparent; border-color:var(--border); }
.setting-name { font-size:13px; font-weight:500; }
.setting-note { font-size:12px; line-height:1.5; }
/* One native dialog frame, independent of the feature that opens it. */
dialog:is(.settings-dialog,.review-dialog,.export-dialog,.home-stats-modal) { border:1px solid var(--border-strong); border-radius:10px; color:var(--text-main); background:var(--bg-surface); box-shadow:var(--dialog-shadow); max-height:calc(100dvh - 40px); overscroll-behavior:contain; }
dialog::backdrop { background:rgba(0,0,0,.55); backdrop-filter:none; }
:is(.settings-dialog-body,.review-dialog-body,.export-dialog-body) { padding:24px; }
dialog h2 { font:600 20px/1.3 var(--font-display); letter-spacing:-.015em; }
:is(.review-dialog-actions,.settings-dialog-actions) { gap:10px; margin-top:24px; }
/* Quiet utility actions keep tactile depth for the main next action. */
:is(.pv-action-btn,.icon-btn,.header-btn,.board-toolbar button) { box-shadow:none; }
#workspace-main .library-empty, .stats-connect-prompt { padding:48px 24px; border:1px solid var(--border); border-radius:8px; background:var(--bg-surface); line-height:1.6; }
#workspace-main .library-meta { font-size:12px; line-height:1.6; }
#workspace-main :is(.stats-table,.study-table,.review-tbl) { font-variant-numeric:tabular-nums; }
#workspace-main :is(.stats-table,.study-table) th { color:var(--text-muted); font-size:12px; font-weight:500; text-transform:none; letter-spacing:normal; }
@media(max-width:760px) {
  #workspace-main .workspace-content { padding:20px 16px; }
  body { --nav-width:64px; }
  body.navigation-expanded { --nav-width:196px; }
  #workspace-nav { padding-inline:10px; }
  dialog:is(.settings-dialog,.review-dialog,.export-dialog) { max-width:calc(100vw - 24px); max-height:calc(100dvh - 24px); }
}
@media(prefers-reduced-motion:reduce) { *,*::before,*::after { scroll-behavior:auto !important; transition-duration:.01ms !important; animation-duration:.01ms !important; } }

.workspace-page-label:focus, .settings-pane > h2:focus { outline:none; }

#workspace-nav a.workspace-link { text-decoration:none; }
#move-list:empty { border:0; background:transparent; padding:16px 0; }
#move-list:empty::before { content:'Import a game or play a move to begin.'; display:block; color:var(--text-muted); font-size:13px; line-height:1.6; }
#opening-study-panel .study-table tr:hover td { background:var(--bg-subtle); }
#opening-games-list .study-game { border-radius:6px; }

.custom-dropdown-item:focus-visible { outline:2px solid var(--accent); outline-offset:-2px; background:var(--accent-subtle); color:var(--text-main); }

/* Honor actual UI state even when a feature uses display:flex/grid. */
[hidden] { display:none !important; }
.setting-btn-group .setting-btn-pill { box-shadow:none; min-height:36px; height:auto; font-size:13px; }
.setting-btn-group .setting-btn-pill.active { background:var(--accent-subtle); color:var(--accent); border-color:var(--accent); box-shadow:none; font-weight:600; }
.setting-btn-group .setting-btn-pill:active { transform:none; box-shadow:none; }
.gameplay-setup-divider { text-transform:none; letter-spacing:normal; font-size:12px; }
#gameplay-setup-swap-btn { box-shadow:none; transition:background .12s ease,color .12s ease,border-color .12s ease; }

/* Keep continuation controls aligned with the explanation text. */
#analysis-body .line-row .show-line-btn {
  height:auto;
  min-height:0;
  padding:2px 8px;
  margin-left:4px;
  font-size:inherit;
  line-height:1.4;
  vertical-align:baseline;
  box-shadow:none;
}
#analysis-body .line-row .show-line-btn:active { transform:none; box-shadow:none; }
