:root {
  --hand: "Bradley Hand", "Segoe Print", "Chalkboard SE", "Marker Felt", "Comic Sans MS", cursive;
  --ink: #111;
  --muted: #777;
  --line: #e4e4e4;
  --faint: #f5f5f5;
  --bg: #fff;
  --accent: #111;
  --guide: #cfcfcf;
  --baseline: #8a8a8a;
}
* { box-sizing: border-box; }
html, body { overscroll-behavior: none; margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2 { font-weight: 600; letter-spacing: -0.02em; margin: 0 0 8px; }
h1 { font-size: 40px; line-height: 1.1; }
h2 { font-size: 22px; }
p { margin: 0 0 12px; }
code, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--faint); }
.small { font-size: 13px; }
.muted { color: var(--muted); }

header.top { display: flex; justify-content: space-between; align-items: center; max-width: 1080px; margin: 0 auto; padding: 18px 20px; }
.brand { font-weight: 600; text-decoration: none; }
nav a { margin-left: 18px; font-size: 14px; color: var(--muted); text-decoration: none; }
nav a:hover { color: var(--ink); }

main { max-width: 1080px; margin: 0 auto; padding: 0 20px 60px; }
.screen { padding-top: 16px; }
nav a.active { color: var(--ink); }
.hand { font-family: var(--hand); }
.screen-start { max-width: 720px; padding-top: 48px; }
.screen-start h1 { font-size: 44px; line-height: 1.15; font-weight: 400; margin-bottom: 18px; }
.screen-start .lead { font-size: 22px; line-height: 1.45; margin-bottom: 36px; }
.device { border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; margin-bottom: 20px; }
.device-line { font-size: 17px; margin-bottom: 12px; }
.device .actions { margin: 0 0 8px; }
.device .actions .button, .device .actions button { font-size: 15px; padding: 10px 18px; }
#deviceNote { margin: 0; }

