/* Editor-specific styles. The shared look is in ui.css; the television frame and canvas are shared with the viewer. */
.pagebar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: rgba(20,22,26,.65); }
.pagebar .group { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.pagebar .group.right { margin-left: auto; align-items: center; }
.field { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; }
.field input { font-size: 14px; text-transform: none; letter-spacing: 0; color: var(--text); }
#num { width: 84px; } .field.grow { flex: 1 1 220px; min-width: 150px; } #title { width: 100%; } #hist { max-width: 230px; }

.chip[data-state] { font-weight: 600; }
.chip[data-state]::before { content: "\25CF"; font-size: 10px; }
.chip[data-state="dirty"] { color: var(--warn); border-color: #7a5a1f; background: #2a2112; }
.chip[data-state="saved"] { color: var(--ok); border-color: #2f6a40; background: #12241a; }
.chip[data-state="new"] { color: #9fb4cc; }
#who:empty { display: none; }

.banner { margin: 10px 14px 0; padding: 10px 14px; border-radius: 8px; border: 1px solid #355a85; background: #14202e; color: #cfe3f7; }
.banner.warn { border-color: #a6682e; background: #2a1a10; color: #ffd2a1; margin: 0 0 10px; }

.workspace { flex: 1; width: 100%; max-width: 1400px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 390px); gap: 18px; padding: 16px 14px 28px; align-items: start; }
/* the page stays in view while the tool panel scrolls */
#stage { position: sticky; top: 12px; min-width: 0; }
#stage .tv { max-width: min(100%, calc((100vh - 230px) * 1.3333)); min-width: 280px; margin: 0 auto; }
@media (max-width: 1000px) { .workspace { grid-template-columns: minmax(0, 1fr); } #stage { position: static; } #stage .tv { max-width: 100%; min-width: 0; } }

/* the editing canvas */
canvas#cv { cursor: text; outline: none; touch-action: pan-y; }
canvas#cv.draw { cursor: crosshair; touch-action: none; }
.screen:focus-within, .screen.typing { box-shadow: inset 0 0 0 1px #000, 0 0 0 2px #0b0c0e, 0 0 0 4px rgba(111,220,140,.55); }
.screen.draw-mode:focus-within, .screen.draw-mode.typing { box-shadow: inset 0 0 0 1px #000, 0 0 0 2px #0b0c0e, 0 0 0 4px rgba(255,179,71,.65); }
#hint { position: absolute; left: 0; right: 0; bottom: 18%; text-align: center; pointer-events: none; }
#hint span { display: inline-block; background: rgba(0,0,0,.78); border: 1px solid rgba(255,255,255,.25); color: #fff; padding: 6px 16px; border-radius: 999px; font-size: 13px; }
#hint.gone, .screen:focus-within #hint { display: none; }
#kbd { position: fixed; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; margin: 0; font-size: 16px; resize: none; pointer-events: none; }
#pad { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; justify-content: center; }
#pad button { min-width: 48px; min-height: 44px; font-size: 18px; }
.statusbar { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
#info { margin: 0; color: var(--dim); font: 12px ui-monospace, Menlo, Consolas, monospace; min-height: 1.3em; }
#status { min-height: 1.4em; color: var(--ok); } #status.err { color: var(--danger); }

/* the tool panel */
.panel { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tool { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.tool > summary { list-style: none; cursor: pointer; padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); user-select: none; }
.tool > summary::-webkit-details-marker { display: none; }
.tool > summary::after { content: "\25BE"; transition: transform .15s; }
.tool:not([open]) > summary::after { transform: rotate(-90deg); }
.tool > summary small { text-transform: none; letter-spacing: 0; margin-left: 8px; color: #6f7681; flex: 1; text-align: left; }
.tool .body { padding: 0 12px 12px; }
.row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; } .row + .row { margin-top: 8px; }
.help { color: var(--dim); font-size: 12px; line-height: 1.5; margin: 8px 0 0; }
.seg { display: inline-flex; } .seg button { border-radius: 0; } .seg button:first-child { border-radius: 6px 0 0 6px; } .seg button:last-child { border-radius: 0 6px 6px 0; margin-left: -1px; }
.sw { width: 34px; height: 30px; padding: 0; font-weight: 700; border: 2px solid rgba(255,255,255,.28); border-radius: 6px; }
.sw:hover:not(:disabled) { border-color: #fff; }
label.fl { display: flex; align-items: center; gap: 6px; border-left: 5px solid; padding-left: 7px; } label.fl input { width: 74px; }
#subChips button { min-width: 36px; }
#subChips button.on { background: #264a2c; border-color: #4f9a5c; color: #d6f5db; }
#interval { width: 64px; }

@media (max-width: 700px) {
  .pagebar { padding: 8px 10px; } .pagebar .group.right { margin-left: 0; width: 100%; } #hist { flex: 1; max-width: none; }
  .workspace { padding: 10px 8px 24px; gap: 12px; }
}
