/* 한 줄 도구함: 크기는 오른쪽, 되돌리기는 화면 오른쪽 위. */
.tool-dock { max-width: 760px; }
.toolbox { display: grid; grid-template-columns: minmax(0,1fr) 46px; gap: 7px; padding: 6px; border-radius: 18px; }
.tool-strip { position: relative; min-width: 0; }
.toolbox .tool-button { height: 78px; min-width: 69px; gap: 4px; }
.toolbox .tool-button svg { width: 37px; height: 37px; }
.tool-strip:has(.tool-navigation:not([hidden])) .tools-scroll { margin-inline: 28px; }
.tool-strip .tool-navigation { position: absolute; inset: 0; z-index: 1; align-items: center; justify-content: space-between; pointer-events: none; }
.tool-strip .tool-navigation button { width: 28px; height: 100%; padding: 0; border: 0; border-radius: 8px; background: #fbf8ef; color: #667858; opacity: 1; pointer-events: auto; touch-action: manipulation; transition: background .12s, box-shadow .12s; }
.tool-strip .tool-navigation button:hover:not(:disabled) { background: #f1efe5; }
.tool-strip .tool-navigation button:active:not(:disabled) { background: #e8e7dc; box-shadow: inset 0 0 0 1px #79816c25; }
.tool-strip .tool-navigation button:focus-visible { outline: 2px solid #849078; outline-offset: -3px; }
.tool-strip .tool-navigation button:disabled { visibility: hidden; opacity: 0; }
.tool-strip .tool-navigation svg { width: 13px; height: 20px; opacity: .6; transition: transform .12s; }
.tool-strip .tool-navigation button:active svg { transform: scale(.88); }

.brush-gauge-picker { position: relative; min-width: 0; pointer-events: auto; }
.tool-dock:has(.brush-gauge[aria-expanded="true"]) { z-index: 12; }
.brush-gauge { display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 2px; width: 100%; min-width: 0; height: 78px; padding: 3px 0; border: 1px solid #c4c9b4; border-radius: 11px; background: #eeeee1; color: #52644b; cursor: pointer; }
.brush-gauge[aria-expanded="true"] { background: #e1e8d8; border-color: #849577; box-shadow: inset 0 0 0 1px #84957740; }
.brush-gauge-label { font-size: 9px; line-height: 11px; }
.brush-gauge-control { position: relative; display: block; width: 44px; flex: 1; min-height: 44px; }
.brush-gauge-bars { position: absolute; inset: 2px 6px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; pointer-events: none; }
.brush-gauge-bars i { display: block; height: 3px; flex: none; border-radius: 1px; background: #8a967840; }
.brush-gauge-bars i.is-filled { background: #62765a; }
.brush-size-popover { position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 20; display: flex; flex-direction: column; gap: 12px; width: 88px; height: 284px; padding: 14px 10px 12px; border: 1px solid #ffffff; border-radius: 19px; background: #f6f6ecef; color: #52644b; box-shadow: 0 9px 32px #273c3430, 0 0 0 1px #72856630; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); transform-origin: bottom right; animation: brush-size-open .17s ease-out; }
.brush-size-heading { display: flex; align-items: center; justify-content: center; gap: 8px; flex: none; font-size: 11px; }
.brush-size-heading output { font: 650 17px/22px ui-monospace,monospace; }
.brush-size-slider { position: relative; flex: 1; min-height: 44px; }
.brush-size-slider .brush-gauge-bars { inset: 12px 8px; }
.brush-size-slider .brush-gauge-bars i { height: 6px; border-radius: 3px; }
.brush-size-thumb-track { position: absolute; inset: 12px 0; pointer-events: none; }
.brush-size-thumb-track i { position: absolute; left: 0; right: 0; top: var(--brush-position); height: 16px; transform: translateY(-50%); border: 2px solid #576d4e; border-radius: 7px; background: #ffffffa8; box-shadow: 0 2px 5px #31412624; }
#brush-size { position: absolute; inset: 0; margin: 0; width: 100%; height: 100%; writing-mode: vertical-lr; direction: rtl; appearance: none; -webkit-appearance: none; opacity: 0; cursor: ns-resize; touch-action: none; }
#brush-size::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 24px; height: 24px; }
#brush-size::-moz-range-thumb { width: 24px; height: 24px; border: 0; }
.brush-gauge:focus-visible, .brush-size-slider:has(#brush-size:focus-visible) { outline: 3px solid #658d81; outline-offset: 3px; border-radius: 10px; }
#brush-value { font: 600 10px/11px ui-monospace,monospace; color: #506143; }
@keyframes brush-size-open { from { opacity: 0; transform: translateY(10px) scaleY(.78); } to { opacity: 1; transform: none; } }
@media(prefers-reduced-motion:reduce){ .brush-size-popover { animation: none; } }

.play-settings #undo-button { width: 44px; min-width: 44px; height: 44px; padding: 0; border: 1px solid #b6c0a6; border-radius: 12px; background: #fbf9eded; color: #45614c; box-shadow: 0 2px 5px #354a3610; }
.play-settings #undo-button svg { width: 20px; height: 20px; }
.play-settings #undo-button:disabled { opacity: .4; cursor: default; }
.play-menu-panel .dock-footnote { display: contents; }
.play-menu-panel .dock-footnote > button { width: 100%; min-height: 44px; border-radius: 9px; font-size: 12px; }

@media(max-width:760px){
  .toolbox { grid-template-columns: minmax(0,1fr) 44px; gap: 5px; padding: 5px; border-radius: 16px; }
  .toolbox .tool-button { height: 76px; min-width: 56px; flex-basis: 56px; gap: 3px; }
  .toolbox .tool-button svg { width: 32px; height: 32px; }
  .toolbox .tool-button > span { font-size: 9px; }
  .brush-gauge { height: 76px; }
}
@media(pointer:coarse), (max-width:760px){
  .toolbox { grid-template-columns: 44px minmax(0,1fr); }
  .brush-gauge-picker { grid-column: 1; grid-row: 1; }
  .tool-strip { grid-column: 2; grid-row: 1; }
  .brush-size-popover { left: 0; right: auto; transform-origin: bottom left; }
}
@media(max-height:540px) and (orientation:landscape){
  .tool-dock { max-width: 640px; }
  .toolbox .tool-button { height: 64px; min-width: 57px; }
  .toolbox .tool-button svg { width: 30px; height: 30px; }
  .brush-gauge { height: 64px; padding: 2px 0; }
  .brush-gauge-label { display: none; }
  .brush-gauge-bars i { height: 2px; }
}

/* 그림에서도 기존 크기 조절기를 그대로 사용한다. */
#drawing-actions { display: none; }
.drawing-mode .tool-dock .tool-context, .drawing-mode .tool-strip { display: none; }
.drawing-mode .toolbox { grid-template-columns: 44px minmax(0,1fr); }
.drawing-mode .brush-gauge-picker { grid-column: 1; grid-row: 1; }
.drawing-mode .brush-size-popover { left: 0; right: auto; }
.drawing-mode #drawing-actions { display: flex; grid-column: 2; grid-row: 1; gap: 4px; align-items: stretch; }
#drawing-actions button { flex: 1; min-width: 0; min-height: 48px; padding: 5px; border: 1px solid #b6c0a6; border-radius: 11px; color: #45614c; background: #fbf9edb8; font-size: 14px; cursor: pointer; }
#drawing-actions button[aria-pressed=true] { background: #dce9ce; border-color: #698864; box-shadow: inset 0 0 0 1px #698864; }
#drawing-actions button:disabled { opacity: .4; cursor: default; }
#drawing-actions button:focus-visible { outline: 3px solid #658d81; outline-offset: 2px; }
