:root {
  --bg: #161617;
  --panel: #1e1f22;
  --panel-2: #24262a;
  --line: #34373d;
  --line-soft: #2b2e34;
  --text: #f2f2f3;
  --muted: #a3a7b0;
  --accent-light: #ffb08a;
  --accent: #f93a00;
  --accent-strong: #f66800;
  --accent-soft: rgba(249, 58, 0, 0.16);
  --accent-shadow: rgba(246, 104, 0, 0.3);
  --danger: #f87171;
  --radius: 14px;
  --board-zoom: 1;
  --board-pan-x: 0px;
  --board-pan-y: 0px;
  --grid-size: 22px;
  --ui-scale: .8;
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; background: var(--bg); color: var(--text); font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { overflow: hidden; padding: 14px; user-select: none; }
button, input, textarea { font: inherit; }
button { user-select: none; }
input, textarea, [contenteditable="true"] { user-select: text; -webkit-user-select: text; }
h1, h2, p { margin: 0; }
h1 { font-size: 22px; line-height: 1.1; font-weight: 800; }
h2 { font-size: 15px; }

.app-shell { display: flex; flex-direction: column; gap: 10px; width: 100%; height: calc(100vh - 28px); min-height: 0; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex: 0 0 auto; }
.brand-block { min-width: 0; }
.muted { color: var(--muted); font-size: 11px; }
.title-info-btn { width: 22px; height: 22px; margin-left: 6px; padding: 0; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); font-size: 12px; font-weight: 800; vertical-align: middle; cursor: pointer; }
.title-info-btn.is-active, .title-info-btn:hover { color: var(--text); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-soft); }

