:root {
  color-scheme: light;
  --page: #f7f8f6;
  --surface: #fff;
  --surface-soft: #fbfcfa;
  --canvas-outside: #e4e8e7;
  --text: #202722;
  --muted: #69746e;
  --line: #e1e6e1;
  --accent: #3c715a;
  --accent-soft: #e9f3ec;
  --button: #263c31;
  --button-text: #fff;
  --shadow: 0 16px 44px rgba(28, 49, 36, .07);
  --status-error-bg: #fbf1ec;
  --status-error-border: #dfb5a4;
  --status-error-text: #754637;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #151a17;
  --surface: #202823;
  --surface-soft: #1b211e;
  --canvas-outside: #303a36;
  --text: #eef3eb;
  --muted: #a3b1a6;
  --line: #364239;
  --accent: #a7d3b4;
  --accent-soft: #273a2f;
  --button: #d8eadb;
  --button-text: #1b2b21;
  --shadow: 0 18px 48px rgba(0, 0, 0, .23);
  --status-error-bg: #352a27;
  --status-error-border: #876255;
  --status-error-text: #f1cbbb;
}
* { box-sizing: border-box; }
html { background: var(--page); }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--page); color: var(--text); font: 15px/1.5 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: inherit; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, canvas:focus-visible, .upload-button:focus-within { outline: 3px solid #6f9e80; outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.shell { width: min(100% - 64px, 1540px); margin: auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 76px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; font-size: 21px; font-weight: 750; letter-spacing: -.055em; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--button); color: var(--button-text); font-size: 16px; font-weight: 400; line-height: 1; }
.brand-period { margin-left: -9px; color: var(--accent); }
.header-actions { display: flex; align-items: center; gap: 24px; }
.live-pill, .live-count { color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.live-pill { display: flex; align-items: center; gap: 8px; }
.live-dot { display: inline-block; width: 7px; height: 7px; flex: none; border-radius: 50%; background: #55a879; box-shadow: 0 0 0 3px rgba(85, 168, 121, .12); }
.theme-toggle { min-height: 40px; padding: 0 2px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--text); font-size: 12px; font-weight: 600; white-space: nowrap; }
.theme-toggle:hover { border-color: var(--text); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 42px; padding: 10px 14px; border: 1px solid transparent; border-radius: 6px; font-size: 12px; font-weight: 700; line-height: 1.2; text-decoration: none; transition: transform .15s, background-color .15s; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button.primary { background: var(--button); color: var(--button-text); }
.button.primary:hover:not(:disabled) { filter: brightness(.92); }
.button.outline { border-color: var(--line); background: var(--surface); color: var(--text); }
.button.outline:hover { background: var(--surface-soft); }
.button.full { width: 100%; justify-content: space-between; }
.eyebrow, .tool-kicker, .list-label { color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.workspace { display: grid; grid-template-columns: minmax(190px, .8fr) minmax(440px, 2.1fr) minmax(250px, .95fr); gap: clamp(24px, 3vw, 48px); align-items: start; padding: 47px 0 70px; }
.sidebar { min-width: 0; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; }
.icon-button { display: grid; place-items: center; width: 27px; height: 27px; padding: 0; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--accent); font-size: 19px; line-height: 1; }
.sidebar h1 { margin: 22px 0 18px; font: 400 clamp(33px, 3vw, 47px)/1.08 Georgia, "Times New Roman", serif; letter-spacing: -.055em; }
.sidebar h1 em { color: var(--accent); font-weight: 400; }
.sidebar-copy { margin: 0; max-width: 250px; color: var(--muted); font-size: 13px; line-height: 1.75; }
.board-list-wrap { margin-top: 58px; }
.list-label { margin: 0 0 12px; color: var(--muted); }
.board-list { display: grid; gap: 5px; }
.board-link { display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 39px; padding: 7px 10px; border-radius: 6px; color: var(--muted); font-size: 12px; font-weight: 650; overflow-wrap: anywhere; text-decoration: none; }
.board-link:hover, .board-link.active { background: var(--accent-soft); color: var(--text); }
.board-icon { display: grid; place-items: center; width: 23px; height: 23px; flex: none; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--accent); font-size: 14px; }
.board-link.active .board-icon { border-color: transparent; background: var(--accent); color: var(--surface); }
.board-link-copy { display: grid; min-width: 0; line-height: 1.2; }
.board-link-copy small { margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 450; }
.sidebar-foot { margin-top: 54px; color: var(--muted); font-size: 10px; }
.canvas-column { min-width: 0; }
.canvas-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 16px; min-height: 52px; margin: 0 0 17px; }
.canvas-toolbar h2 { margin: 3px 0 0; font-size: 21px; font-weight: 650; letter-spacing: -.035em; line-height: 1.2; }
.canvas-title-row { display: flex; align-items: center; gap: 9px; }
.archive-lock { position: relative; display: inline-grid; place-items: center; width: 24px; height: 24px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--muted); cursor: help; }
.archive-lock:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.archive-lock:is(:hover, :focus-visible)::after { position: absolute; z-index: 3; top: calc(100% + 7px); left: 50%; width: max-content; max-width: min(250px, 80vw); padding: 7px 9px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); box-shadow: var(--shadow); color: var(--text); content: attr(data-tip); font-size: 11px; font-weight: 500; line-height: 1.35; transform: translateX(-50%); }
.daily-panel { display: grid; gap: 10px; margin: 0 0 18px; }
.daily-date-row { padding: 3px 0; }
.daily-archive { display: grid; gap: 7px; }
.daily-archive h3 { margin: 0; color: var(--muted); font-size: 11px; font-weight: 700; }
#daily-archive { display: flex; flex-wrap: wrap; gap: 6px; }
.daily-archive-link { display: inline-flex; gap: 7px; align-items: center; padding: 6px 9px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); background: var(--surface); font-size: 11px; text-decoration: none; }
.daily-archive-link:hover, .daily-archive-link[aria-current="page"] { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.stage { padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.canvas-frame { position: relative; display: grid; place-items: center; width: 100%; background: var(--canvas-outside); }
#map { display: block; width: 100%; max-width: var(--canvas-max-width, 720px); height: auto; background: var(--canvas-outside); image-rendering: pixelated; cursor: crosshair; touch-action: manipulation; }
#keyboard-cursor { position: absolute; z-index: 1; min-width: 4px; min-height: 4px; box-shadow: 0 0 0 1px white, 0 0 0 2px #171d19; pointer-events: none; }
#night-marker { position: absolute; z-index: 2; width: 13px; height: 13px; border: 2px solid var(--button-text); border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--text); transform: translate(-50%, -50%); pointer-events: none; }
.canvas-bottom { display: flex; justify-content: space-between; gap: 18px; margin: 18px 1px 14px; color: var(--muted); font-size: 11px; }
.canvas-bottom > span:first-child { display: flex; align-items: center; gap: 10px; }
.canvas-bottom > span:last-child { font-size: 10px; font-weight: 700; letter-spacing: .1em; white-space: nowrap; }
.progress { height: 3px; overflow: hidden; background: var(--line); }
.progress > span { display: block; width: 0; height: 100%; background: var(--accent); transition: width .2s; }
.status { margin: 10px 1px; color: var(--muted); font-size: 11px; min-height: 18px; }
.status[data-tone="error"] { padding: 7px 10px; border-left: 2px solid var(--status-error-border); border-radius: 4px; background: var(--status-error-bg); color: var(--status-error-text); }
.board-expiry { margin: 5px 1px 0; color: var(--accent); font-size: 11px; }
.tools { padding: 3px 0 0 24px; border-left: 1px solid var(--line); }
.tool-section + .tool-section { margin-top: 27px; padding-top: 26px; border-top: 1px solid var(--line); }
.section-top { display: flex; align-items: center; justify-content: space-between; }
.tiny-square { width: 6px; height: 6px; border: 1px solid var(--accent); transform: rotate(45deg); }
.tool-section h2 { margin: 8px 0 5px; font-size: 17px; font-weight: 650; letter-spacing: -.03em; }
.tool-section p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.tool-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 14px; }
.tool-choice { min-height: 38px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); font-size: 11px; font-weight: 650; text-align: left; }
.tool-choice:hover { background: var(--surface-soft); }
.tool-choice[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.swatches { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 7px; margin: 18px 0 10px; }
.swatch { width: 100%; aspect-ratio: 1; min-height: 28px; padding: 0; border: 1px solid rgba(0,0,0,.1); border-radius: 4px; background: var(--swatch); }
.swatch:hover { transform: translateY(-2px); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.selected-color { color: var(--muted); font-size: 11px; }
.paint-actions { display: flex; flex-direction: column; align-items: flex-start; }
.source-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 17px 0 12px; }
.source-buttons .button { min-height: 40px; padding: 8px; white-space: nowrap; }
.upload-button { position: relative; overflow: hidden; cursor: pointer; }
.upload-button input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.photo-preview { display: flex; align-items: center; gap: 10px; margin: 12px 0; padding: 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.photo-preview img { width: 40px; height: 40px; flex: none; object-fit: contain; image-rendering: pixelated; }
#recreate { margin-top: 10px; }
.tool-section .help-text { margin-top: 10px; font-size: 10px; line-height: 1.5; }
.text-action { margin-top: 13px; padding: 0 0 4px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); font-size: 11px; font-weight: 650; }
.text-action:hover { border-color: var(--text); }
.text-action:disabled { opacity: .5; cursor: not-allowed; }
.tool-section .button + .button { margin-top: 9px; }
.tool-section .source-buttons .button + .button { margin-top: 0; }
.dialog { width: min(100% - 32px, 440px); padding: 30px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); box-shadow: 0 24px 80px rgba(0,0,0,.2); }
.dialog::backdrop { background: rgba(16, 25, 19, .55); backdrop-filter: blur(4px); }
.dialog form, .camera-body { position: relative; display: grid; gap: 14px; }
.dialog-close { position: absolute; top: -12px; right: -10px; border: 0; background: none; color: var(--muted); font-size: 24px; }
.dialog h2 { margin: 0; font: 400 33px/1.1 Georgia, serif; letter-spacing: -.04em; }
.dialog p { margin: 0; color: var(--muted); font-size: 13px; }
.dialog label { color: var(--text); font-size: 12px; font-weight: 700; }
.dialog input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); color: var(--text); }
.dialog .dialog-status { min-height: 0; color: var(--accent); font-size: 11px; }
.camera-body video { width: 100%; max-height: 400px; border-radius: 6px; background: #111; object-fit: contain; }
@media (max-width: 1130px) {
  .workspace { grid-template-columns: minmax(0, 1fr) minmax(230px, .55fr); }
  .sidebar { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; }
  .sidebar-heading, .sidebar h1, .sidebar-copy, .sidebar-foot { grid-column: 1; }
  .board-list-wrap { grid-column: 2; grid-row: 1 / span 4; margin-top: 0; }
  .sidebar h1 { margin: 12px 0; }
  .sidebar-foot { margin-top: 10px; }
}
@media (max-width: 700px) {
  .shell { width: min(100% - 30px, 570px); }
  .topbar { min-height: 66px; gap: 10px; }
  .header-actions { gap: 12px; }
  .live-pill { display: none; }
  .top-create { min-height: 36px; padding: 8px 10px; font-size: 11px; }
  .workspace { display: block; padding-top: 24px; }
  .sidebar { display: block; }
  .sidebar h1 { font-size: 36px; }
  .sidebar-copy { max-width: 420px; }
  .board-list-wrap { margin: 24px 0 26px; }
  .board-list { display: flex; flex-wrap: wrap; gap: 5px; }
  .board-link { max-width: 100%; }
  .sidebar-foot { display: none; }
  .canvas-toolbar { min-height: 0; }
  .canvas-bottom { font-size: 10px; }
  .tools { margin-top: 32px; padding: 0; border-left: 0; }
  .swatches { grid-template-columns: repeat(8, minmax(0, 36px)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
