/* Huihua adaptation of Tack: keep the canvas dominant on every screen. */
:root { --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; --ink-3: #aaa49b; }
:root[data-theme="light"] { --ink-3: #65615b; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) { --ink-3: #65615b; } }
html, body { height: 100dvh; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: var(--bg); }
.bar { min-height: 46px; height: auto; padding: 4px; top: max(10px, env(safe-area-inset-top)); background: var(--panel); backdrop-filter: none; -webkit-backdrop-filter: none; }
.bar button { min-height: 36px; height: 36px; }
/* Scale only the contents, preserving each control's layout width and horizontal position. */
.bar .toolbar-label, .action-bar .toolbar-label { display: inline-block; transform: scale(.9); }
.bar svg, .site-brand img { transform: scale(.9); }
.bar svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.identity { display: flex; align-items: center; flex: none; gap: 12px; margin: 0 12px 0 4px; white-space: nowrap; }
.site-brand { display: flex; align-items: center; gap: 7px; min-height: 36px; color: var(--ink); text-decoration: none; font-size: 16px; font-weight: 650; border-radius: 6px; }
.site-brand img { display: block; width: 32px; height: 32px; object-fit: contain; }
.brand-divider { height: 18px; width: 1px; background: var(--bar-line); }
.identity .canvas-title { font-size: 15px; font-weight: 600; padding: 0 2px; color: var(--ink); border-radius: 6px; }
.identity .canvas-title:hover, .site-brand:hover { color: var(--accent); }
.primary-tools { display: flex; align-items: center; gap: 2px; }
.primary-tools > button { display: flex; align-items: center; gap: 6px; padding: 0 10px; border-radius: 8px; font-weight: 500; }
.primary-tools > button:hover:not(:disabled) { background: var(--hover); }
.primary-tools > button svg { width: 18px; height: 18px; flex: none; }
.primary-tools > button.on { background: var(--accent); color: #161616; }
.bar > button.on, .panel .row button:hover { color: #161616; }
.bar > [data-act="help"], .bar > [data-act="theme"] { min-width: 44px; justify-content: center; }
.bar .count { transform: scale(.9); transform-origin: right center; }
#board-name { line-height: 28px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.storage-error { position: fixed; top: calc(var(--toolbar-bottom, 64px) + 12px); left: 12px; right: 12px; z-index: 31; margin: 0; padding: 14px; border-radius: 10px; color: var(--ink); background: var(--panel); border: 1px solid var(--accent); }
.operation-state { position: fixed; left: 50%; top: calc(var(--toolbar-bottom, 64px) + 12px); transform: translateX(-50%); background: var(--panel); color: var(--ink); padding: 10px 16px; border-radius: 8px; z-index: 29; white-space: nowrap; }
body[aria-busy="true"] #c { cursor: progress !important; }
.empty { padding: 140px 24px 100px; }
.empty p { line-height: 1.8; }
.empty .link { min-height: 44px; }
.empty .gesture-tip { font-size: 14px; }
.action-bar { position: fixed; bottom: max(12px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; padding: 2px; border-radius: 12px; background: var(--panel); border: 1px solid var(--bar-line); box-shadow: 0 8px 24px #0002; z-index: 6; }
.action-bar button { min-width: 52px; min-height: 36px; padding: 0 10px; border-radius: 8px; white-space: nowrap; }
.action-bar button:hover { background: var(--hover); }
.action-bar button[aria-pressed="true"] { background: var(--accent); color: #161616; font-weight: 600; }
.action-bar .note-done { position: absolute; bottom: 60px; right: 0; background: var(--accent); color: #161616; }
.panel { top: calc(var(--toolbar-bottom, 64px) + 12px); max-height: calc(100dvh - var(--toolbar-bottom, 64px) - 92px - env(safe-area-inset-bottom)); overscroll-behavior: contain; scrollbar-color: var(--ink-3) var(--panel); scrollbar-width: thin; }
.panel .x, #board-list .del { min-width: 44px; min-height: 44px; }
.panel h3, .panel th { text-transform: none; letter-spacing: normal; font-size: 13px; }
.panel h2 { font-size: 17px; }
.panel p { line-height: 1.8; }
.panel .row button, .menu button, #board-list .pick { min-height: 44px; }
#board-list .pick { min-width: 0; overflow-wrap: anywhere; }
.menu { max-height: calc(100dvh - 190px); max-width: calc(100vw - 16px); overflow-y: auto; overscroll-behavior: contain; }
#zoom-menu { top: calc(var(--toolbar-bottom, 64px) + 12px); left: min(50vw, 420px); }
.toast { bottom: calc(max(12px, env(safe-area-inset-bottom)) + 66px); }
#note-edit { caret-color: var(--accent); user-select: text; }
@media (max-width: 760px) {
  .bar { left: 8px; right: 8px; flex-wrap: wrap; justify-content: flex-start; gap: 0; }
  .identity { gap: 10px; margin: 0 auto 0 2px; order: 0; }
  .site-brand { font-size: 15px; }
  .identity .canvas-title { font-size: 14px; }
  .primary-tools { order: 3; width: 100%; justify-content: space-between; gap: 0; }
  .primary-tools > button { flex: none; min-width: 44px; flex-direction: column; gap: 2px; padding: 0 4px; font-size: 12px; line-height: 1.2; white-space: nowrap; }
  .primary-tools > button svg { width: 16px; height: 16px; }
  .bar > [data-act="theme"], .bar > [data-act="help"] { order: 1; }
  .bar > button { padding: 0 9px; font-size: 13px; }
  .bar > button span { display: inline; }
  .bar > button svg { width: 16px; height: 16px; }
  .bar > [data-act="theme"] { margin-left: 0; }
  .bar .grow, .bar .count, #board-name, .bar .sep { display: none; }
  #zoom { display: flex; min-width: 52px; }
  .panel { right: 8px; width: calc(100vw - 16px); padding: 12px 14px; }
  .panel table { table-layout: fixed; font-size: 12px; }
  .panel td:first-child { width: 44%; }
  .panel kbd { white-space: normal; line-height: 1.8; }
  #zoom-menu { left: auto; right: 8px; }
  .action-bar { max-width: calc(100vw - 16px); }
  .action-bar button { min-width: 46px; padding: 0 7px; font-size: 14px; }
  #note-edit { left: 12px !important; top: auto !important; bottom: calc(140px + env(safe-area-inset-bottom)); width: calc(100vw - 24px) !important; min-height: 100px !important; max-height: 36dvh; overflow: auto; transform: none !important; font-size: 16px !important; padding: 14px !important; line-height: 1.7 !important; }
  .action-bar .note-done { bottom: 60px; min-width: 100px; }
}
@media (max-width: 359px) {
  .primary-tools > button { min-width: 44px; padding: 0 5px; }
  .identity { gap: 7px; }
  .site-brand img { width: 28px; height: 28px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
