/* Online coloring page: the drawing fills the screen, with a crayon tray beside it (below it on phones). */
html, body { height: 100%; }
body { display: flex; flex-direction: column; }

.bar { border-bottom: 1px solid var(--rule); background: var(--paper); }
.bar .wrap { max-width: none; display: flex; align-items: center; gap: 1rem; padding-block: .6rem; flex-wrap: wrap; }
.bar .title { display: grid; gap: .1rem; margin-left: .5rem; padding-left: 1rem; border-left: 1px solid var(--rule); min-width: 0; }
.bar .title h1 { font-size: var(--step-1); }
.bar .title p { font-size: .8125rem; color: var(--muted); }
.bar .actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }
.bar .btn { min-height: 40px; padding: .5rem 1rem; font-size: var(--step--1); }
@media (max-width: 640px) { .bar .title { display: none; } }

.workspace { flex: 1; display: flex; min-height: 0; }
#stage { flex: 1; display: flex; align-items: center; justify-content: center; padding: 18px; min-width: 0; min-height: 0; overflow: hidden; background: var(--surface); }
#paper { position: relative; background: #fff; box-shadow: var(--shadow); touch-action: none; cursor: crosshair; border-radius: 3px; opacity: 0; transition: opacity .3s ease; }
#paper.ready { opacity: 1; }
#paper[data-mode="brush"], #paper[data-mode="eraser"] { cursor: cell; }
#paper canvas { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 3px; }

.tray { width: 272px; flex: none; padding: 18px 20px; background: var(--paper); border-left: 1px solid var(--rule);
        overflow-y: auto; display: flex; flex-direction: column; gap: 1.25rem; }
.tray h2 { font: 700 .75rem/1 var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: .7rem; }
.tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.tools button, .row button {
  font: 600 var(--step--1)/1 var(--body); min-height: 40px; border-radius: 10px; cursor: pointer;
  border: 1.5px solid var(--rule); background: var(--paper); color: var(--ink);
}
.tools button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.current { display: flex; align-items: center; gap: .6rem; margin-bottom: .7rem; font-size: var(--step--1); }
.current i { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--rule); flex: none; }
.swatches { display: grid; grid-template-columns: repeat(5, 1fr); gap: .45rem; }
.swatch { aspect-ratio: 1; border-radius: 50%; border: 2px solid rgba(0, 0, 0, .14); padding: 0; cursor: pointer; min-width: 0; }
.swatch[aria-pressed="true"] { outline: 3px solid var(--ink); outline-offset: 2px; }
.custom { display: flex; align-items: center; gap: .6rem; margin-top: .75rem; color: var(--muted); font-size: var(--step--1); }
.custom input { width: 40px; height: 30px; border: none; padding: 0; background: none; cursor: pointer; }
#sizeRow.dim { opacity: .4; }
input[type=range] { width: 100%; accent-color: var(--collar); }
.row { display: flex; gap: .4rem; }
.row button { flex: 1; }
.row button:disabled { opacity: .45; cursor: default; }
.row button.armed { border-color: var(--collar); color: var(--collar); }
.tray .about { font-size: .8125rem; color: var(--muted); line-height: 1.5; }
.promo { margin-top: auto; display: grid; grid-template-columns: 56px 1fr; gap: .75rem; align-items: center; padding: .8rem;
         border: 1px solid var(--rule); border-radius: 12px; text-decoration: none; color: var(--ink); }
.promo img { width: 56px; height: auto; border-radius: 2px; box-shadow: var(--shadow); }
.promo b { display: block; font: 400 var(--step-0)/1.2 var(--display); }
.promo span { font-size: .8125rem; color: var(--muted); }
.promo:hover { border-color: var(--collar); }

@media (max-width: 820px) {
  .workspace { flex-direction: column; }
  #stage { padding: 12px; }
  .tray { width: auto; border-left: none; border-top: 1px solid var(--rule); max-height: 44vh; padding: 14px 16px;
          padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); gap: 1rem; }
  .swatches { grid-template-columns: repeat(10, 1fr); gap: .35rem; }
  .promo { display: none; }
}
