/* ============ the pen box and the pen maker (design canvas: PenBox / PenMaker) ============ */

.pbx { min-width: 0; }
.pbx .lbl small { font-family: var(--font-hand); font-weight: 400; font-size: .85rem; color: var(--ink-soft); margin-left: 6px; }
.pbx-ink { display: block; width: 100%; height: 100%; pointer-events: none; }

/* recent: six squares and the grid button, sharing one row */
.pbx-recent { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.pbx-sq {
    position: relative; height: 42px; min-width: 0; padding: 3px; display: grid; place-items: center; overflow: hidden; cursor: pointer;
    background: var(--white); color: var(--ink); border: 2px solid var(--line); border-radius: 10px 8px 11px 9px;
}
.pbx-sq:hover { background: color-mix(in srgb, var(--hi-yellow) 30%, var(--white)); }
.pbx-sq.on { background: var(--hi-yellow); box-shadow: 2px 2px 0 var(--line); }
.pbx-sq.all { border-style: dashed; background: transparent; }
.pbx-own { position: absolute; right: 2px; top: 2px; width: 8px; height: 8px; border-radius: 50%; background: var(--green-500); border: 1.5px solid var(--line); }
.pbx-own.board { background: var(--purple-500); }

/* all pens */
.pbx-grid { margin-top: 6px; padding: 2px 4px 4px 2px; }
.pbx-l-kit .pbx-grid { max-height: 330px; overflow: auto; }
.pbx-sec { display: flex; align-items: center; gap: 6px; margin: 6px 0 4px; font-family: var(--font-marker); font-weight: 700; font-size: 1.2rem; color: var(--ink-soft); }
.pbx-sec:first-child { margin-top: 0; }
.pbx-tape {
    display: inline-flex; align-items: center; padding: 0 7px; font-family: var(--font-hand); font-weight: 400; font-size: .75rem; line-height: 1.3;
    background: var(--purple-200); color: var(--gray-900); rotate: -3deg; white-space: nowrap;
    border-left: 2px dashed color-mix(in srgb, var(--gray-900) 20%, transparent); border-right: 2px dashed color-mix(in srgb, var(--gray-900) 20%, transparent);
}
.pbx-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.pbx-tile {
    position: relative; display: flex; flex-direction: column; align-items: center; min-width: 0; padding: 2px 2px 3px; overflow: hidden; cursor: pointer;
    font: inherit; font-size: .8rem; line-height: 1.1; color: var(--ink);
    background: var(--white); border: 2px solid var(--line); border-radius: 10px 8px 11px 9px;
}
.pbx-tile .pbx-ink { height: 30px; }
.pbx-tile:hover { background: color-mix(in srgb, var(--hi-yellow) 30%, var(--white)); }
.pbx-tile.on { background: var(--hi-yellow); box-shadow: 2px 2px 0 var(--line); }
.pbx-tile .n { max-width: 100%; padding: 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pbx-tile .by { font-size: .7rem; color: var(--ink-soft); }
.pbx-make { justify-content: center; gap: 2px; min-height: 52px; border-style: dashed; background: transparent; color: var(--link-ink); }
.pbx-make:hover { background: color-mix(in srgb, var(--blue-500) 8%, transparent); }
.pbx-none { font-size: .85rem; color: var(--ink-soft); padding: 2px 2px 6px; }

/* below the pens: the pen's own slider, "change this pen", a board pen's note */
.pbx-opt { display: flex; align-items: center; gap: 8px; }
.pbx-opt span { min-width: 34px; font-size: .8rem; color: var(--ink-soft); white-space: nowrap; }
.pbx-opt span:last-child { text-align: right; }
.pbx-opt input { flex: 1; min-width: 60px; background: color-mix(in srgb, var(--ink) 9%, var(--paper)); }
.pbx-link {
    display: inline-flex; align-items: center; gap: 6px; min-height: 36px; margin-top: 8px; padding: 0 12px; cursor: pointer;
    font: inherit; font-size: .9rem; color: var(--ink); background: var(--white); border: 2px solid var(--line); border-radius: 18px 14px 16px 12px;
}
.pbx-link:hover { background: color-mix(in srgb, var(--hi-yellow) 30%, var(--white)); }
.pbx-note { margin-top: 6px; font-size: .85rem; line-height: 1.25; color: var(--ink-soft); }

/* phone tray: one sideways strip */
.pbx-strip { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: none; }
.pbx-strip::-webkit-scrollbar { display: none; }
.pbx-strip .pbx-tile { flex-shrink: 0; width: 66px; }
.pbx-strip .pbx-tile .pbx-ink { height: 28px; }
.pbx-strip .pbx-tile.all { justify-content: center; gap: 2px; border-style: dashed; background: transparent; }

/* phone sheet */
.draw-psheet { flex: 1; overflow-y: auto; padding: 0 16px 18px; }
.draw-psheet .draw-cats { padding: 0 0 6px; margin: 0; }
.draw-psheet .pbx-tile .pbx-ink { height: 32px; }
.draw-psheet .lbl { margin: 10px 0 4px; font-family: var(--font-marker); font-weight: 700; font-size: 1.3rem; line-height: 1; }
.draw-lsheet:has(.draw-psheet) { height: min(640px, 86%); }

/* ---- the pen maker: a card on a computer, the whole screen on a phone ---- */
.pmk {
    box-sizing: border-box; max-width: calc(100vw - 32px); max-height: calc(100dvh - 32px); overflow: auto;
    padding: 18px 22px; color: var(--ink); background: var(--paper);
    border: 2.5px solid var(--line); border-radius: 12px 18px 14px 16px / 16px 12px 18px 14px; box-shadow: 6px 7px 0 var(--line);
}
.pmk * { box-sizing: border-box; }
.pmk::backdrop { background: color-mix(in srgb, var(--night-900) 38%, transparent); }
.pmk.desk { width: 1060px; }
.pmk.phone { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; padding: 0 16px; border: none; border-radius: 0; box-shadow: none; }
.pmk.phone .pmk-top { padding-top: 10px; }
.pmk-top { display: flex; align-items: center; gap: 10px; }
.pmk-top h2 { flex: 1; margin: 0; font-family: var(--font-marker); font-weight: 700; font-size: 2.1rem; line-height: 1; rotate: -1.5deg; }
.pmk-top h2 span { padding: 0 .2em; border-radius: .6em .2em; background: linear-gradient(104deg, transparent .9%, var(--hi-yellow) 2.4%, var(--hi-yellow) 97%, transparent 98.5%); color: var(--gray-900); }
.pmk-sub { margin: 8px 0 0; font-size: .95rem; color: var(--ink-soft); }
.pmk-cols { display: grid; gap: 22px; margin-top: 14px; }
.pmk.desk .pmk-cols { grid-template-columns: 330px 300px minmax(0, 1fr); }
.pmk-lbl { display: flex; align-items: baseline; gap: 8px; margin: 12px 0 6px; font-family: var(--font-marker); font-weight: 700; font-size: 1.3rem; line-height: 1.05; }
.pmk-lbl:first-child { margin-top: 0; }
.pmk-lbl small { font-family: var(--font-hand); font-weight: 400; font-size: .85rem; color: var(--ink-soft); }
.pmk-name {
    width: 100%; height: 42px; padding: 0 12px; font: inherit; font-size: 1.05rem; color: var(--ink); background: var(--white);
    border: 2px solid var(--line); border-radius: 185px 25px 145px 20px / 20px 155px 25px 175px;
}
.pmk-name:focus { outline: none; box-shadow: 3px 3px 0 var(--line); }
.pmk-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pmk-chip {
    display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 10px; cursor: pointer; white-space: nowrap;
    font: inherit; font-size: .84rem; color: var(--ink); background: var(--white); border: 2px solid var(--line); border-radius: 18px 14px 16px 12px;
}
.pmk-chip:hover { background: color-mix(in srgb, var(--hi-yellow) 30%, var(--white)); }
.pmk-chip.on { background: var(--navy); color: var(--cream); }
.pmk-tips { display: flex; flex-wrap: wrap; gap: 6px; align-items: stretch; }
.pmk-tip {
    width: 38px; height: 38px; display: grid; place-items: center; padding: 0; cursor: pointer;
    color: var(--ink); background: var(--white); border: 2px solid var(--line); border-radius: 10px 8px 11px 9px;
}
.pmk-tip:hover { background: color-mix(in srgb, var(--hi-yellow) 30%, var(--white)); }
.pmk-tip.on { background: var(--hi-yellow); color: var(--gray-900); box-shadow: 2px 2px 0 var(--line); }
.pmk-dab { display: block; width: 26px; height: 26px; }
.pmk-dab.big { width: 44px; height: 44px; }
.pmk-up {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; width: 60px; height: 38px; padding: 0 8px; cursor: pointer;
    font: inherit; font-size: .8rem; line-height: 1.05; color: var(--link-ink); background: transparent; border: 2px dashed var(--line); border-radius: 10px 8px 11px 9px;
}
.pmk-up:hover { background: color-mix(in srgb, var(--blue-500) 8%, transparent); }
.pmk-pic { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 8px; padding: 8px 10px; background: var(--white); border: 2px solid var(--line); border-radius: 12px 9px 13px 10px; }
.pmk-pic .was {
    width: 56px; height: 56px; flex-shrink: 0; display: grid; place-items: center; overflow: hidden; border-radius: 8px;
    border: 1.5px solid color-mix(in srgb, var(--gray-900) 22%, transparent);
    background: var(--white) repeating-conic-gradient(var(--bone) 0 25%, transparent 0 50%) 0 0 / 12px 12px;
}
.pmk-pic .was img { max-width: 48px; max-height: 48px; }
.pmk-pic .arrow { color: var(--ink-soft); }
.pmk-pic .now { width: 56px; height: 56px; flex-shrink: 0; display: grid; place-items: center; border-radius: 8px; border: 2px solid var(--line); background: var(--snow); }
.pmk-pic .f { flex: 1; min-width: 0; font-size: .95rem; overflow-wrap: anywhere; }
.pmk-pic .f small { font-size: .8rem; color: var(--ink-soft); }
.pmk-pic .t { order: 5; flex-basis: 100%; font-size: .85rem; line-height: 1.25; color: var(--ink-soft); }
.pmk-drop {
    display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 8px; padding: 16px 14px; text-align: center;
    font-size: .9rem; line-height: 1.25; color: var(--blue-900); background: var(--blue-50);
    border: 2.5px dashed var(--blue-500); border-radius: 14px 10px 15px 12px;
}
.pmk-drop.shut { display: none; }
.pmk-drop.over { background: var(--blue-100); }
.pmk-drop .big { font-family: var(--font-marker); font-weight: 700; font-size: 1.45rem; }
.pmk-drop small { font-size: .8rem; color: var(--blue-700); }
.pmk-drop .pmk-chip { position: relative; margin-top: 4px; }
.pmk-file { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.pmk-err { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; padding: 8px 10px; font-size: .9rem; line-height: 1.25; border-radius: 12px; background: var(--red-100); color: var(--danger-text); }
.pmk-err .icon { flex-shrink: 0; }
.pmk-row { display: flex; align-items: center; gap: 8px; min-height: 34px; }
.pmk-row .k { width: 86px; flex-shrink: 0; font-size: .95rem; }
.pmk-row .v { width: 64px; flex-shrink: 0; text-align: right; font-size: .8rem; color: var(--ink-soft); }
.pmk-row.angle { margin-top: 6px; }
.pmk-range { flex: 1; min-width: 0; width: auto; height: 22px; background: color-mix(in srgb, var(--ink) 9%, var(--paper)); }
.pmk-seg { display: flex; padding: 3px; background: color-mix(in srgb, var(--ink) 9%, var(--paper)); border: 2.5px solid var(--line); border-radius: 14px 18px 12px 16px; }
.pmk-seg button { flex: 1; min-height: 32px; padding: 0 8px; cursor: pointer; white-space: nowrap; font: inherit; font-size: .88rem; color: var(--ink-soft); background: none; border: none; border-radius: 10px; }
.pmk-seg button.on { background: var(--paper); color: var(--ink); box-shadow: 2px 2px 0 var(--line); }

/* the try-it paper: real paper, light in every theme */
.pmk-test {
    position: relative; height: 300px; overflow: hidden; touch-action: none; cursor: crosshair;
    background-color: var(--snow); background-image: radial-gradient(color-mix(in srgb, var(--gray-900) 16%, transparent) 1.1px, transparent 1.5px); background-size: 26px 26px;
    border: 2.5px solid var(--line); border-radius: 12px 14px 12px 10px;
}
.pmk-test.short { height: 190px; }
.pmk-pad { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pmk-test .clr {
    position: absolute; right: 6px; top: 6px; z-index: 2; min-height: 32px; padding: 0 10px; cursor: pointer;
    font: inherit; font-size: .85rem; color: var(--gray-900); background: var(--cream); border: 2px solid var(--gray-900); border-radius: 16px;
}
.pmk-sw { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.pmk-sw button { width: 28px; height: 28px; padding: 0; cursor: pointer; background: var(--c); border: 2.5px solid var(--line); border-radius: 50% 45% 52% 48%; }
.pmk-sw button.on { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5.5px var(--line); }
.pmk-note { margin-top: 10px; font-size: .85rem; line-height: 1.3; color: var(--ink-soft); }
.pmk-board {
    display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; padding: 10px 12px; cursor: pointer; font-size: .9rem; line-height: 1.25;
    background: var(--purple-50); color: var(--gray-900); border: 2px solid var(--line); border-radius: 12px 9px 13px 10px;
}
.pmk-board input { width: 22px; height: 22px; margin: 1px 0 0; flex-shrink: 0; accent-color: var(--purple-500); }
.pmk-board small { display: block; font-size: .8rem; color: var(--gray-700); }
.pmk-tape {
    display: inline-flex; align-items: center; margin-left: 4px; padding: 0 7px; font-size: .75rem; line-height: 1.3; white-space: nowrap;
    background: var(--purple-200); color: var(--gray-900); rotate: -3deg;
    border-left: 2px dashed color-mix(in srgb, var(--gray-900) 20%, transparent); border-right: 2px dashed color-mix(in srgb, var(--gray-900) 20%, transparent);
}
.pmk-foot { display: flex; align-items: center; gap: 8px; margin-top: 16px; padding-top: 12px; border-top: 2px dashed color-mix(in srgb, var(--ink) 20%, transparent); }
.pmk.phone .pmk-foot { position: sticky; bottom: 0; z-index: 3; margin: 16px -16px 0; padding: 12px 16px 14px; background: var(--paper); border-top: 2.5px solid var(--line); }
.pmk-grow { flex: 1; }
.pmk-slots { font-size: .8rem; color: var(--ink-soft); }
.pmk-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px; cursor: pointer;
    font: inherit; font-size: 1rem; color: var(--ink); background: var(--white); border: 2.5px solid var(--line); border-radius: 22px 18px 22px 16px;
}
.pmk-btn:hover { background: color-mix(in srgb, var(--hi-yellow) 30%, var(--white)); }
.pmk-btn.go { background: var(--hi-yellow); color: var(--gray-900); box-shadow: 3px 3px 0 var(--line); }
.pmk-btn.bin { padding: 0 10px; color: var(--danger-text); background: transparent; border-color: transparent; }
.pmk-btn.bin:hover { background: var(--red-100); }
.pmk-btn:disabled { opacity: .45; cursor: default; box-shadow: none; }
.pmk.phone .pmk-btn { padding: 0 14px; }