button, .button {
  font: inherit; font-size: 14px; color: var(--ink); background: #fff; border: 1px solid #cfcfcf; border-radius: 8px;
  padding: 7px 14px; cursor: pointer; text-decoration: none; display: inline-block; line-height: 1.3;
}
button:hover, .button:hover { border-color: #888; }
button:disabled { opacity: 0.45; cursor: default; border-color: #cfcfcf; }
button.primary, .button.primary { background: var(--ink); color: #fff; border-color: var(--ink); position: relative; overflow: hidden; }
button.primary:hover, .button.primary:hover { background: #333; }
button.danger { color: #b00020; }
button.primary .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(255,255,255,0.25); pointer-events: none; }

.builder { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: 28px; align-items: start; }
.pad-col, .grid-col { min-width: 0; }
.pad-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 10px; flex-wrap: wrap; }
.pad-title { display: flex; align-items: baseline; gap: 12px; }
.pad-char { font-size: 32px; font-weight: 600; line-height: 1; min-width: 32px; }
.pad-hint { color: var(--muted); font-size: 14px; }
.pad-tools { display: flex; gap: 6px; }
.pad-wrap { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
#pad { display: block; width: 100%; touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; cursor: crosshair; }
#pad.space-mode { cursor: cell; }
.pad-tip { margin-top: 10px; font-size: 13px; color: var(--muted); }
.pointer-coarse { display: none; }
@media (hover: none) and (pointer: coarse) { .pointer-fine { display: none; } .pointer-coarse { display: block; } }

.grid-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; font-size: 14px; color: var(--muted); }
.grid-note { margin-top: 10px; }
.glyph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; }
.glyph-cell { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 8px; background: #fff; display: flex; align-items: center; justify-content: center; position: relative; cursor: pointer; padding: 0; }
.glyph-cell:hover { border-color: #999; }
.glyph-cell .lbl { font-size: 15px; color: #c4c4c4; font-family: inherit; }
.glyph-cell.drawn .lbl { display: none; }
.glyph-cell canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.glyph-cell.current { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink) inset; }


.preview-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.controls { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.controls label { display: flex; align-items: center; gap: 6px; }
.controls input[type=text] { font: inherit; font-size: 14px; color: var(--ink); border: 1px solid #cfcfcf; border-radius: 6px; padding: 5px 8px; width: 170px; }
.controls input[type=range] { width: 110px; accent-color: var(--ink); }
.preview-box { min-height: 150px; border: 1px solid var(--line); border-radius: 12px; padding: 26px 30px; font-size: 30px; line-height: 1.4; outline: none; word-wrap: break-word; white-space: pre-wrap; }
.preview-box:focus { border-color: #999; }
.preview-status { font-size: 13px; color: var(--muted); min-height: 18px; margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 14px 0 8px; }


footer { max-width: 1080px; margin: 0 auto; padding: 24px 20px 40px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }

.drop-overlay { position: fixed; inset: 0; background: rgba(255,255,255,0.92); display: none; align-items: center; justify-content: center; font-size: 22px; font-weight: 600; z-index: 50; border: 3px dashed var(--ink); margin: 12px; border-radius: 16px; pointer-events: none; }
body.dragging .drop-overlay { display: flex; }

@media (max-width: 820px) {
  .builder { grid-template-columns: 1fr; gap: 16px; }
  .screen-start { padding-top: 20px; }
  .screen-start h1 { font-size: 34px; }
  .screen-start .lead { font-size: 19px; margin-bottom: 24px; }
  .device { padding: 16px; }
  .pad-head { flex-direction: column; align-items: stretch; }
  .pad-tools { justify-content: space-between; }
  .pad-tools button { flex: 1; padding: 10px 8px; }
  .pad-char { font-size: 28px; }
  .glyph-grid { display: flex; overflow-x: auto; gap: 6px; padding-bottom: 6px; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
  .glyph-cell { flex: 0 0 44px; width: 44px; height: 44px; }
  .grid-head { position: sticky; top: 0; }
  .preview-box { font-size: 24px; padding: 16px; }
  .preview-head { flex-direction: column; align-items: stretch; }
  .controls { gap: 10px 16px; }
  .controls input[type=text] { width: 100%; }
  .controls label:first-child { width: 100%; }
  header.top { padding: 14px 16px; }
  nav a { margin-left: 12px; }
  .actions button, .actions .button { padding: 10px 14px; }
}

.owner { margin-top: 28px; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.owner h3 { margin: 0 0 8px; font-size: 16px; }
.share { margin: 16px 0 8px; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.share .actions { margin: 10px 0 0; }
.share-url { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; word-break: break-all; }
.font-list { list-style: none; padding: 0; margin: 0; max-width: 720px; }
.font-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.font-name { font-size: 28px; text-decoration: none; }
.font-name:hover { text-decoration: underline; }

.ticker { margin-top: 36px; }
.ticker-head { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.ticker-head a { margin-left: auto; text-decoration: none; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #111; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.ticker-track { display: flex; gap: 12px; overflow: hidden; mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.ticker-row { display: flex; gap: 12px; flex: none; animation: ticker 60s linear infinite; }
.ticker-track:hover .ticker-row { animation-play-state: paused; }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(calc(-100% - 12px)); } }
.ticker-card { flex: none; width: 190px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; text-decoration: none; color: inherit; background: #fff; }
.ticker-card:hover { border-color: #999; }
.ticker-time { font-size: 30px; line-height: 1.15; white-space: nowrap; overflow: hidden; }
.ticker-where { font-size: 12px; color: var(--muted); margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (prefers-reduced-motion: reduce) { .ticker-row { animation: none; } .ticker-track { overflow-x: auto; } }

/* Corner pills (same as uselocalflow.app): quiet until hovered. */
.corner { position: fixed; top: 16px; z-index: 10; display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 14px 0 12px; border-radius: 999px; font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap; background: #f1f1f1; color: #000; opacity: 0.45; transition: opacity 0.35s ease, background 0.2s ease; }
.corner:hover, .corner:focus-visible { opacity: 1; background: #e6e6e6; }
.corner.left { left: 20px; }
.corner.right { right: 20px; }
.corner svg { flex: none; }
@media (max-width: 640px) { .corner { top: 10px; height: 28px; font-size: 12px; } .corner.left { left: 10px; } .corner.right { right: 10px; } }
