/* Shared polish: content remains visible even when scripts do not run. */
[hidden] { display: none !important; }
html { scroll-padding-top: 6rem; }
body { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
button, input, select, textarea { touch-action: manipulation; }
input, select, textarea { max-width: 100%; }
button, a { -webkit-tap-highlight-color: transparent; }
.tbar-nav { flex-wrap: wrap; }
.tbar-in { flex-wrap: wrap; }
.u-guide-links { margin: 1rem 0 2rem; padding-left: 1.25rem; }
.u-guide-links li { margin: .75rem 0; }
.u-guide-links a { text-decoration: underline; text-underline-offset: 3px; }
.pwa-message { position: fixed; bottom: max(1rem, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: min(92vw,600px); z-index: 900; padding: 1rem 1.25rem; background: var(--ink,#0c1535); color: white; box-shadow: 4px 4px 0 var(--m,#2f8cf0); border: 2px solid white; display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; font: 600 14px/1.5 var(--font-ui,system-ui); }
.pwa-message a { color: #ffe27a; text-decoration: underline; }
.pwa-message button { background: white; color: #0c1535; border: 0; min-height: 44px; padding: .6rem .9rem; font: inherit; cursor: pointer; }
.pwa-message button:last-child { margin-left: auto; }
.topic-band { padding: 3rem 0; border-top: 2px solid var(--line); }
.topic-band-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,230px),1fr)); gap: 1rem; margin-top: 1.5rem; }
.topic-band a { padding: 1.2rem; border: 2px solid var(--line-2); background: var(--card); color: var(--ink); }
.topic-band a strong { display: block; margin-bottom: .5rem; font-size: 1.05rem; }
.topic-band a span { font-size: .9rem; }
.gband .shelf-grid { align-items: start; }
.gband .tile { height: 100%; }
.guide .u-workbench { width: 100%; }
.guide .u-workbench .u-grid { grid-template-columns: 1fr; }
.guide .u-workbench h2 { margin-top: 0; }
.u-workbench:focus-within { border-color: var(--m-ink); }
@media (hover:hover) and (prefers-reduced-motion:no-preference) {
  .u-glyph .cube { transition: transform .5s var(--ease); }
  .u-hero:hover .u-glyph .cube { transform: translateY(-5px) rotate(4deg); }
  .topic-band a { transition: transform .2s var(--ease),border-color .2s; }
  .topic-band a:hover { transform: translateY(-3px); border-color: var(--m); }
}
@media (max-width: 600px) {
  .wrap { width: min(calc(100% - 2rem),1180px); }
  .tbar-in { gap: .25rem; padding: .65rem 0; }
  .tbar-nav { width: 100%; margin-left: 0; justify-content: space-between; }
  .tbar-nav a { min-height: 44px; display: inline-flex; align-items: center; padding: .6rem .5rem; font-size: .875rem; }
  .tbar-nav a:last-child { display: inline-flex; }
  .btn { min-height: 44px; }
  .sound-toggle, .menu-toggle { min-height: 44px; }
  input[type="text"], input[type="number"], input[type="search"], select, textarea { font-size: 16px; }
  .guide .g-toc { position: static; }
  .guide .g-calc .fgrid { grid-template-columns: 1fr; }
  .u-help { overflow-wrap: anywhere; }
  .u-footer { padding-bottom: calc(2rem + env(safe-area-inset-bottom)); }
  .hero h1 { overflow-wrap: break-word; }
}
@media (max-width:360px) {
  .top-in { gap: .25rem; }
  .brand { gap: .35rem; }
  .brand-mark { width: 28px; height: 28px; }
  .brand-name { font-size: 1rem; }
  .top-act { gap: .35rem; }
  .sound-toggle, .menu-toggle { padding: .5rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
html[data-reduce-motion] *, html[data-reduce-motion] *::before, html[data-reduce-motion] *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
@media print { .pwa-message, [data-pwa-install], .u-actions { display: none !important; } }
