/* handy.moe oekaki board (Fude, 2026-12-03) */
.ok-app { --ok-side: 268px; border: 1px solid var(--rule-2); background: var(--card); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: min(88vh, 920px); min-height: 540px; margin: 0 0 24px; position: relative; }
.ok-app:not(.ok-ready) .ok-body { opacity: .4; }
.ok-app.ok-full { position: fixed; inset: 0; z-index: 19; height: auto; min-height: 0; margin: 0; border: 0; }
:root.ok-noscroll, :root.ok-noscroll body { overflow: hidden; }
.ok-top { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 6px 8px; border-bottom: 1px solid var(--rule-2); }
.ok-top .btn.small { min-height: 32px; padding: 3px 9px; }
.ok-sep { width: 1px; height: 24px; background: var(--rule-2); margin: 0 4px; }
.ok-zoom { min-width: 64px; }
.ok-name { flex: 1 1 140px; min-width: 120px; font: inherit; font-size: var(--small); background: var(--paper); color: var(--ink); border: 1px solid var(--rule-2); padding: 4px 8px; min-height: 32px; }
.ok-file { cursor: pointer; }
.ok-body { display: grid; grid-template-columns: 112px minmax(0, 1fr) var(--ok-side); min-height: 0; }
.ok-tools { display: flex; flex-direction: column; gap: 2px; padding: 6px; border-right: 1px solid var(--rule-2); overflow: auto; }
.ok-tools button { appearance: none; font: inherit; font-size: var(--small); line-height: 1.2; text-align: left; background: var(--card); color: var(--ink-2); border: 1px solid var(--rule); padding: 6px; cursor: pointer; display: flex; justify-content: space-between; gap: 4px; align-items: baseline; min-height: 44px; }
.ok-tools button span { white-space: normal; }
.ok-tools button kbd { font: inherit; color: var(--ink-3); }
.ok-tools button:hover { color: var(--fire); border-color: var(--fire); }
.ok-tools button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.ok-tools button[aria-pressed="true"] kbd { color: var(--paper); opacity: .7; }
.ok-stage { position: relative; overflow: hidden; background: #6b6b6b; touch-action: none; }
:root[data-theme="oled"] .ok-stage { background: #262626; }
#ok-view { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; outline: none; cursor: crosshair; -webkit-user-select: none; user-select: none; }
.ok-xbar { position: absolute; left: 50%; top: 8px; translate: -50% 0; display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; background: var(--card); border: 1px solid var(--rule-2); padding: 4px; z-index: 2; max-width: calc(100% - 16px); }
.ok-ref { position: absolute; left: 12px; top: 56px; width: 240px; min-width: 120px; min-height: 80px; resize: both; overflow: hidden; background: var(--card); border: 1px solid var(--rule-2); z-index: 3; display: flex; flex-direction: column; }
.ok-ref-bar { display: flex; gap: 4px; align-items: center; padding: 2px 4px; background: var(--paper-2); cursor: move; font-size: var(--small); touch-action: none; }
.ok-ref-bar input { flex: 1; min-width: 40px; }
.ok-ref-bar button { appearance: none; font: inherit; font-size: var(--small); background: var(--card); color: var(--ink); border: 1px solid var(--rule-2); cursor: pointer; padding: 0 6px; }
.ok-ref img { flex: 1; min-height: 0; width: 100%; object-fit: contain; display: block; pointer-events: none; }
.ok-side { overflow: auto; border-left: 1px solid var(--rule-2); padding: 0 10px 10px; }
.ok-sec { border-bottom: 1px solid var(--rule); padding: 10px 0; }
.ok-sec[hidden] { display: none; }
.ok-colors { display: flex; gap: 8px; align-items: flex-start; }
#ok-wheel { width: 150px; height: 150px; touch-action: none; cursor: crosshair; flex: none; }
.ok-fgbg { display: grid; gap: 6px; justify-items: start; }
.ok-sw { appearance: none; width: 22px; height: 22px; border: 1px solid var(--rule-2); padding: 0; cursor: pointer; border-radius: 0; }
#ok-fg, #ok-bg { width: 34px; height: 34px; }
#ok-fg { outline: 2px solid var(--ink); outline-offset: 1px; }
#ok-hex { width: 84px; font: inherit; font-size: var(--small); background: var(--paper); color: var(--ink); border: 1px solid var(--rule-2); padding: 2px 4px; }
.ok-mini { appearance: none; font: inherit; font-size: var(--small); background: var(--card); color: var(--ink); border: 1px solid var(--rule-2); cursor: pointer; min-width: 30px; min-height: 30px; padding: 0 4px; }
.ok-mini:hover { color: var(--fire); border-color: var(--fire); }
.ok-mini[disabled] { opacity: .4; cursor: not-allowed; }
.ok-pal { display: grid; grid-template-columns: repeat(auto-fill, minmax(22px, 1fr)); gap: 3px; margin-top: 8px; }
.ok-pal .ok-sw { width: 100%; aspect-ratio: 1; height: auto; }
.ok-hint { color: var(--ink-3); font-size: var(--small); margin: 6px 0 0; line-height: 1.35; }
.ok-chips { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 8px; }
.ok-chips[hidden] { display: none; }
.ok-chips button { appearance: none; font: inherit; font-size: var(--small); border: 1px solid var(--rule-2); background: var(--card); color: var(--ink-2); padding: 2px 7px; cursor: pointer; min-height: 30px; }
.ok-chips button:hover { color: var(--fire); border-color: var(--fire); }
.ok-chips button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.ok-range, .ok-field { display: grid; gap: 2px; margin-top: 6px; font-size: var(--small); color: var(--ink-3); }
.ok-range[hidden], .ok-field[hidden], .ok-hint[hidden] { display: none; }
.ok-range output { color: var(--fire); }
.ok-range input { width: 100%; accent-color: var(--fire); }
.ok-field select, .ok-field input { font: inherit; font-size: var(--small); background: var(--paper); color: var(--ink); border: 1px solid var(--rule-2); padding: 3px 4px; min-height: 30px; border-radius: 0; }
.ok-checks { display: grid; gap: 2px; margin-top: 6px; font-size: var(--small); color: var(--ink-2); }
.ok-checks input { accent-color: var(--fire); }
.ok-link { appearance: none; background: none; border: 0; padding: 0; font: inherit; color: var(--link); text-decoration: underline; cursor: pointer; }
.ok-layhead { display: flex; justify-content: space-between; align-items: center; gap: 4px; flex-wrap: wrap; }
.ok-layhead span { display: flex; gap: 2px; }
.ok-layprops { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ok-layers { list-style: none; margin: 8px 0; padding: 0; border: 1px solid var(--rule); max-height: 260px; overflow: auto; }
.ok-layers li { display: grid; grid-template-columns: 28px 48px 1fr; grid-template-rows: auto auto; column-gap: 6px; align-items: center; padding: 3px 4px; border-bottom: 1px solid var(--rule); cursor: pointer; font-size: var(--small); }
.ok-layers li:last-child { border-bottom: 0; }
.ok-layers li.on { background: var(--hl); outline: 1px solid var(--fire); outline-offset: -1px; }
.ok-layers canvas { grid-row: 1 / 3; grid-column: 2; width: 48px; height: 36px; background: repeating-conic-gradient(#ddd 0 25%, #fff 0 50%) 0 0 / 8px 8px; border: 1px solid var(--rule-2); }
.ok-layers .ok-eye { grid-row: 1 / 3; appearance: none; background: none; border: 0; color: var(--ink); font: inherit; cursor: pointer; min-height: 30px; padding: 0; }
.ok-lname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.ok-layers small { color: var(--ink-3); grid-column: 3; }
.ok-lrename { font: inherit; width: 100%; background: var(--paper); color: var(--ink); border: 1px solid var(--fire); }
.ok-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: end; margin-top: 8px; }
.ok-status { display: flex; justify-content: space-between; gap: 8px; padding: 2px 8px; border-top: 1px solid var(--rule-2); font-size: var(--small); color: var(--ink-3); min-height: 26px; }
.ok-dlg { background: var(--card); color: var(--ink); border: 1px solid var(--rule-2); padding: 16px; max-width: min(860px, calc(100vw - 24px)); width: 100%; border-radius: 0; }
.ok-dlg::backdrop { background: rgba(0, 0, 0, .6); }
.ok-dlg-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0 0 8px; }
.ok-dlg-head h2 { margin: 0; font-size: var(--h3); }
.ok-galgrid { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.ok-galgrid li { border: 1px solid var(--rule-2); padding: 6px; display: grid; gap: 6px; align-content: start; }
.ok-galopen { appearance: none; background: none; border: 0; padding: 0; color: var(--ink); font: inherit; text-align: left; cursor: pointer; display: grid; gap: 4px; }
.ok-galopen img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: repeating-conic-gradient(#ddd 0 25%, #fff 0 50%) 0 0 / 12px 12px; }
.ok-galopen small { color: var(--ink-3); font-size: var(--small); }
.ok-galopen:hover strong { color: var(--fire); }
.ok-sizes { display: flex; flex-wrap: wrap; gap: 6px; }
.ok-savegrid { display: grid; grid-template-columns: auto 1fr; gap: 10px 12px; align-items: center; }
.ok-savegrid span { color: var(--ink-2); font-size: var(--small); }
.ok-replay canvas { display: block; max-width: 100%; height: auto; margin: 0 auto; background: #fff; border: 1px solid var(--rule-2); }
.ok-replay progress { width: 100%; accent-color: var(--fire); margin-top: 6px; }
.ok-noscript { padding: 16px; border: 1px solid var(--rule-2); }
@media (max-width: 900px) {
  .ok-app { --ok-side: 220px; }
  .ok-body { grid-template-columns: 104px minmax(0, 1fr) var(--ok-side); }
}
@media (max-width: 760px) {
  .ok-app, .ok-app.ok-full { height: auto; min-height: 0; grid-template-rows: auto auto auto; }
  .ok-app.ok-full { overflow: auto; align-content: start; }
  .ok-app .ok-body { min-height: auto; }
  .ok-tools { min-height: 60px; }
  .ok-side { overflow: visible; }
  .ok-top [data-act="rotl"], .ok-top [data-act="rotr"] { display: none; }
  .ok-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto; }
  .ok-tools { flex-direction: row; border-right: 0; border-bottom: 1px solid var(--rule-2); overflow-x: auto; }
  .ok-tools button { flex: none; min-width: 64px; flex-direction: column; align-items: flex-start; }
  .ok-stage { height: 62vh; min-height: 300px; }
  .ok-app.ok-full .ok-stage { height: 70vh; }
  .ok-side { border-left: 0; border-top: 1px solid var(--rule-2); }
  .ok-savegrid { grid-template-columns: 1fr; }
  .ok-sep { display: none; }
}
.ok-keys { border-collapse: collapse; width: 100%; max-width: var(--measure); }
.ok-keys th, .ok-keys td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.ok-keys kbd { font: inherit; color: var(--fire); }