.primary-btn, .ghost-btn, .icon-btn, .board-add, .tool-btn { min-height: calc(42px * var(--ui-scale)); border-radius: calc(14px * var(--ui-scale)); padding: 0 calc(14px * var(--ui-scale)); cursor: pointer; transition: .18s ease; }
.primary-btn { background: linear-gradient(180deg, var(--accent), var(--accent-strong)); border: 0; color: #120904; font-weight: 800; }
.primary-btn.danger-action { background: rgba(248,113,113,.14); border: 1px solid rgba(248,113,113,.36); color: var(--danger); }
.ghost-btn, .icon-btn, .board-add, .tool-btn { background: var(--panel-2); border: 1px solid rgba(255,255,255,.08); color: #f2f5fa; }
.primary-btn:hover, .ghost-btn:hover, .icon-btn:hover, .board-add:hover, .tool-btn:hover { filter: brightness(1.08); }
.icon-btn, .board-add { width: calc(42px * var(--ui-scale)); padding: 0; flex: 0 0 auto; font-weight: 800; }
.compact { width: calc(34px * var(--ui-scale)); min-height: calc(34px * var(--ui-scale)); border-radius: calc(11px * var(--ui-scale)); }
.danger { color: var(--danger); }

.board-strip { display: grid; grid-template-columns: calc(42px * var(--ui-scale)) minmax(0, 1fr); gap: calc(8px * var(--ui-scale)); flex: 0 0 auto; }
.board-tabs { display: flex; gap: calc(7px * var(--ui-scale)); overflow-x: auto; padding-bottom: 1px; }
.board-tab { min-width: calc(128px * var(--ui-scale)); max-width: calc(190px * var(--ui-scale)); min-height: calc(42px * var(--ui-scale)); padding: calc(5px * var(--ui-scale)) calc(8px * var(--ui-scale)); border-radius: calc(14px * var(--ui-scale)); border: 1px solid var(--line); background: var(--panel); color: var(--muted); display: grid; grid-template-columns: minmax(0, 1fr) calc(24px * var(--ui-scale)); gap: calc(5px * var(--ui-scale)); align-items: center; }
.board-tab.is-active { background: var(--panel-2); color: var(--text); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-soft); }
.board-tab.has-running-time { animation: boardBreath 3.8s ease-in-out infinite; }
.app-shell.is-info-open .board-tab.is-active { background: var(--panel); color: var(--muted); border-color: var(--line); box-shadow: none; }
.board-action { width: calc(24px * var(--ui-scale)); height: calc(24px * var(--ui-scale)); display: grid; place-items: center; padding: 0; border: 0; border-radius: calc(8px * var(--ui-scale)); background: rgba(255,255,255,.055); color: var(--muted); cursor: pointer; font-size: calc(10px * var(--ui-scale)); font-weight: 800; }
.board-action:hover { background: rgba(255,255,255,.1); color: var(--text); }
.board-action.danger { color: var(--danger); }
.board-select { min-width: 0; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; padding: 0; }
.board-select strong, .board-select span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-tab strong { font-size: 12px; }
.board-tab span { font-size: 10px; color: var(--muted); }
@keyframes boardBreath {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(249,58,0,.10); border-color: rgba(249,58,0,.34); }
  50% { box-shadow: 0 0 0 2px rgba(249,58,0,.08), inset 0 0 0 1px rgba(249,58,0,.18); border-color: rgba(249,58,0,.72); }
}
.context-menu { position: fixed; z-index: 1100; min-width: 126px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: 0 18px 42px rgba(0,0,0,.42); }
.context-menu[hidden] { display: none; }
.context-menu button { width: 100%; min-height: 30px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font-weight: 800; text-align: left; cursor: pointer; }
.context-menu button:hover { background: var(--panel-2); }
.context-menu button.danger { color: var(--danger); }
.menu-divider { height: 1px; margin: 6px 4px; background: var(--line-soft); }
.label-menu { display: grid; grid-template-columns: repeat(4, 24px); gap: 5px; padding: 2px 4px 4px; }
.context-menu .label-dot { width: 24px; min-height: 24px; padding: 0; border-radius: 999px; border: 2px solid transparent; background: var(--label-color, transparent); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.context-menu .label-dot:hover, .context-menu .label-dot.is-active { border-color: #fff; background: var(--label-color, transparent); }
.label-none { --label-color: transparent; background-image: linear-gradient(135deg, transparent 43%, rgba(255,255,255,.6) 45%, rgba(255,255,255,.6) 55%, transparent 57%); }
.label-red { --label-color: #ff5f57; }
.label-orange { --label-color: #ff9f0a; }
.label-yellow { --label-color: #ffd60a; }
.label-green { --label-color: #32d74b; }
.label-blue { --label-color: #0a84ff; }
.label-purple { --label-color: #bf5af2; }
.label-gray { --label-color: #8e8e93; }

.workspace { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; border-radius: var(--radius); border: 1px solid var(--line-soft); background: #111214; }
.info-view { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.info-view[hidden] { display: none; }
.info-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); box-shadow: inset 0 1px 0 rgba(255,255,255,.02); }
.youtube-helper-card { border-color: color-mix(in srgb, var(--accent) 38%, rgba(255,255,255,.08)); background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 20%, var(--panel)) 0%, var(--panel) 54%, color-mix(in srgb, var(--accent-light) 12%, var(--panel)) 100%); box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 12px 32px color-mix(in srgb, var(--accent-shadow) 38%, transparent); }
.card-copy { color: #c4cad5; font-size: 12px; line-height: 1.45; }
.helper-size { color: var(--accent-light); font-weight: 800; }
.helper-action-btn { border: 0; background: linear-gradient(135deg, var(--accent), var(--accent-light)); color: #120904; box-shadow: 0 10px 28px color-mix(in srgb, var(--accent-shadow) 55%, transparent); }
.helper-action-btn:hover { filter: brightness(1.08); }
.helper-action-btn.is-uninstall { background: rgba(255,255,255,.08); color: var(--text); border: 1px solid rgba(255,255,255,.1); box-shadow: none; }
.theme-preset-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.theme-preset { min-width: 0; min-height: 44px; display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; align-items: center; padding: 0 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-size: 11px; font-weight: 800; text-align: left; cursor: pointer; }
.theme-preset:hover, .theme-preset.is-active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-soft); }
.theme-preset span { width: 22px; height: 22px; border-radius: 999px; background: linear-gradient(135deg, var(--swatch-a), var(--swatch-b)); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.theme-preset[data-theme="what"] { --swatch-a: #f93a00; --swatch-b: #ffb08a; }
.theme-preset[data-theme="blue"] { --swatch-a: #3b82f6; --swatch-b: #93c5fd; }
.theme-preset[data-theme="mint"] { --swatch-a: #10b981; --swatch-b: #8bf4c6; }
.theme-preset[data-theme="amber"] { --swatch-a: #f59e0b; --swatch-b: #fde68a; }
.theme-preset[data-theme="rose"] { --swatch-a: #f43f5e; --swatch-b: #fda4af; }
.theme-preset[data-theme="violet"] { --swatch-a: #8b5cf6; --swatch-b: #c4b5fd; }
.support-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.support-grid .ghost-btn { min-width: 0; padding: 0 8px; }
.setting-value { color: var(--muted); font-size: 11px; font-weight: 800; }
.range-input { width: 100%; accent-color: var(--accent); }
.board-canvas { position: absolute; inset: 0; overflow: hidden; cursor: default; background-color: #151619; background-image: radial-gradient(rgba(255,255,255,.055) 1px, transparent 1px); background-size: calc(var(--grid-size) * var(--board-zoom)) calc(var(--grid-size) * var(--board-zoom)); background-position: var(--board-pan-x) var(--board-pan-y); }
.board-canvas.is-panning { cursor: grabbing; }
.board-canvas.is-dragover { outline: 2px solid var(--accent); outline-offset: -8px; }
.canvas-toolbar { position: absolute; left: 0; right: 0; top: 0; z-index: 120; display: grid; grid-template-columns: auto minmax(120px, 1fr) auto; gap: calc(8px * var(--ui-scale)); align-items: center; padding: calc(8px * var(--ui-scale)); background: rgba(21,22,25,.94); border-bottom: 1px solid var(--line-soft); backdrop-filter: blur(10px); }
.add-actions { display: flex; gap: calc(6px * var(--ui-scale)); min-width: 0; }
.tool-btn { width: calc(36px * var(--ui-scale)); min-height: calc(34px * var(--ui-scale)); padding: 0; border-radius: calc(11px * var(--ui-scale)); flex: 0 0 auto; font-size: calc(10px * var(--ui-scale)); font-weight: 800; }
.tool-btn[aria-label="Add link"] { width: calc(44px * var(--ui-scale)); }
.tool-btn svg { width: 14px; height: 14px; display: block; margin: auto; }
.snap-btn { color: var(--text); }
.snap-btn.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent-soft); }
.search-input { width: 100%; min-height: calc(34px * var(--ui-scale)); min-width: 0; padding: 0 calc(10px * var(--ui-scale)); border-radius: calc(10px * var(--ui-scale)); border: 1px solid var(--line); background: var(--panel-2); color: var(--text); }
.board-hud { position: absolute; right: 10px; bottom: 10px; z-index: 130; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 800; pointer-events: none; }
.fit-btn { width: 24px; height: 24px; display: grid; place-items: center; padding: 0; border: 1px solid rgba(255,255,255,.08); border-radius: 8px; background: rgba(36,38,42,.82); color: var(--text); font-size: 10px; font-weight: 900; cursor: pointer; pointer-events: auto; }
.zoom-readout { min-width: 34px; text-align: right; text-shadow: 0 1px 8px rgba(0,0,0,.65); }
.items-layer { position: absolute; inset: 0; overflow: visible; transform: translate(var(--board-pan-x), var(--board-pan-y)) scale(var(--board-zoom)); transform-origin: 0 0; }
.group-selection-btn { position: absolute; z-index: 135; min-height: 28px; padding: 0 10px; border: 1px solid var(--accent); border-radius: 999px; background: var(--panel-2); color: var(--text); font-size: 11px; font-weight: 900; cursor: pointer; box-shadow: 0 10px 28px rgba(0,0,0,.34), 0 0 0 1px var(--accent-soft); }
.group-selection-btn[hidden] { display: none; }
.empty-state { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); min-width: 170px; min-height: 96px; display: grid; place-items: center; gap: 4px; padding: 14px; border-radius: 14px; border: 1px dashed var(--line); color: var(--muted); background: rgba(30,31,34,.72); pointer-events: none; }
.empty-state strong { color: var(--text); font-size: 13px; }
.empty-state span { font-size: 11px; }
.empty-state.is-hidden { display: none; }

.board-item { position: absolute; z-index: 10; width: 176px; height: 132px; display: grid; grid-template-rows: minmax(0, 1fr) 44px; overflow: hidden; border-radius: 14px; border: 1px solid rgba(255,255,255,.08); background: var(--panel); box-shadow: 0 12px 26px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.02); transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease, opacity .18s ease; user-select: none; -webkit-user-select: none; pointer-events: auto; cursor: grab; }
.board-item:hover { border-color: rgba(255,255,255,.16); box-shadow: 0 16px 34px rgba(0,0,0,.28), 0 0 0 1px var(--accent-soft); }
.board-item.is-selected { border-color: var(--accent); box-shadow: 0 16px 34px rgba(0,0,0,.28), 0 0 0 2px var(--accent-soft); }
.board-item[data-label="red"] { border-color: rgba(255,95,87,.78); box-shadow: 0 12px 26px rgba(0,0,0,.22), 0 0 0 1px rgba(255,95,87,.25); }
.board-item[data-label="orange"] { border-color: rgba(255,159,10,.78); box-shadow: 0 12px 26px rgba(0,0,0,.22), 0 0 0 1px rgba(255,159,10,.25); }
.board-item[data-label="yellow"] { border-color: rgba(255,214,10,.78); box-shadow: 0 12px 26px rgba(0,0,0,.22), 0 0 0 1px rgba(255,214,10,.22); }
.board-item[data-label="green"] { border-color: rgba(50,215,75,.78); box-shadow: 0 12px 26px rgba(0,0,0,.22), 0 0 0 1px rgba(50,215,75,.22); }
.board-item[data-label="blue"] { border-color: rgba(10,132,255,.78); box-shadow: 0 12px 26px rgba(0,0,0,.22), 0 0 0 1px rgba(10,132,255,.22); }
.board-item[data-label="purple"] { border-color: rgba(191,90,242,.78); box-shadow: 0 12px 26px rgba(0,0,0,.22), 0 0 0 1px rgba(191,90,242,.22); }
.board-item[data-label="gray"] { border-color: rgba(142,142,147,.78); box-shadow: 0 12px 26px rgba(0,0,0,.22), 0 0 0 1px rgba(142,142,147,.24); }
.board-item.is-missing { border-color: rgba(255, 111, 97, .7); box-shadow: 0 0 0 1px rgba(255, 111, 97, .22), 0 14px 30px rgba(0,0,0,.24); }
.board-item.is-missing .item-kind { color: #ff8a80; }
.board-item.is-dragging { cursor: grabbing; transform: scale(.985); opacity: .88; z-index: 80; }
.board-item.is-hidden { display: none; }
.board-item.note-item { grid-template-rows: minmax(0, 1fr) 34px; }
.board-item.website-item { grid-template-rows: 1fr; cursor: pointer; }
.board-item.website-item .item-preview { display: none; }
.board-item.website-item .item-footer { min-height: 100%; border-top: 0; }
.board-item.time-item { grid-template-rows: 1fr; }
.board-item.time-item .item-footer { display: none; }
.board-item.group-item { z-index: 2; grid-template-rows: 1fr; background: rgba(36,38,42,.2); border: 1px dashed rgba(255,255,255,.22); box-shadow: inset 0 0 0 1px rgba(255,255,255,.025), 0 14px 34px rgba(0,0,0,.12); }
.board-item.group-item .item-preview { display: none; }
.board-item.group-item .item-footer { min-height: 100%; align-items: start; padding: 9px 10px; border-top: 0; background: rgba(36,38,42,.16); }
.board-item.group-item .item-title { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.board-item.group-item .item-kind { display: none; }
.item-preview { min-width: 0; min-height: 0; position: relative; display: grid; place-items: center; background: #101113; color: var(--muted); overflow: hidden; cursor: pointer; }
.item-preview img, .item-preview video, .item-preview iframe { width: 100%; height: 100%; border: 0; object-fit: contain; display: block; background: #101113; }
.board-item .item-preview * { pointer-events: none; }
.item-preview.note-preview { align-items: start; justify-items: stretch; padding: 12px; background: #25282e; color: #d9dee8; font-size: 12px; line-height: 1.35; overflow: hidden; }
.note-preview-text { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; }
.note-preview-text b, .note-preview-text strong { font-weight: 900; }
.note-preview-text i, .note-preview-text em { font-style: italic; }
.note-preview-text blockquote, .note-preview-text .note-quote { margin: 0 0 0 20px; padding-left: 0; }
.note-preview-text .note-check { display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: 6px; align-items: start; }
.note-preview-text .note-check::before { content: ""; width: 9px; height: 9px; margin-top: 4px; border: 1px solid var(--muted); border-radius: 3px; }
.note-preview-text .note-check.is-checked::before { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--panel-2); }
.missing-preview { padding: 12px; text-align: center; color: var(--muted); font-size: 11px; }
.url-preview { width: 100%; height: 100%; display: grid; place-items: center; padding: 14px; text-align: center; color: var(--muted); font-size: 11px; overflow: hidden; word-break: break-all; background: #101113; }
.item-preview.website-preview { justify-items: start; align-items: center; padding: 0 10px; background: var(--panel); color: var(--muted); font-size: 9px; line-height: 1.2; }
.website-preview-text { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-preview.time-preview { padding: 10px; background: #18191d; }
.board-item.time-item .time-preview { cursor: default; }
.board-item.time-item .time-quick-controls, .board-item.time-item .time-quick-controls * { pointer-events: auto; }
.time-card { width: 100%; height: 100%; display: grid; place-items: center; gap: 8px; color: var(--text); }
.time-card.is-full { align-content: center; place-items: stretch; max-width: 520px; margin: auto; padding: 10px; }
.time-mode-tabs { display: flex; justify-content: center; gap: 6px; }
.time-mode-tabs button { min-height: 26px; padding: 0 9px; border: 1px solid rgba(255,255,255,.08); border-radius: 9px; background: rgba(255,255,255,.06); color: var(--muted); font-size: 10px; font-weight: 900; cursor: pointer; }
.time-mode-tabs button.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.time-active-mode { color: var(--muted); font-size: 10px; font-weight: 900; text-align: center; text-transform: uppercase; letter-spacing: .04em; }
.time-phase { min-height: 14px; color: var(--muted); font-size: 10px; font-weight: 900; text-align: center; text-transform: uppercase; letter-spacing: .04em; }
.time-phase[hidden] { display: none; }
.time-value { font-size: 28px; line-height: 1; font-weight: 900; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.time-card.is-full .time-value { text-align: center; font-size: clamp(42px, 12vw, 92px); }
.time-quick-controls, .time-controls { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.time-quick-controls button, .time-controls button { width: 34px; min-height: 34px; display: grid; place-items: center; padding: 0; border: 1px solid rgba(255,255,255,.08); border-radius: 10px; background: var(--panel-2); color: var(--accent); font-weight: 900; cursor: pointer; }
.time-quick-controls button:hover, .time-controls button:hover { border-color: rgba(255,255,255,.2); background: rgba(255,255,255,.09); }
.time-quick-controls svg, .time-controls svg { width: 14px; height: 14px; }
.time-duration, .pomodoro-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pomodoro-settings { grid-template-columns: 1fr; }
.time-duration label, .pomodoro-settings label { min-width: 0; }
.time-duration input, .pomodoro-settings input { min-height: 34px; width: 100%; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); }
.pomodoro-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.pomodoro-total { width: 68px; min-height: 34px; display: grid; place-items: center; padding: 0 8px; border-radius: 10px; background: rgba(255,255,255,.045); color: var(--text); font-size: 11px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pomodoro-tip { display: grid; gap: 4px; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.035); color: var(--muted); font-size: 10px; font-weight: 700; }
.pomodoro-tip span { display: flex; justify-content: space-between; gap: 10px; }
.pomodoro-tip strong { color: var(--text); font-weight: 900; }
.board-link-preview, .table-preview { padding: 10px; background: #18191d; align-items: stretch; justify-items: stretch; }
.web-preview-node { padding: 10px; background: var(--accent); color: #170801; align-items: stretch; justify-items: stretch; }
.composition-preview-node { background: var(--accent); }
.board-link-box, .web-preview-card { min-width: 0; display: grid; align-content: center; gap: 7px; padding: 10px; border-radius: 12px; background: rgba(255,255,255,.045); text-align: left; }
.composition-preview-card { width: 100%; height: 100%; border: 0; color: inherit; cursor: pointer; }
.viewer-media .composition-preview-node { border-radius: 12px; overflow: hidden; }
.board-link-box strong, .web-preview-card strong { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-link-box span, .web-preview-card span { color: var(--muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-preview { overflow: hidden; }
.table-size-controls { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; color: var(--muted); }
.table-size-controls input { width: 54px; min-height: 30px; padding: 0 8px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-weight: 800; }
.table-preview table { width: 100%; border-collapse: collapse; color: var(--text); font-size: 10px; }
.table-preview th, .table-preview td { max-width: 80px; padding: 5px 6px; border: 1px solid rgba(255,255,255,.08); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-preview th { background: rgba(255,255,255,.06); font-weight: 900; }
.viewer-media .table-preview { width: 100%; max-height: min(58vh, 620px); padding: 14px; overflow: auto; }
.viewer-media .table-preview table { font-size: 12px; }
.viewer-media .table-preview th, .viewer-media .table-preview td { max-width: none; white-space: normal; }
.web-preview-node iframe { width: var(--web-layout-width, 1440px); height: calc(100% / var(--web-page-scale, 1)); min-height: 260px; border: 0; background: #fff; border-radius: 10px; transform: scale(var(--web-page-scale, 1)); transform-origin: 0 0; }
.web-frame-wrap { flex: 1 1 auto; min-height: 0; overflow: auto; background: #151619; }
.web-preview-toolbar { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto auto 38px; gap: 8px; align-items: center; padding: 8px; background: var(--panel); }
.web-preview-url { min-width: 0; min-height: 34px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--text); font-weight: 800; outline: 0; }
.web-preview-open { min-height: 34px; padding: 0 12px; border: 0; border-radius: 10px; background: rgba(255,255,255,.08); color: var(--text); font-weight: 900; cursor: pointer; white-space: nowrap; }
.web-preview-open:hover { background: var(--accent); color: #fff; }
.web-preview-close { width: 34px; height: 34px; }
.web-zoom-control { min-height: 34px; display: grid; grid-template-columns: 54px 34px 34px auto; align-items: center; gap: 6px; padding: 0 6px; border-radius: 12px; background: rgba(255,255,255,.08); color: var(--text); font-weight: 900; }
.web-zoom-value { text-align: center; font-variant-numeric: tabular-nums; }
.web-zoom-control button { min-height: 26px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font-size: 14px; font-weight: 900; cursor: pointer; }
.web-zoom-control button[data-web-zoom="reset"] { color: var(--accent-light); font-size: 11px; }
.web-zoom-control button:hover { background: rgba(255,255,255,.08); }
.viewer-dialog.is-web-preview .viewer-shell { width: calc(100vw - 28px); height: calc(100vh - 28px); max-height: calc(100vh - 28px); overflow: hidden; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.viewer-dialog.is-web-preview .viewer-topbar { display: none; }
.viewer-dialog.is-web-preview .viewer-topbar .title-input { display: none; }
.viewer-dialog.is-web-preview .viewer-media { flex: 1 1 auto; width: 100%; height: 100%; max-height: none; display: block; border-radius: 0; background: transparent; }
.viewer-dialog.is-web-preview .viewer-media iframe { flex: 1 1 auto; min-height: 0; border-radius: 0; }
.viewer-dialog.is-web-preview .web-preview-node { width: 100%; height: 100%; display: flex; flex-direction: column; padding: 0; background: transparent; color: var(--text); }
.viewer-dialog.is-web-preview .type-badge { display: none; }
.viewer-dialog.is-web-preview #closeViewerBtn { display: none; }
.pdf-preview { width: 100%; height: 100%; display: grid; place-items: center; gap: 5px; padding: 14px; text-align: center; color: var(--muted); background: #101113; }
.pdf-preview strong { color: var(--text); font-size: 18px; letter-spacing: .06em; }
.pdf-preview span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.external-preview { position: relative; width: 100%; height: 100%; display: grid; place-items: center; overflow: hidden; background: #101113; }
.external-preview img { width: 100%; height: 100%; object-fit: contain; }
.youtube-safe-preview img { object-fit: contain; }
.external-fallback { padding: 14px; text-align: center; color: var(--muted); font-size: 11px; word-break: break-word; }
.open-link-btn, .try-player-btn, .download-link-btn, .import-link-btn { width: 34px; min-height: 30px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 10px; background: rgba(255,255,255,.08); color: var(--text); cursor: pointer; }
.coming-soon-btn { min-height: 30px; display: grid; place-items: center; padding: 0 9px; border: 0; border-radius: 10px; background: rgba(255,255,255,.06); color: var(--muted); font-size: 10px; font-weight: 900; cursor: pointer; }
.text-action-btn { width: auto; min-width: 96px; padding: 0 10px; font-size: 10px; font-weight: 900; white-space: nowrap; }
.quality-wrap { position: relative; flex: 0 0 auto; }
.quality-menu { position: absolute; left: 0; top: calc(100% + 6px); z-index: 40; display: grid; gap: 4px; min-width: 156px; padding: 5px; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; background: #202329; box-shadow: 0 14px 34px rgba(0,0,0,.38); }
.quality-menu[hidden] { display: none; }
.quality-menu button { min-height: 28px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 0 9px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font-size: 10px; font-weight: 900; text-align: left; cursor: pointer; white-space: nowrap; }
.quality-meta { color: var(--muted); font-size: 9px; font-weight: 800; }
.quality-menu button:hover { background: rgba(255,255,255,.1); color: var(--accent-light); }
.quality-menu button:disabled { color: rgba(242,242,243,.34); cursor: default; }
.quality-menu button:disabled:hover { background: transparent; color: rgba(242,242,243,.34); }
.quality-select { height: 30px; max-width: 92px; padding: 0 8px; border: 0; border-radius: 10px; background: rgba(255,255,255,.08); color: var(--text); font-size: 10px; font-weight: 900; outline: 0; cursor: pointer; }
.open-link-btn svg, .try-player-btn svg, .download-link-btn svg, .import-link-btn svg { width: 14px; height: 14px; display: block; }
.open-link-btn:hover, .try-player-btn:hover, .download-link-btn:hover, .import-link-btn:hover, .coming-soon-btn:hover, .quality-select:hover { background: rgba(255,255,255,.14); }
.youtube-embed-wrap { position: relative; width: 100%; display: grid; place-items: center; background: #000; }
.youtube-embed-wrap iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; display: block; background: #000; }
.type-badge { position: absolute; right: 8px; top: 8px; min-width: 25px; min-height: 22px; display: grid; place-items: center; padding: 0 7px; border-radius: 999px; background: rgba(0,0,0,.58); color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .03em; }
.item-delete { position: absolute; left: 7px; top: 7px; z-index: 5; width: 22px; height: 22px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 999px; background: rgba(0,0,0,.62); color: #fff; cursor: pointer; opacity: 0; transition: .18s ease; }
.board-item:hover .item-delete, .board-item.is-selected .item-delete { opacity: 1; }
.item-footer { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 5px 10px; background: var(--panel-2); cursor: grab; }
.item-copy { min-width: 0; display: grid; gap: 1px; }
.item-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; line-height: 1.15; font-weight: 700; }
.item-note { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); font-size: 9px; line-height: 1.18; }
.item-note:empty { display: none; }
.item-kind { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .05em; }

.dialog { border: 0; padding: 0; color: var(--text); background: transparent; }
.viewer-dialog { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; padding: 14px; color: var(--text); background: rgba(0,0,0,.58); }
.viewer-dialog[hidden] { display: none; }
.dialog::backdrop { background: rgba(0,0,0,.58); }
.dialog-card { width: min(420px, calc(100vw - 28px)); display: flex; flex-direction: column; gap: 14px; padding: 16px; border-radius: var(--radius); border: 1px solid var(--line-soft); background: var(--panel); box-shadow: 0 20px 48px rgba(0,0,0,.42); }
.custom-dialog-card { width: min(380px, calc(100vw - 28px)); }
.dialog-message { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.dialog-message:empty { display: none; }
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
label { display: flex; flex-direction: column; gap: 6px; }
label[hidden] { display: none; }
label span { color: #b5bcc8; font-size: 11px; letter-spacing: .03em; }
.input-field, .title-input, .viewer-note { width: 100%; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); }
.input-field { min-height: 42px; padding: 0 12px; }
.split-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.translate-dialog-card { max-width: min(420px, calc(100vw - 28px)); }
.language-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.language-btn { min-height: 38px; padding: 0 12px; border: 1px solid rgba(255,255,255,.08); border-radius: 10px; background: var(--panel-2); color: var(--text); font-weight: 900; cursor: pointer; text-align: left; }
.language-btn:hover { border-color: color-mix(in srgb, var(--accent) 64%, rgba(255,255,255,.08)); color: var(--accent-light); }

.viewer-dialog .viewer-shell { width: min(var(--viewer-width, 1040px), calc(100vw - 28px)); max-width: none; }
.viewer-shell { display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 28px); padding: 12px; border-radius: var(--radius); border: 1px solid var(--line-soft); background: var(--panel); box-shadow: 0 22px 54px rgba(0,0,0,.48); overflow: hidden; }
.viewer-topbar { display: grid; grid-template-columns: minmax(0, 1fr) 34px; gap: 8px; align-items: center; }
.viewer-actions { min-height: 0; display: flex; flex-wrap: wrap; align-items: center; align-content: start; gap: 6px; }
.viewer-actions:empty { display: none; }
.title-input { min-height: 34px; padding: 0 11px; font-weight: 800; }
.viewer-media { flex: 0 1 auto; min-height: 0; max-height: min(40vh, 430px); display: grid; place-items: center; overflow: hidden; border-radius: 12px; background: #101113; }
.viewer-media img { max-width: 100%; max-height: 100%; width: auto; height: auto; border: 0; object-fit: contain; display: block; background: #101113; }
.viewer-media video { max-width: 100%; max-height: 100%; width: auto; height: auto; border: 0; object-fit: contain; display: block; background: #101113; }
.viewer-media iframe { width: 100%; height: 100%; min-height: 220px; border: 0; display: block; background: #000; }
.viewer-media .external-preview { border-radius: 12px; }
.viewer-media .note-full { width: 100%; height: 100%; padding: 18px; background: #25282e; color: #d9dee8; overflow: auto; }
.viewer-dialog.is-time .viewer-media { max-height: none; align-items: start; background: #151619; }
.viewer-dialog.is-time .time-card.is-full { height: auto; align-content: start; }
.viewer-dialog.is-time .viewer-shell { grid-template-rows: auto auto auto auto auto minmax(82px, 1fr); }
.note-toolbar { display: flex; gap: 6px; }
.note-toolbar[hidden] { display: none; }
.note-tool-btn { width: 30px; height: 28px; display: grid; place-items: center; padding: 0; border: 1px solid rgba(255,255,255,.08); border-radius: 9px; background: var(--panel-2); color: var(--text); font-weight: 900; cursor: pointer; }
.note-tool-btn svg { width: 14px; height: 14px; display: block; }
.note-tool-btn.cursive { font-style: italic; }
.viewer-laps { display: grid; gap: 7px; max-height: min(172px, 24vh); overflow: auto; }
.viewer-laps[hidden] { display: none; }
.lap-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto 24px; gap: 8px; align-items: start; padding: 7px; border: 1px solid rgba(255,255,255,.08); border-radius: 10px; background: rgba(255,255,255,.035); }
.lap-delete, .lap-to-notes { width: 24px; height: 24px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 8px; background: rgba(0,0,0,.28); color: var(--text); font-weight: 900; cursor: pointer; }
.lap-delete:hover { background: rgba(255,95,95,.22); color: #ff8b8b; }
.lap-to-notes:hover { background: rgba(255,255,255,.09); color: var(--accent-light); }
.lap-text { min-height: 24px; max-height: calc(1.35em * 5 + 6px); padding: 2px 0; color: var(--text); line-height: 1.35; outline: 0; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.lap-time { padding-top: 3px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.viewer-note { flex: 0 1 auto; min-height: 82px; max-height: min(24vh, 220px); padding: 11px 12px; overflow: auto; line-height: 1.45; outline: 0; }
.viewer-note:empty::before { content: attr(data-placeholder); color: rgba(242,242,243,.42); }
.viewer-note b, .viewer-note strong { font-weight: 900; }
.viewer-note i, .viewer-note em { font-style: italic; }
.viewer-note blockquote, .viewer-note .note-quote { margin: 6px 0 6px 28px; padding-left: 0; color: #d9dee8; }
.viewer-note .note-translation { position: relative; margin: 8px 0 8px 28px; padding: 9px 10px; border-left: 2px solid var(--accent); border-radius: 10px; background: rgba(255,255,255,.035); color: #d9dee8; }
.translation-delete { position: absolute; left: -28px; top: 7px; width: 22px; height: 22px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 999px; background: rgba(0,0,0,.34); color: var(--text); font-weight: 900; cursor: pointer; }
.translation-delete:hover { background: rgba(255,95,95,.22); color: #ff8b8b; }
.translation-text { white-space: pre-wrap; word-break: break-word; }
.viewer-note .note-translation .note-check::before { content: "-"; width: auto; height: auto; margin-top: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: var(--muted); font-weight: 900; cursor: default; }
.viewer-note .note-translation .note-check.is-checked::before { background: transparent; border: 0; box-shadow: none; }
.viewer-note mark, .note-preview-text mark, .viewer-note .note-marker, .note-preview-text .note-marker { padding: 0 .12em; border-radius: 4px; background: color-mix(in srgb, var(--accent-light) 42%, transparent); color: var(--text); font-weight: inherit; }
.timestamp-marker { color: var(--accent-light); font-weight: 900; cursor: pointer; text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent-light) 38%, transparent); }
.timestamp-marker:hover { color: var(--text); border-bottom-color: var(--accent); }
.viewer-note .note-check { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 8px; align-items: center; margin: 4px 0; min-height: 20px; }
.viewer-note .note-check::before { content: ""; width: 12px; height: 12px; margin-top: 0; border: 1px solid var(--muted); border-radius: 4px; cursor: pointer; }
.viewer-note .note-check.is-checked::before { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--panel-2); }
.viewer-note .note-check > span { min-width: 0; outline: 0; }
.composition-chip { display: inline-grid; max-width: 180px; min-height: 21px; align-items: center; margin: 0 2px; padding: 1px 8px; border: 1px solid var(--accent-light) !important; border-radius: 8px; background-color: var(--accent) !important; background-image: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%) !important; color: #fff !important; font-size: .82em; font-weight: 900; line-height: 1.35; vertical-align: baseline; cursor: pointer; user-select: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 0 0 1px rgba(0,0,0,.18); }
.composition-chip:hover { border-color: var(--accent-light) !important; background-image: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 100%) !important; color: #fff !important; }
.viewer-dialog.is-note .viewer-shell { overflow: hidden; --viewer-width: 720px; }
.viewer-dialog.is-note .viewer-media { display: none; }
.viewer-dialog.is-note .viewer-note { flex: 1 1 auto; min-height: 0; max-height: none; height: auto; padding: 16px; }
.selection-action { position: fixed; z-index: 960; min-height: 30px; padding: 0 10px; border: 1px solid rgba(255,255,255,.1); border-radius: 10px; background: var(--accent); color: #120904; font-size: 11px; font-weight: 900; cursor: pointer; box-shadow: 0 10px 26px rgba(0,0,0,.3); }
.selection-action[hidden] { display: none; }

.toast { position: fixed; left: 50%; bottom: 18px; transform: translate(-50%, 12px); z-index: 1000; padding: 9px 13px; border-radius: 999px; background: #272a30; border: 1px solid var(--line); color: var(--text); opacity: 0; pointer-events: none; transition: .18s ease; box-shadow: 0 12px 28px rgba(0,0,0,.36); }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.corner-toast { position: fixed; right: 14px; bottom: 14px; z-index: 1000; max-width: min(260px, calc(100vw - 28px)); padding: 10px 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,.10); background: rgba(36,38,42,.96); color: var(--text); font-weight: 800; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .22s ease; box-shadow: 0 14px 34px rgba(0,0,0,.36); }
.corner-toast.is-visible { opacity: 1; transform: translateY(0); }
.plugin-status { --status-progress: 0%; position: fixed; right: 12px; bottom: 12px; z-index: 980; width: min(300px, calc(100vw - 24px)); min-height: 32px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; align-items: center; padding: 7px 10px; border-radius: 999px; border: 1px solid rgba(255,255,255,.09); background: rgba(30,31,34,.92); color: var(--muted); font-size: 10px; font-weight: 900; overflow: hidden; box-shadow: 0 12px 28px rgba(0,0,0,.34); backdrop-filter: blur(10px); }
.plugin-status[hidden] { display: none; }
.plugin-status span { position: absolute; left: 0; bottom: 0; width: var(--status-progress); height: 2px; border-radius: 999px; background: var(--accent); opacity: .95; transition: width .18s ease; }
.status-cancel-btn { position: relative; z-index: 1; width: 18px; height: 18px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 999px; background: rgba(0,0,0,.3); color: var(--text); font-size: 11px; font-weight: 900; line-height: 1; cursor: pointer; }
.status-cancel-btn[hidden] { display: none; }
.status-cancel-btn:hover { background: rgba(255,95,95,.22); color: #ff8b8b; }
.plugin-status strong { position: relative; z-index: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: inherit; color: var(--text); }
.plugin-status.is-indeterminate span { animation: statusProgress 1.35s ease-in-out infinite; }
.plugin-status.is-error span { width: 100%; background: var(--danger); animation: none; }
@keyframes statusProgress {
  0% { width: 0; opacity: .55; }
  70% { width: 100%; opacity: .95; }
  100% { width: 100%; opacity: 0; }
}
.selection-rect { position: absolute; z-index: 115; border: 1px solid var(--accent); background: var(--accent-soft); pointer-events: none; }
.undo-delete-btn { position: absolute; left: 12px; bottom: 12px; z-index: 150; min-height: 32px; padding: 0 13px; border: 1px solid rgba(255,255,255,.1); border-radius: 10px; background: var(--panel-2); color: var(--text); font-weight: 900; cursor: pointer; opacity: 0; transform: translateY(8px); transition: .22s ease; }
.undo-delete-btn.is-visible { opacity: 1; transform: translateY(0); }
.undo-delete-btn[hidden] { display: none; }
@media (max-width: 520px) {
  body { padding: 10px; }
  .app-shell { height: calc(100vh - 20px); }
  .canvas-toolbar { grid-template-columns: 1fr auto; }
  .add-actions { justify-content: space-between; }
  .search-input { grid-column: 1 / 2; }
  .tool-btn { flex: 1 1 0; width: auto; }
  .tool-btn[aria-label="Add link"] { width: auto; }
  .viewer-actions { max-height: 38px; overflow: hidden; }
  .open-link-btn, .try-player-btn, .download-link-btn, .import-link-btn { width: 34px; height: 30px; min-height: 30px; flex: 0 0 34px; }
  .text-action-btn { width: auto; flex: 0 0 auto; }
  .quality-wrap, .quality-select { flex: 0 0 auto; }
  .coming-soon-btn { height: 30px; min-height: 30px; flex: 0 0 auto; }
  .board-strip { grid-template-columns: 38px minmax(0, 1fr); }
  .board-add { width: 38px; min-height: 38px; }
}
