:root {
  --bg: #0f172a;
  --panel: #111827;
  --panel-2: #0b1220;
  --line: #334155;
  --muted: #94a3b8;
  --text: #e5e7eb;
  --accent: #2563eb;
}

[data-theme="dark"] {
  --panel-2: #1e293b;
}

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  print-color-adjust: exact;
  /* color: #000 !important; */
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
}

.app-shell {
  --sidebar-width: 420px;
  --splitter-width: 6px;
  --right-splitter-width: 6px;
  --right-width: 320px;
  display: grid;
  grid-template-columns: var(--sidebar-width) var(--splitter-width) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  height: var(--vvh, 100dvh);
  overflow: hidden;
  position: relative;
}

.app-shell:has(.sidebar:not(.collapsed)) {
  transition: grid-template-columns 0.2s ease;
}

/* optional columns when mail/chat panel is present */
.app-shell:has(.right-panel) {
  grid-template-columns: var(--sidebar-width) var(--splitter-width) minmax(0, 1fr) var(--right-splitter-width) var(--right-width);
}

.app-shell.sidebar-collapsed {
  --sidebar-width: 0px;
  --splitter-width: 0px;
}

.app-shell:has(.right-panel.collapsed) {
  --right-width: 0px;
  --right-splitter-width: 0px;
}

.topbar {
  grid-column: 1 / -1;
  grid-row: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  z-index: 30;
}

.title-wrap { min-width: 0; }

.page-title-preview {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-topbar-menu-btn,
.mobile-topbar-menu-backdrop,
.mobile-topbar-menu-title {
  display: none;
}

.topbar-actions-menu {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-actions form {
  margin: 0;
  display: flex;
  align-items: center;
}

.topbar .btn.btn-sm,
.workspace-row .btn,
.tree-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  min-height: 40px;
  box-sizing: border-box;
}

.workspace-row .form-select-sm {
  height: 40px;
  min-height: 40px;
}

.slug-box {
  color: var(--muted);
  font-size: 13px;
}

.hidden-edit { display: none; }
.editing .hidden-edit { display: block; }
.editing .page-title-preview { display: none; }

.sidebar {
  --tree-font-size: 15px;
  --tree-line-height: 28px;
  --tree-node-min-height: 28px;
  grid-row: 2;
  background: var(--panel);
  padding: 14px;
  border-right: none;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  min-width: 0;
}

#left-splitter {
  grid-column: 2;
  grid-row: 2;
}

#right-splitter {
  grid-column: 4;
  grid-row: 2;
}

.panel-splitter {
  min-width: 0;
  background: var(--bg);
  cursor: col-resize;
  position: relative;
  z-index: 15;
  user-select: none;
  touch-action: none;
}

.panel-splitter::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  transform: translateX(-50%);
  background: var(--line);
  transition: background 0.15s ease;
}

.panel-splitter:hover::after,
body.splitter-dragging .panel-splitter::after {
  background: var(--accent);
}

.app-shell.sidebar-collapsed #left-splitter {
  display: none;
  pointer-events: none;
}

.app-shell:has(.right-panel.collapsed) #right-splitter {
  display: none;
  pointer-events: none;
}

body.splitter-dragging {
  cursor: col-resize !important;
  user-select: none;
}

body.splitter-dragging .app-shell {
  transition: none;
}

/* collapsed states — grid column shrinks via .app-shell.sidebar-collapsed */
.sidebar.collapsed {
  display: none;
}

.right-panel.collapsed {
  display: none;
}

.workspace-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px;
  align-items: center;
}

.tree-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 8px 0;
}

#tree {
  margin-top: 10px;
  font-size: var(--tree-font-size, 15px);
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 30%;
}

.main-pane {
  grid-column: 3;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.editor-wrap {
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 10px;
  overflow: hidden;
}

/* Full preview mode: hide EasyMDE toolbar + editor completely */
body:not(.editing) #markdown-wrap,
.editor-wrap--preview-only #markdown-wrap {
  display: none !important;
}

body:not(.editing) #editor-splitter,
.editor-wrap--preview-only #editor-splitter {
  display: none !important;
}

.editor-wrap--preview-only {
  display: block;
  height: 100%;
  min-height: 0;
  padding: 0;
}

.editor-wrap--preview-only #preview-wrap {
  height: 100%;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 0;
}

body:not(.editing) .main-pane,
.app-shell:has(.editor-wrap--preview-only) .main-pane {
  grid-column: 3 / -1;
}

/* Preview uses full width only when chat/mail panel is collapsed */
.app-shell:has(.right-panel:not(.collapsed)) .main-pane {
  grid-column: 3;
}

.editor-wrap--preview-only #preview-wrap .preview-layout {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  width: 100%;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
}

.editor-wrap--preview-only #preview-wrap .preview-content {
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  width: 100%;
  max-width: 100%;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.editor-wrap--split {
  display: grid;
  min-height: 0;
  height: 100%;
  grid-template-columns: minmax(280px, var(--editor-markdown-width, 50%)) var(--editor-splitter-width, 6px) minmax(280px, 1fr);
  gap: 0;
}

.editor-wrap--split #markdown-wrap {
  grid-column: 1;
  min-width: 0;
}

.editor-wrap--split #editor-splitter {
  grid-column: 2;
  display: block;
}

.editor-wrap--split #preview-wrap {
  grid-column: 3;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.editing .editor-wrap:not(.editor-wrap--split) {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.editing .editor-wrap:not(.editor-wrap--split) #markdown-wrap {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
}

#editor-splitter {
  display: none;
  min-height: 0;
  height: auto;
  align-self: stretch;
}

.panel-splitter--editor::after {
  top: 12px;
  bottom: 12px;
}

.editor-panel {
  background: #fff;
  border-radius: 16px;
  min-height: 0;
  height: 100%;
  position: relative;
}

.editor-wrap--split .editor-panel {
  overflow: hidden;
}



/* Linien unter H1 und H2 in der EasyMDE-Vorschau */
.preview-layout h1,
.editor-preview h1 {
    border-bottom: 5px solid #333;
    padding-bottom: 5px;
    margin-bottom: 15px;
}
.preview-layout h2,
.editor-preview h2 {
    border-bottom: 4px solid #ccc;
    padding-bottom: 3px;
}
.preview-layout h3,
.editor-preview h3 {
    border-bottom: 2px solid #ccc;
    padding-bottom: 3px;
}



.hidden { display: none; }

#markdown-wrap {
  display: flex;
  flex-direction: column;
}

.editor-find-bar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 10px;
  align-items: center;
  padding: 8px 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.editor-find-bar-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.editor-find-bar-row:first-child {
  grid-column: 1;
}

.editor-find-bar-row:nth-child(2) {
  grid-column: 1;
}

.editor-find-case {
  grid-column: 1;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  user-select: none;
}

.editor-find-close {
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: start;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
}

.editor-find-close:hover {
  color: var(--text);
}

.editor-find-label {
  flex: 0 0 auto;
  width: 3.5rem;
  color: var(--muted);
  font-size: 12px;
}

.editor-find-input {
  flex: 1 1 auto;
  min-width: 0;
  background: #1e293b;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
}

.editor-find-input:focus {
  outline: none;
  border-color: var(--accent);
}

.editor-find-btn {
  flex: 0 0 auto;
  background: #334155;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.2;
}

.editor-find-btn:hover {
  border-color: var(--accent);
}

.editor-find-btn--action {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.editor-find-status {
  flex: 0 0 auto;
  min-width: 4.5rem;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

body.editing .preview-source-block,
body.editing .md-panel-title.preview-source-block {
  cursor: text;
}

body.editing #preview-content:focus {
  outline: none;
}

.editor-toolbar button.easymde-dropdown {
  overflow: visible;
  position: relative;
}

.editor-toolbar button.add-toolbar-button {
  width: 34px;
  min-width: 34px;
  padding: 0;
  font-family: Inter, system-ui, sans-serif;
  font-weight: 700;
}

.editor-toolbar button.add-toolbar-button::before {
  content: '♫';
  font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", sans-serif;
  font-size: 19px;
  line-height: 1;
}

.editor-toolbar button.easymde-dropdown:focus,
.editor-toolbar button.easymde-dropdown:focus-within,
.editor-toolbar button.easymde-dropdown:active {
  z-index: 40;
  overflow: visible;
}

.editor-toolbar .easymde-dropdown-content {
  max-height: min(70vh, 420px);
  overflow-x: hidden;
  overflow-y: auto;
  box-sizing: border-box;
  width: max-content;
  min-width: 18rem;
  max-width: min(24rem, calc(100vw - 16px));
  left: auto;
  right: 0;
  z-index: 40;
}

.editor-toolbar .easymde-dropdown-content button {
  display: block;
  box-sizing: border-box;
  width: auto !important;
  min-width: 100%;
  max-width: none;
  height: auto !important;
  min-height: 32px !important;
  padding: 6px 16px;
  text-align: left;
  white-space: nowrap;
  overflow: visible;
  text-overflow: unset;
  font-weight: 600;
}

.editor-toolbar .easymde-dropdown-content button.color-swatch {
  text-align: left;
  padding-left: 10px;
  border-left: 4px solid transparent;
}

.editor-toolbar .easymde-dropdown-content button.color-swatch--red { border-left-color: var(--bs-danger); }
.editor-toolbar .easymde-dropdown-content button.color-swatch--blue { border-left-color: var(--bs-primary); }
.editor-toolbar .easymde-dropdown-content button.color-swatch--lightblue { border-left-color: #6ea8fe; }
.editor-toolbar .easymde-dropdown-content button.color-swatch--yellow { border-left-color: var(--bs-warning); }
.editor-toolbar .easymde-dropdown-content button.color-swatch--lightgreen { border-left-color: #75b798; }
.editor-toolbar .easymde-dropdown-content button.color-swatch--green { border-left-color: var(--bs-success); }
.editor-toolbar .easymde-dropdown-content button.color-swatch--cyan { border-left-color: var(--bs-info); }
.editor-toolbar .easymde-dropdown-content button.color-swatch--palette {
  border-left-width: 0;
  padding-left: 10px;
  background: linear-gradient(
    90deg,
    var(--bs-danger),
    var(--bs-primary),
    var(--bs-warning),
    var(--bs-success),
    var(--bs-info)
  );
  background-size: 5px 100%;
  background-repeat: no-repeat;
  background-position: left center;
}

.editor-toolbar .easymde-dropdown-content button.hr-thickness-swatch {
  text-align: left;
  padding-left: 18px;
  position: relative;
  min-width: 96px;
  height: 28px;
}

.editor-toolbar .easymde-dropdown-content button.hr-thickness-swatch::before {
  content: '';
  display: block;
  position: absolute;
  left: 6px;
  top: 50%;
  width: 8px;
  transform: translateY(-50%);
  background: #334155;
  border-radius: 1px;
}

.editor-toolbar .easymde-dropdown-content button.hr-thickness-swatch--thin::before { height: 1px; }
.editor-toolbar .easymde-dropdown-content button.hr-thickness-swatch--normal::before { height: 2px; }
.editor-toolbar .easymde-dropdown-content button.hr-thickness-swatch--medium::before { height: 4px; }
.editor-toolbar .easymde-dropdown-content button.hr-thickness-swatch--thick::before { height: 6px; }
.editor-toolbar .easymde-dropdown-content button.hr-thickness-swatch--heavy::before { height: 10px; }

.editor-toolbar button.signs-toolbar-icon::before {
  font-size: 14px;
}

.editor-toolbar .easymde-dropdown-content button.sign-menu-item {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.editor-emoji-picker {
  position: fixed;
  z-index: 1060;
  width: min(520px, calc(100vw - 16px));
  padding: 10px 12px;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  box-shadow: var(--bs-box-shadow);
}

.editor-emoji-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.editor-emoji-picker-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.editor-emoji-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--bs-border-color);
}

.editor-emoji-check {
  min-width: 2rem;
  height: 2rem;
  padding: 0 6px;
  border: 1px solid var(--bs-border-color);
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  user-select: none;
}

.editor-emoji-check:hover,
.editor-emoji-cell:hover {
  background: color-mix(in srgb, var(--bs-primary) 16%, transparent);
}

.editor-emoji-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 2px;
  max-height: min(60vh, 420px);
  overflow-x: hidden;
  overflow-y: auto;
}

.editor-emoji-cell {
  aspect-ratio: 1;
  min-height: 2.1rem;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  user-select: none;
}

.preview-content .task-list-item,
.EasyMDEContainer .editor-preview .task-list-item {
  list-style: none;
}

.preview-content .task-list-item input[type="checkbox"],
.EasyMDEContainer .editor-preview .task-list-item input[type="checkbox"] {
  margin: 0 0.4em 0 -1.4em;
  vertical-align: middle;
}

.editor-toolbar button.photos-toolbar-icon {
  position: relative;
}

.editor-toolbar button.photos-toolbar-icon::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 6px;
  width: 12px;
  height: 9px;
  box-sizing: border-box;
  border: 1.5px solid currentColor;
  border-radius: 1px;
  background: #fff;
  box-shadow: 3px 3px 0 0 currentColor;
  pointer-events: none;
}

.editor-toolbar .easymde-dropdown-content button.photos-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 12.5rem;
}

.editor-toolbar .easymde-dropdown-content button.photos-menu-item::before {
  content: '';
  box-sizing: border-box;
  flex: 0 0 16px;
  width: 16px;
  height: 14px;
  position: relative;
  color: inherit;
}

.editor-toolbar .easymde-dropdown-content button.photos-menu-item--gallery::before {
  border: 1.5px solid currentColor;
  border-radius: 2px;
  background:
    linear-gradient(135deg, transparent 45%, currentColor 45% 55%, transparent 55%) 3px 6px / 10px 7px no-repeat;
}

.editor-toolbar .easymde-dropdown-content button.photos-menu-item--carousel::before {
  width: 14px;
  height: 11px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  box-shadow:
    3px 2px 0 -1.5px #fff,
    3px 2px 0 0 currentColor,
    6px 4px 0 -1.5px #fff,
    6px 4px 0 0 currentColor;
  margin-right: 4px;
}

.editor-toolbar .easymde-dropdown-content button.photos-menu-item--book::before {
  height: 13px;
  border: 1.5px solid currentColor;
  border-radius: 1px 3px 3px 1px;
  box-shadow: inset 7px 0 0 -5.5px currentColor;
}

.editor-toolbar .easymde-dropdown-content button.photos-menu-item--cube::before {
  width: 12px;
  height: 12px;
  margin-left: 2px;
  border: 1.5px solid currentColor;
  border-radius: 1px;
  transform: rotate(45deg) skew(-12deg, -12deg);
}

.editor-toolbar .easymde-dropdown-content button.photos-menu-item--labyrinth::before {
  border: 1.5px solid currentColor;
  border-radius: 1px;
  background:
    linear-gradient(currentColor, currentColor) 4px 1px / 1.5px 8px no-repeat,
    linear-gradient(currentColor, currentColor) 9px 4px / 1.5px 8px no-repeat,
    linear-gradient(currentColor, currentColor) 1px 5px / 8px 1.5px no-repeat,
    linear-gradient(currentColor, currentColor) 6px 9px / 8px 1.5px no-repeat;
}

.editor-toolbar button.form-toolbar-icon {
  position: relative;
}

.editor-toolbar button.form-toolbar-icon::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 5px;
  width: 12px;
  height: 14px;
  box-sizing: border-box;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  background:
    radial-gradient(circle, currentColor 1.2px, transparent 1.4px) 2px 2px / 6px 6px no-repeat,
    linear-gradient(currentColor, currentColor) 8px 3px / 2px 1.5px no-repeat,
    linear-gradient(currentColor, currentColor) 3px 9px / 6px 1.5px no-repeat;
  pointer-events: none;
}

.editor-toolbar .easymde-dropdown-content button.form-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 12.5rem;
}

.editor-toolbar .easymde-dropdown-content button.form-menu-item::before {
  content: '';
  box-sizing: border-box;
  flex: 0 0 16px;
  width: 16px;
  height: 14px;
  position: relative;
  color: inherit;
}

.editor-toolbar .easymde-dropdown-content button.form-menu-item--radio::before {
  width: 14px;
  height: 14px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  background: radial-gradient(circle, currentColor 3px, transparent 3.2px);
}

.editor-toolbar .easymde-dropdown-content button.form-menu-item--vote::before {
  width: 16px;
  height: 12px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  background:
    radial-gradient(circle, currentColor 1.4px, transparent 1.6px) 2px 1px / 5px 5px no-repeat,
    radial-gradient(circle, currentColor 1.4px, transparent 1.6px) 8px 1px / 5px 5px no-repeat,
    linear-gradient(currentColor, currentColor) 3px 8px / 3px 1.5px no-repeat,
    linear-gradient(currentColor, currentColor) 9px 8px / 3px 1.5px no-repeat;
}

.editor-toolbar .easymde-dropdown-content button.form-menu-item--text::before {
  border: 1.5px solid currentColor;
  border-radius: 2px;
  background: linear-gradient(currentColor, currentColor) 3px 6px / 8px 1.5px no-repeat;
}

.editor-toolbar .easymde-dropdown-content button.form-menu-item--textarea::before {
  height: 16px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  background:
    linear-gradient(currentColor, currentColor) 3px 3px / 10px 1.5px no-repeat,
    linear-gradient(currentColor, currentColor) 3px 7px / 10px 1.5px no-repeat,
    linear-gradient(currentColor, currentColor) 3px 11px / 6px 1.5px no-repeat;
}

.editor-toolbar .easymde-dropdown-content button.form-menu-item--number::before {
  border: 1.5px solid currentColor;
  border-radius: 2px;
  background:
    linear-gradient(currentColor, currentColor) 4px 3px / 1.5px 8px no-repeat,
    linear-gradient(currentColor, currentColor) 8px 3px / 1.5px 8px no-repeat,
    linear-gradient(currentColor, currentColor) 3px 6px / 8px 1.5px no-repeat;
}

.editor-toolbar .easymde-dropdown-content button.form-menu-item--enum::before {
  border: 1.5px solid currentColor;
  border-radius: 2px;
  background:
    linear-gradient(currentColor, currentColor) 3px 5px / 6px 1.5px no-repeat,
    linear-gradient(transparent 40%, currentColor 40% 60%, transparent 60%) 10px 4px / 4px 6px no-repeat;
}

.preview-layout hr,
.editor-preview hr,
.md-hr {
  border: 0;
  border-top: 2px solid #64748b;
  margin: 1.25em 0;
  opacity: 1;
  background: transparent;
}

.preview-layout hr.md-hr--thin,
.editor-preview hr.md-hr--thin,
.md-hr--thin {
  border-top-width: 1px;
}

.preview-layout hr.md-hr--normal,
.editor-preview hr.md-hr--normal,
.md-hr--normal {
  border-top-width: 2px;
}

.preview-layout hr.md-hr--medium,
.editor-preview hr.md-hr--medium,
.md-hr--medium {
  border-top-width: 4px;
}

.preview-layout hr.md-hr--thick,
.editor-preview hr.md-hr--thick,
.md-hr--thick {
  border-top-width: 6px;
}

.preview-layout hr.md-hr--heavy,
.editor-preview hr.md-hr--heavy,
.md-hr--heavy {
  border-top-width: 10px;
}

.md-styled-block {
  display: block;
  margin: 0.75em 0;
  padding: 0.55em 0.75em;
  border-radius: 6px;
}

.md-styled-block > :first-child {
  margin-top: 0;
}

.md-styled-block > :last-child {
  margin-bottom: 0;
}

.editor-color-picker {
  position: fixed;
  z-index: 1040;
  width: min(280px, calc(100vw - 16px));
  padding: 10px 12px;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  box-shadow: var(--bs-box-shadow);
}

.editor-color-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.editor-color-picker-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.editor-color-picker-hint {
  margin: 0 0 8px;
  font-size: 0.75rem;
  color: var(--bs-secondary-color);
}

.editor-color-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.editor-color-picker-swatch {
  width: 100%;
  aspect-ratio: 1;
  min-height: 28px;
  padding: 0;
  border: 2px solid var(--bs-border-color);
  border-radius: 4px;
  cursor: pointer;
}

.editor-color-picker-swatch:hover {
  transform: scale(1.06);
}

.editor-color-picker-swatch.is-selected {
  outline: 2px solid var(--bs-primary);
  outline-offset: 1px;
}

.editor-color-picker-custom {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--bs-border-color);
}

.editor-color-picker-custom-label {
  margin: 0;
  font-size: 0.8rem;
  color: var(--bs-secondary-color);
}

.editor-color-picker-input {
  width: 40px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--bs-border-color);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}

#editor-color-picker-apply {
  margin-left: auto;
}

#markdown-wrap .EasyMDEContainer {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#markdown-wrap .EasyMDEContainer:has(.editor-toolbar .easymde-dropdown:focus-within) {
  overflow: visible;
}

#markdown-wrap .editor-toolbar {
  flex: 0 0 auto;
  overflow: visible;
  z-index: 40;
}

#markdown-wrap .editor-statusbar {
  flex: 0 0 auto;
}

#markdown-wrap .editor-toolbar,
#markdown-wrap .CodeMirror {
  display: block;
  visibility: visible;
}



.EasyMDEContainer { height: 100%; }

.editor-toolbar,
.CodeMirror,
.editor-preview,
.editor-preview-side {
  background: #fff !important;
  color: #111827 !important;
}

/* Fenced ``` blocks in the editor: distinct color, and a different selection tint */
#markdown-wrap .CodeMirror .cm-comment {
  color: #0f766e;
  background: rgba(13, 148, 136, 0.12);
}

#markdown-wrap .CodeMirror-selected {
  background: #bfdbfe;
}

#markdown-wrap .CodeMirror-selectedtext {
  background: #93c5fd;
  color: #1e3a8a;
}

#markdown-wrap .CodeMirror .cm-comment.CodeMirror-selectedtext {
  background: #5eead4;
  color: #115e59;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: flex-start;
  gap: 2px 1px;
  padding: 4px 6px;
  flex-shrink: 0;
}

.editor-toolbar-split-control,
.editor-toolbar-lineheight-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 6px;
  border-left: 1px solid #ddd;
  border-right: 1px solid #ddd;
  margin: 0 2px;
}

.editor-toolbar-split-icon {
  font-size: 14px;
  line-height: 1;
  color: #64748b;
  user-select: none;
}

.editor-toolbar-lineheight-icon {
  font-size: 13px;
  color: #64748b;
}

.editor-toolbar-split-range,
.editor-toolbar-lineheight-range {
  width: 76px;
  height: 4px;
  margin: 0;
  padding: 0;
  accent-color: #2563eb;
  cursor: pointer;
}

.editor-wrap:not(.editor-wrap--split) .editor-toolbar-split-control {
  opacity: 0.45;
}

.editor-wrap {
  --editor-line-height: 1.5;
  --editor-font-size: 14px;
  --editor-tab-size: 4;
}

#markdown-wrap .CodeMirror pre,
#markdown-wrap .CodeMirror-line,
.editor-wrap--split #markdown-wrap .CodeMirror pre,
.editor-wrap--split #markdown-wrap .CodeMirror-line {
  tab-size: var(--editor-tab-size);
  -moz-tab-size: var(--editor-tab-size);
}

.editor-wrap--split #markdown-wrap .CodeMirror pre,
.editor-wrap--split #markdown-wrap .CodeMirror-line {
  font-size: var(--editor-font-size);
  line-height: var(--editor-line-height);
}

.editor-wrap--split .preview-content {
  font-size: var(--editor-font-size);
  line-height: var(--editor-line-height);
  tab-size: var(--editor-tab-size);
  -moz-tab-size: var(--editor-tab-size);
}

.preview-content,
.preview-content pre,
.preview-content code {
  tab-size: var(--editor-tab-size);
  -moz-tab-size: var(--editor-tab-size);
}

.preview-content pre,
.preview-content code,
.editor-preview pre,
.editor-preview code,
.editor-preview-side pre,
.editor-preview-side code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
  font-family: "Courier New", Courier, monospace;
}

.preview-content code.md-inline-code,
.editor-preview code.md-inline-code,
.editor-preview-side code.md-inline-code,
.keep-md code.md-inline-code {
  font-family: "Courier New", Courier, monospace;
  font-size: 0.92em;
  background: #f1f3f4;
  color: #202124;
  border: 1px solid #dadce0;
  border-radius: 4px;
  padding: 0.08em 0.35em;
}

.md-code-block {
  position: relative;
  margin: 12px 0;
  border: 1px solid #c5c8ce;
  border-radius: 8px;
  background: #f5f6f8;
  overflow: hidden;
  max-width: 100%;
}

.md-code-block__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  background: #e8eaed;
  border-bottom: 1px solid #c5c8ce;
}

.md-code-block__lang {
  font-size: 12px;
  font-weight: 600;
  color: #5f6368;
  text-transform: lowercase;
  font-family: system-ui, sans-serif;
}

.md-code-block__actions {
  display: inline-flex;
  gap: 6px;
}

.md-code-edit {
  display: none;
}

.md-code-block.is-editable .md-code-edit {
  display: inline-block;
}

.md-code-copy,
.md-code-edit {
  width: auto !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 0;
  padding: 2px 10px;
  border: 1px solid #b0b4ba;
  border-radius: 4px;
  background: #fff;
  color: #3c4043;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
}

.md-code-copy:hover,
.md-code-edit:hover {
  background: #f8f9fa;
  border-color: #80868b;
}

.md-code-copy.is-copied {
  background: #e6f4ea;
  border-color: #34a853;
  color: #137333;
}

.md-code-block__pre,
.preview-content .md-code-block__pre,
.editor-preview .md-code-block__pre,
.editor-preview-side .md-code-block__pre,
.keep-md .md-code-block__pre {
  margin: 0;
  padding: 12px 14px;
  background: transparent;
  border: none;
  border-radius: 0;
  overflow-x: auto;
  white-space: pre;
  overflow-wrap: normal;
  word-break: normal;
}

.md-code-block__code,
.preview-content .md-code-block__code,
.editor-preview .md-code-block__code,
.editor-preview-side .md-code-block__code,
.keep-md .md-code-block__code {
  display: block;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.92em;
  line-height: 1.45;
  color: #202124;
  background: transparent;
  border: none;
  padding: 0;
  white-space: inherit;
}

.keep-card--dark .md-code-block {
  background: #303134;
  border-color: #5f6368;
}

.keep-card--dark .md-code-block__header {
  background: #3c4043;
  border-bottom-color: #5f6368;
}

.keep-card--dark .md-code-block__lang,
.keep-card--dark .md-code-block__code {
  color: #e8eaed;
}

.keep-card--dark .md-code-copy,
.keep-card--dark .md-code-edit {
  background: #202124;
  border-color: #5f6368;
  color: #e8eaed;
}

.editor-toolbar > button {
  width: 28px;
  height: 28px;
  min-height: 28px !important;
}

#markdown-wrap .editor-toolbar .editor-toolbar-spacer {
  flex: 0 0 22px;
  width: 22px;
  min-width: 22px;
  height: 28px !important;
  min-height: 28px !important;
  padding: 0 !important;
  margin: 0 2px !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  pointer-events: none;
}

#markdown-wrap .editor-toolbar i.separator {
  display: inline-flex;
  align-items: center;
  height: 28px;
  margin: 0 2px;
}
.preview-layout button i,
.editor-toolbar button i {
  font-size: 13px !important;
}

/* Container der EasyMDE-Vorschau */
.preview-layout table,
.editor-preview table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    margin-bottom: 4px;
    font-size: 11px;
    border: 1px solid #dfe2e5; /* Äusserer Rahmen */
}

/* Tabellenkopf */
.preview-layout th,
.editor-preview th {
    font-weight: bold;
    background-color: #cdcdcd;
    border: 1px solid #dfe2e5;
    padding: 4px 7px;
}

/* Tabellenzellen */
.preview-layout td,
.editor-preview td {
    border: 1px solid #dfe2e5;
    padding: 4px 7px;
}

/* Zebra-Effekt (Ungerade Zeilen einfärben) */
.preview-layout tr:nth-child(even),
.editor-preview tr:nth-child(even) {
    background-color: #f0f0f0f0;
}

/* Zebra-Effekt (Gerade Zeilen einfärben) */
.preview-layout tr:nth-child(odd),
.editor-preview tr:nth-child(odd) {
    background-color: #ffffff; /* Dezentes Grau */
}

/* Hover-Effekt (Optional) */
.preview-layout  tr:hover ,
.editor-preview tr:hover {
    background-color: #f1f1f1;
}

#markdown-wrap:not(.hidden) .CodeMirror {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
}

#markdown-wrap:not(.hidden) .CodeMirror-scroll {
  height: 100%;
  min-height: 0;
}

.CodeMirror,
.CodeMirror-scroll {
  height: auto;
  min-height: 0;
}

.editor-wrap--split .CodeMirror,
.editor-wrap--split .CodeMirror-scroll {
  height: auto;
  min-height: 0;
}

.editor-wrap--split .editor-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.editor-wrap--split #markdown-wrap .EasyMDEContainer {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.editor-wrap--split #markdown-wrap .CodeMirror {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
}

.editor-wrap--split #markdown-wrap .CodeMirror-scroll {
  height: 100%;
  min-height: 0;
}

.editor-wrap--split #preview-wrap .preview-layout {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
}

.editor-wrap--split .preview-layout {
  grid-template-columns: 1fr;
}

.editor-wrap--split .preview-content {
  font-size: var(--editor-font-size);
  line-height: var(--editor-line-height);
  tab-size: var(--editor-tab-size);
  -moz-tab-size: var(--editor-tab-size);
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.editor-wrap--split .floating-toc {
  display: none !important;
}

@media (min-width: 769px) {
  .editor-wrap--preview-only {
    display: block;
    position: relative;
    padding: 10px;
    height: 100%;
    min-height: 0;
  }

  .editor-wrap--preview-only #floating-toc {
    position: absolute;
    left: 10px;
    top: 10px;
    bottom: 10px;
    width: 240px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    height: calc(100% - 20px);
    max-height: calc(100% - 20px);
    overflow: hidden;
  }

  .editor-wrap--preview-only #floating-toc #floating-toc-list {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto !important;
  }

  .editor-wrap--preview-only #preview-wrap {
    width: 100%;
    height: 100%;
    min-height: 0;
  }

  .editor-wrap--preview-only.has-page-toc #preview-wrap .preview-layout {
    padding-left: 256px;
  }
}

#markdown-wrap:not(.hidden) .editor-toolbar {
  display: flex;
  visibility: visible;
}

#markdown-wrap:not(.hidden) .CodeMirror {
  display: block;
  visibility: visible;
}

#markdown-wrap .editor-preview,
#markdown-wrap .editor-preview-side {
  display: none !important;
}

.preview-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 16px;
  font-size: 14px;
  height: 100%;
  min-height: 0;
  padding: 16px;
  background: #fff;
  align-items: stretch;
  overflow: hidden;
}

.preview-content {
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  width: 100%;
  max-width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  color: #111827;
  padding-right: 8px;
  -webkit-overflow-scrolling: touch;
}

.mobile-page-fabs {
  display: none;
}

.mobile-toc-btn {
  display: none;
}

.mobile-toc-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1040;
  background: rgba(15, 23, 42, 0.45);
}

.mobile-toc-btn.visible {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  touch-action: manipulation;
}

.mobile-toc-btn.visible:active {
  transform: scale(0.98);
}

.preview-content img.md-image,
.preview-layout img.md-image,
.editor-preview-side img.md-image,
.EasyMDEContainer .editor-preview img.md-image {
  height: auto;
  max-width: 100%;
}

.preview-content img.md-image--inline,
.preview-layout img.md-image--inline,
.editor-preview-side img.md-image--inline,
.EasyMDEContainer .editor-preview img.md-image--inline,
.preview-content a.md-image-link--inline img,
.preview-layout a.md-image-link--inline img,
.editor-preview-side a.md-image-link--inline img,
.EasyMDEContainer .editor-preview a.md-image-link--inline img {
  display: inline-block;
  width: 48px;
  height: 48px;
  max-width: 48px;
  object-fit: cover;
  vertical-align: middle;
  margin: 0;
  border-radius: 4px;
}

.preview-content a.md-image-link--inline,
.preview-layout a.md-image-link--inline,
.editor-preview-side a.md-image-link--inline,
.EasyMDEContainer .editor-preview a.md-image-link--inline {
  display: inline-block;
  width: auto;
  max-width: none;
  line-height: 0;
  vertical-align: middle;
  margin: 0 8px 0 0;
}

.preview-content .md-image-wrap,
.preview-layout .md-image-wrap,
.editor-preview-side .md-image-wrap,
.EasyMDEContainer .editor-preview .md-image-wrap {
  margin: 10px 0;
}

.preview-content .md-image-wrap img.md-image,
.preview-layout .md-image-wrap img.md-image {
  display: inline-block;
}

.preview-content .md-image-wrap--full,
.preview-layout .md-image-wrap--full,
.editor-preview-side .md-image-wrap--full,
.EasyMDEContainer .editor-preview .md-image-wrap--full {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 10px 0;
}

.preview-content .md-image-wrap--full a.md-image-link,
.preview-layout .md-image-wrap--full a.md-image-link,
.editor-preview-side .md-image-wrap--full a.md-image-link,
.EasyMDEContainer .editor-preview .md-image-wrap--full a.md-image-link,
.preview-content a.md-image-link--full,
.preview-layout a.md-image-link--full,
.editor-preview-side a.md-image-link--full,
.EasyMDEContainer .editor-preview a.md-image-link--full {
  display: block;
  width: 100%;
  max-width: 100%;
  line-height: 0;
}

.preview-content .md-image-wrap--full img.md-image,
.preview-layout .md-image-wrap--full img.md-image,
.editor-preview-side .md-image-wrap--full img.md-image,
.EasyMDEContainer .editor-preview .md-image-wrap--full img.md-image,
.preview-content img.md-image--full,
.preview-layout img.md-image--full,
.editor-preview-side img.md-image--full,
.EasyMDEContainer .editor-preview img.md-image--full {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}

/* {turn=90|270}: the box has the turned aspect ratio; the image is sized from it
   with container units (100cqh x 100cqw) and rotated into place. */
.md-image-turn {
  position: relative;
  display: inline-block;
  max-width: 100%;
  aspect-ratio: 1;
  container-type: size;
  overflow: hidden;
  vertical-align: middle;
  line-height: 0;
}

.md-image-turn--90 { --md-turn: 90deg; }
.md-image-turn--270 { --md-turn: 270deg; }

.md-image-turn img.md-image--turned {
  position: absolute !important;
  top: 50%;
  left: 50%;
  display: block !important;
  width: 100cqh !important;
  height: 100cqw !important;
  max-width: none !important;
  margin: 0 !important;
  object-fit: fill;
  transform: translate(-50%, -50%) rotate(var(--md-turn, 90deg));
}

.md-image-edit-btn {
  position: fixed;
  z-index: 1040;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  background: rgba(20, 24, 32, 0.85);
  color: #fff;
  font-size: 14px;
  line-height: 30px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.md-image-edit-btn:hover {
  background: var(--bs-primary, #0d6efd);
}

.image-edit-preview-box {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

#code-block-text {
  min-height: 260px;
  font-size: 13px;
  tab-size: 4;
  white-space: pre;
  overflow-wrap: normal;
}

#image-edit-preview {
  max-width: 180px;
  max-height: 180px;
  object-fit: contain;
  transition: transform 0.2s ease;
}

.preview-content a.file-link-app,
.editor-preview-side a.file-link-app,
.EasyMDEContainer .editor-preview a.file-link-app {
  color: #1d4ed8;
  text-decoration: underline;
  text-decoration-style: dotted;
  cursor: pointer;
}

.preview-content a.file-link-app:hover,
.editor-preview-side a.file-link-app:hover,
.EasyMDEContainer .editor-preview a.file-link-app:hover {
  color: #1e40af;
}

#file-link-modal .font-monospace {
  font-size: 0.8rem;
  word-break: break-all;
}

.visually-hidden-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.dashboard-modal {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
}

.dashboard-modal .modal-header,
.dashboard-modal .modal-footer {
  border-color: var(--line);
}

.dashboard-modal .modal-title {
  color: var(--text);
}

.dashboard-modal-hint,
.dashboard-modal .text-muted,
.dashboard-modal .form-text {
  color: var(--muted) !important;
}

.dashboard-modal .form-label {
  color: var(--text);
}

@media (pointer: coarse), (max-width: 768px) {
  .dashboard-modal .form-check {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    margin-bottom: 0.35rem;
    padding-left: 0;
  }

  .dashboard-modal .form-check .form-check-input {
    float: none;
    position: static;
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    min-width: 22px;
    min-height: 22px;
    margin: 0;
    font-size: 16px;
  }

  .dashboard-modal .form-check-label {
    font-size: 1rem;
    line-height: 1.3;
    padding-top: 0;
  }
}

.dashboard-modal .form-control,
.dashboard-modal .form-select {
  background: var(--panel-2);
  border-color: var(--line);
  color: var(--text);
}

.dashboard-modal .form-control:focus,
.dashboard-modal .form-select:focus {
  background: var(--panel-2);
  border-color: var(--accent);
  color: var(--text);
  box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.2);
}

.dashboard-modal .form-control::placeholder {
  color: var(--muted);
}

.dashboard-modal .form-control[readonly] {
  background: rgba(15, 23, 42, 0.45);
  color: var(--muted);
}

.calendar-note-when-option {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  cursor: pointer;
  user-select: none;
}

.calendar-note-when-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.calendar-note-when-mark {
  display: inline-block;
  width: 1.1em;
  text-align: center;
  font-size: 1.05rem;
  line-height: 1;
  color: rgba(248, 250, 252, 0.75);
}

.calendar-note-when-mark::before {
  content: "\25CB"; /* ○ */
}

.calendar-note-when-input:checked + .calendar-note-when-mark {
  color: #93c5fd;
}

.calendar-note-when-input:checked + .calendar-note-when-mark::before {
  content: "\25CF"; /* ● */
}

.calendar-note-when-input:focus-visible + .calendar-note-when-mark {
  outline: 2px solid rgba(147, 197, 253, 0.7);
  outline-offset: 2px;
  border-radius: 50%;
}

.calendar-note-when-label {
  font-size: 0.9rem;
  color: var(--text, #e2e8f0);
}

.dashboard-modal code {
  color: #93c5fd;
}

.page-settings-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 1.5rem;
}

.page-settings-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(37, 99, 235, 0.22);
  color: #93c5fd;
  border: 1px solid rgba(147, 197, 253, 0.28);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}

.page-settings-tag--heading {
  background: rgba(148, 163, 184, 0.16);
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.28);
}

.page-settings-tag-remove {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-size: 14px;
  opacity: 0.8;
}

.page-settings-tag-remove:hover {
  opacity: 1;
}

.dashboard-modal .snippets-list,
.dashboard-modal .panel-type-buttons {
  color: var(--text);
}

.modal-backdrop.show {
  opacity: 0.72;
}

.preview-content img.md-image-zoomable,
.editor-preview-side img.md-image-zoomable,
.EasyMDEContainer .editor-preview img.md-image-zoomable,
.chat-bubble-attachment img {
  cursor: pointer;
}

.preview-content a.md-image-link,
.editor-preview-side a.md-image-link,
.EasyMDEContainer .editor-preview a.md-image-link,
.chat-bubble-attachment a {
  display: inline-block;
  line-height: 0;
  max-width: 100%;
}

.chat-bubble-attachment a:hover img {
  opacity: 0.92;
}

.floating-toc {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  min-height: 0;
  max-height: calc(100vh - 160px);
  overflow: hidden;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 14px;
}

.floating-toc.d-none,
.floating-toc.is-hidden {
  display: none !important;
}

.floating-toc-title {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

#floating-toc-list {
  flex: 1 1 0;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto !important;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-right: 4px;
  scrollbar-gutter: stable;
}

.toc-link {
  display: block;
  text-decoration: none;
  color: #475569;
  font-size: 14px;
  line-height: 1.35;
  padding: 6px 8px;
  border-radius: 10px;
  transition: background .15s ease, color .15s ease;
}

.toc-link:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.toc-link.active {
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 600;
}

.toc-level-1 { padding-left: 8px; }
.toc-level-2 { padding-left: 18px; }
.toc-level-3 { padding-left: 28px; }
.toc-level-4 { padding-left: 38px; }
.toc-level-5 { padding-left: 48px; }
.toc-level-6 { padding-left: 58px; }

.sheet-block {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  border-radius: 14px;
  width: 100%;
  padding: 14px;
  margin: 16px 0;
}

.sheet-block-title {
  font-size: 12px;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 6px;
}

.md-panel {
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  border-left-width: 5px;
  margin: 16px 0;
  overflow: hidden;
  background: #f8fafc;
}

.md-panel-title {
  font-weight: 700;
  font-size: 14px;
  padding: 10px 14px 0;
  color: #0f172a;
}

.md-panel-body {
  padding: 8px 14px 12px;
  color: #1e293b;
  tab-size: var(--editor-tab-size, 4);
  -moz-tab-size: var(--editor-tab-size, 4);
  font-variant-numeric: tabular-nums;
}

.md-panel-body > :first-child { margin-top: 0; }
.md-panel-body > :last-child { margin-bottom: 0; }

.md-panel--info { border-left-color: #2563eb; background: #eff6ff; }
.md-panel--info .md-panel-title { color: #1d4ed8; }
.md-panel--success { border-left-color: #16a34a; background: #f0fdf4; }
.md-panel--success .md-panel-title { color: #15803d; }
.md-panel--warning { border-left-color: #d97706; background: #fffbeb; }
.md-panel--warning .md-panel-title { color: #b45309; }
.md-panel--danger { border-left-color: #dc2626; background: #fef2f2; }
.md-panel--danger .md-panel-title { color: #b91c1c; }
.md-panel--note { border-left-color: #64748b; background: #f8fafc; }
.md-panel--note .md-panel-title { color: #475569; }

/* Magpie-style RSS / news embed */
.md-news {
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  border-left-width: 5px;
  margin: 16px 0;
  overflow: hidden;
  background: #f8fafc;
}

.md-news-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 0;
}

.md-news-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: #ea580c;
  border-radius: 4px;
  padding: 2px 6px;
}

.md-news-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.md-news-body {
  padding: 8px 14px 12px;
  color: #1e293b;
}

.md-news-channel {
  display: inline-block;
  font-weight: 700;
  font-size: 15px;
  color: #1d4ed8;
  text-decoration: none;
  margin-bottom: 4px;
}

a.md-news-channel:hover {
  text-decoration: underline;
}

.md-news-channel-desc {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 10px;
}

.md-news-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.md-news-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 8px 0;
  border-top: 1px solid #e2e8f0;
}

.md-news-item:first-child {
  border-top: none;
  padding-top: 0;
}

.md-news-item-media {
  flex: 0 0 112px;
  width: 112px;
  display: block;
  overflow: hidden;
  border-radius: 8px;
  background: #e2e8f0;
  align-self: stretch;
  min-height: 72px;
}

.md-news-item-img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 72px;
  max-height: 96px;
  object-fit: cover;
}

.md-news-item-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.md-news-item-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
}

.md-news-item-title a {
  color: #0f172a;
  text-decoration: none;
}

.md-news-item-title a:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

.md-news-item-desc {
  font-size: 13px;
  color: #475569;
  line-height: 1.45;
}

.md-news-item-date {
  margin-top: 4px;
  font-size: 11px;
  color: #94a3b8;
}

.md-news-loading,
.md-news-empty {
  font-size: 13px;
  color: #64748b;
}

.md-news--loading .md-news-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.md-news--loading .md-news-loading::before {
  content: '';
  width: 12px;
  height: 12px;
  border: 2px solid #cbd5e1;
  border-top-color: #ea580c;
  border-radius: 50%;
  animation: md-news-spin 0.7s linear infinite;
}

@keyframes md-news-spin {
  to { transform: rotate(360deg); }
}

.md-news-error {
  font-size: 13px;
  color: #b91c1c;
}

.md-news--info { border-left-color: #2563eb; background: #eff6ff; }
.md-news--success { border-left-color: #16a34a; background: #f0fdf4; }
.md-news--warning { border-left-color: #d97706; background: #fffbeb; }
.md-news--danger { border-left-color: #dc2626; background: #fef2f2; }
.md-news--note { border-left-color: #64748b; background: #f8fafc; }

/* Python / executecode — Pyodide sandbox in preview */
.md-python {
  --md-python-accent: #0f766e;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  border-left: 5px solid var(--md-python-accent);
  margin: 16px 0;
  overflow: hidden;
  background: #f8fafc;
}

.md-python-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 0;
  flex-wrap: wrap;
}

.md-python-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: var(--md-python-accent);
  border-radius: 4px;
  padding: 2px 6px;
}

.md-python-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.md-python-meta {
  margin-left: auto;
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.md-python-src {
  margin: 10px 14px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12.5px;
  line-height: 1.45;
  overflow-x: auto;
  white-space: pre;
}

.md-python-src code {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: transparent;
  padding: 0;
}

.md-python-out {
  padding: 10px 14px 14px;
}

.md-python-stdout,
.md-python-stderr {
  margin: 0 0 8px;
  padding: 10px 12px;
  border-radius: 8px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-x: auto;
}

.md-python-stdout {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.md-python-stderr,
.md-python-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.md-python-error {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-family: Consolas, "Courier New", monospace;
  white-space: pre-wrap;
}

.md-python-empty {
  font-size: 12px;
  color: #94a3b8;
  font-style: italic;
}

.md-python-loading {
  font-size: 13px;
  color: #64748b;
}

.md-python--loading .md-python-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.md-python--loading .md-python-loading::before {
  content: '';
  width: 12px;
  height: 12px;
  border: 2px solid #cbd5e1;
  border-top-color: var(--md-python-accent);
  border-radius: 50%;
  animation: md-news-spin 0.7s linear infinite;
}

.md-python-plot {
  margin: 8px 0 0;
  padding: 0;
}

.md-python-plot img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #fff;
}

.md-python--info { --md-python-accent: #2563eb; background: #eff6ff; }
.md-python--success { --md-python-accent: #16a34a; background: #f0fdf4; }
.md-python--warning { --md-python-accent: #d97706; background: #fffbeb; }
.md-python--danger { --md-python-accent: #dc2626; background: #fef2f2; }
.md-python--note { --md-python-accent: #64748b; background: #f8fafc; }

.md-python--custom {
  border-left-color: var(--md-python-color, var(--md-python-accent));
  background: var(--md-python-bg, #f8fafc);
  color: var(--md-python-color, inherit);
}

.md-python--custom .md-python-title,
.md-python--custom .md-python-badge {
  color: #fff;
}

.md-python--custom .md-python-badge {
  background: var(--md-python-color, var(--md-python-accent));
}

.md-python--custom .md-python-title {
  color: var(--md-python-color, #0f172a);
}

.voice-block {
  --voice-accent: #7c3aed;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  border-left: 5px solid var(--voice-accent);
  margin: 16px 0;
  overflow: hidden;
  background: #f8fafc;
  padding: 0 14px 12px;
}

.voice-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0 0;
  flex-wrap: wrap;
}

.voice-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: var(--voice-accent);
  border-radius: 999px;
  padding: 2px 8px;
}

.voice-title {
  font-size: 1rem;
  color: #0f172a;
}

.voice-meta {
  margin-left: auto;
  font-size: 12px;
  color: #64748b;
}

.voice-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
}

.voice-btn {
  width: auto;
  min-width: max-content;
  height: auto;
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(124, 58, 237, 0.35);
  background: #fff;
  color: #5b21b6;
  font: 600 13px/1.2 system-ui, sans-serif;
  cursor: pointer;
}

.voice-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.voice-btn--record {
  background: #7c3aed;
  border-color: #6d28d9;
  color: #fff;
}

.voice-block--recording .voice-btn--record {
  background: #dc2626;
  border-color: #b91c1c;
}

.voice-lang {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #475569;
}

.voice-lang-select {
  min-height: 36px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  padding: 4px 8px;
}

.voice-timer {
  font: 600 13px/1 ui-monospace, Consolas, monospace;
  color: #64748b;
}

.voice-player {
  display: block;
  width: 100%;
  margin: 4px 0 10px;
}

.voice-empty,
.voice-status {
  margin: 0 0 8px;
  font-size: 0.85rem;
  color: #64748b;
}

.voice-transcript-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 4px;
}

.voice-transcript {
  width: 100%;
  min-height: 120px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  padding: 8px 10px;
  font: 14px/1.45 system-ui, sans-serif;
  background: #fff;
}

.voice-block--info { --voice-accent: #2563eb; background: #eff6ff; }
.voice-block--success { --voice-accent: #16a34a; background: #f0fdf4; }
.voice-block--warning { --voice-accent: #d97706; background: #fffbeb; }
.voice-block--danger { --voice-accent: #dc2626; background: #fef2f2; }
.voice-block--note { --voice-accent: #64748b; background: #f8fafc; }

.voice-block--custom {
  border-left-color: var(--voice-accent);
  background: var(--voice-bg, #f8fafc);
}

.jukebox-block {
  --jukebox-accent: #ff5733;
  --jukebox-song: #65acf7;
  --jukebox-song-hover: #21a1f1;
  --jukebox-song-pressed: #09588d;
  --jukebox-mode-pressed: #21a1f1;
  --jukebox-album: #f5c542;
  --jukebox-album-text: #1a1208;
  --jukebox-photo: url('jukebox.png');
  position: relative;
  font-family: Arial, sans-serif;
  color: #ffffff;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  min-height: min(78vh, 820px);
  height: auto;
  margin: 16px 0;
  padding: 18px 16px 16px;
  border: 0;
  border-radius: 16px;
  overflow: visible;
  outline: none;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  background-color: #120b16;
  background-image: var(--jukebox-photo);
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
}

.jukebox-block::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  backdrop-filter: blur(5px);
  background: rgba(0, 0, 0, 0.18);
  pointer-events: none;
}

.jukebox-block--info { --jukebox-accent: #38bdf8; }
.jukebox-block--success { --jukebox-accent: #4ade80; }
.jukebox-block--warning { --jukebox-accent: #fbbf24; }
.jukebox-block--danger { --jukebox-accent: #f87171; }
.jukebox-block--note { --jukebox-accent: #cbd5e1; }
.jukebox-block--custom { box-shadow: 0 0 0 2px var(--jukebox-accent), 0 16px 40px rgba(0, 0, 0, 0.45); }
.jukebox-block--error { padding: 16px; background: #1a1014; }

.jukebox-chrome {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: none;
  margin: 0;
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  gap: 12px;
  min-height: 0;
}

.jukebox-title,
.jukebox-song-label,
.jukebox-player,
.jukebox-volume-label,
.jukebox-control-row--album,
.jukebox-control-row--nav,
.jukebox-search-label,
.jukebox-drop,
.jukebox-status {
  flex-shrink: 0;
}

.jukebox-settings-btn {
  position: absolute;
  top: 10px;
  right: 52px;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  min-width: 36px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.72);
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

.jukebox-settings-btn:hover,
.jukebox-block--settings .jukebox-settings-btn {
  background: rgba(30, 41, 59, 0.92);
  border-color: rgba(255, 255, 255, 0.35);
}

.jukebox-settings {
  position: absolute;
  top: 52px;
  right: 10px;
  left: 10px;
  z-index: 28;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  background: rgba(12, 8, 16, 0.94);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
}

.jukebox-settings[hidden] {
  display: none;
}

.jukebox-settings-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #ffd0c4;
}

.jukebox-control-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
  justify-content: stretch;
  width: 100%;
}

.jukebox-control-row--modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.jukebox-control-row--modes .jukebox-mode-btn {
  flex: 1 1 0;
  min-width: 0;
  width: 100%;
}

.jukebox-control-row--nav {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 10px;
  align-items: stretch;
}

.jukebox-control-row--nav > .jukebox-mode-btn {
  flex: 0 0 auto;
  width: auto;
  min-width: 72px;
}

.jukebox-control-row--nav .jukebox-search-label {
  flex: 1 1 auto;
  min-width: 0;
}

.jukebox-clip-group {
  display: flex;
  gap: 10px;
  align-items: stretch;
  width: 100%;
  min-width: 0;
}

.jukebox-clip-group .jukebox-mode-btn {
  flex: 1 1 0;
  min-width: 0;
}

.jukebox-volume-label {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  font-size: 0.9rem;
  color: #ffffff;
  white-space: nowrap;
}

.jukebox-volume {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  height: 28px;
  accent-color: #ff5733;
}

.jukebox-player { text-align: center; }

.jukebox-song-label {
  margin: 0;
  font-size: 1.2em;
  color: #ffffff;
  text-align: center;
  min-height: 1.3em;
}

.jukebox-audio {
  display: block;
  width: 100%;
  max-width: none;
  margin: 0;
  height: 40px;
  min-height: 40px;
}

.jukebox-mode-btn {
  padding: 10px 15px;
  font-size: 0.9rem;
  border: none;
  border-radius: 5px;
  background-color: #ff5733;
  color: #ffffff;
  cursor: pointer;
  width: auto;
  min-width: 0;
  min-height: 40px;
  flex: 0 1 auto;
}

.jukebox-mode-btn:hover {
  background-color: #e84118;
}

.jukebox-mode-btn.pressed {
  background-color: var(--jukebox-mode-pressed);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.3);
  transform: translateY(2px);
}

.jukebox-album-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: #ffffff;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.jukebox-block .jukebox-album-select {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  max-width: none;
  min-height: 40px;
  padding: 10px 15px;
  font-size: 0.95rem;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 5px;
  background-color: var(--jukebox-album);
  color: var(--jukebox-album-text);
  cursor: pointer;
}

.jukebox-block .jukebox-album-select:focus {
  outline: 2px solid #fff;
  outline-offset: 1px;
}

.jukebox-cabinet {
  width: 100%;
  margin: 0;
  padding: 16px;
  border-radius: 12px;
  background-color: rgba(0, 0, 0, 0.2);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  color: #ffffff;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.jukebox-search-label {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  font-size: 0.9rem;
  color: #ffffff;
  white-space: nowrap;
}

.jukebox-search {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.4);
  color: #ffffff;
  font-size: 0.95rem;
}

.jukebox-search::placeholder {
  color: rgba(255, 255, 255, 0.65);
}

.jukebox-search:focus {
  outline: 2px solid #fff;
  outline-offset: 1px;
}

.preview-layout .jukebox-block .jukebox-title,
.editor-preview .jukebox-block .jukebox-title,
.jukebox-block .jukebox-title {
  margin: 0;
  padding: 0 150px 0 12px;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: center;
  color: #ffffff;
  background: none;
  border: 0;
  border-bottom: 0;
}

.jukebox-playlist {
  --jukebox-song-rows: 5;
  --jukebox-song-row: 50px;
  --jukebox-song-gap: 10px;
  width: 100%;
  margin: 0;
  border: 2px solid #ccc;
  border-radius: 8px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
  grid-auto-rows: var(--jukebox-song-row);
  gap: var(--jukebox-song-gap);
  padding: 10px;
  min-height: 0;
  height: calc(
    var(--jukebox-song-rows) * var(--jukebox-song-row)
    + (var(--jukebox-song-rows) - 1) * var(--jukebox-song-gap)
    + 20px
    + 4px
  );
  max-height: calc(
    var(--jukebox-song-rows) * var(--jukebox-song-row)
    + (var(--jukebox-song-rows) - 1) * var(--jukebox-song-gap)
    + 20px
    + 4px
  );
  flex: 0 0 auto;
  box-sizing: border-box;
}

.jukebox-song-cell {
  position: relative;
  min-width: 0;
}

.jukebox-block .song-button {
  display: block;
  width: 100%;
  height: 50px;
  min-height: 50px;
  min-width: 0;
  margin: 0;
  padding: 10px 28px 10px 10px;
  font-size: 1em;
  background-color: var(--jukebox-song);
  color: #ffffff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background-color 0.3s;
}

.jukebox-block .song-button:hover {
  background-color: var(--jukebox-song-hover);
}

.jukebox-block .song-button.pressed {
  background-color: var(--jukebox-song-pressed);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.3);
  transform: translateY(2px);
}

.jukebox-empty-row {
  grid-column: 1 / -1;
  width: 100%;
  padding: 18px 8px;
  color: #ffffff;
  font-size: 13px;
  text-align: center;
}

.jukebox-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
  color: #ffffff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.jukebox-drop {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 0;
  padding: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.45);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
}

.jukebox-block--drop .jukebox-drop,
.jukebox-block--drop {
  outline: 2px dashed #ff5733;
}

.jukebox-add {
  width: auto;
  min-width: max-content;
  min-height: 36px;
  height: auto;
  padding: 10px 15px;
  border-radius: 5px;
  border: none;
  background: #ff5733;
  color: #ffffff;
  font: 650 0.9rem/1.2 Arial, sans-serif;
  cursor: pointer;
}

.jukebox-drive-url {
  flex: 1 1 220px;
  min-width: 160px;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.35);
  color: #ffffff;
  font: 400 0.85rem/1.2 Arial, sans-serif;
}

.jukebox-drive-url::placeholder {
  color: rgba(255, 255, 255, 0.65);
}

.jukebox-add:hover { background: #e84118; }

.jukebox-block .jukebox-folder-link {
  display: inline;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  color: #ffd0c4;
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
  min-width: 0;
  min-height: 0;
  height: auto;
  width: auto;
  border-radius: 0;
  box-shadow: none;
}

.jukebox-block .jukebox-folder-link:hover {
  color: #ffffff;
  background: none;
}

.jukebox-drop-hint,
.jukebox-status {
  font-size: 12px;
  color: #ffffff;
  margin: 0;
}

.jukebox-status { min-height: 1.2em; margin-top: 4px; }

.jukebox-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1070;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  background: #1a1014;
  border-top: 2px solid #ff5733;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
}

.jukebox-dock[hidden] {
  display: none;
}

.jukebox-dock .jukebox-mode-btn {
  flex: 0 0 auto;
}

.jukebox-dock-copy {
  flex: 1 1 180px;
  min-width: 0;
}

.jukebox-dock-label {
  color: #ffffff;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.jukebox-dock-player .jukebox-audio {
  width: 100%;
  max-width: none;
}

body.has-jukebox-dock {
  padding-bottom: 92px;
}

body.jukebox-standalone.has-jukebox-dock {
  padding-bottom: 0;
}

@media (max-width: 600px) {
  body.has-jukebox-dock.mobile-layout .mobile-page-fabs {
    bottom: 88px;
  }
}

@media (max-width: 600px) {
  .jukebox-block {
    min-height: 0;
    padding: 12px 8px;
  }

  .jukebox-control-row--modes {
    grid-template-columns: 1fr;
  }

  .jukebox-control-row--nav {
    flex-wrap: nowrap;
  }

  .jukebox-control-row--nav > .jukebox-mode-btn {
    min-width: 0;
    flex: 0 0 auto;
    padding: 10px 12px;
  }

  .jukebox-settings-btn {
    right: 50px;
    width: 36px;
    padding: 0;
    font-size: 0;
  }

  .jukebox-settings-btn::before {
    content: '⚙';
    font-size: 16px;
    line-height: 1;
  }

  .jukebox-block .jukebox-title {
    padding-right: 96px;
    font-size: 1.5rem;
  }

  .jukebox-album-label {
    flex: 1 1 auto;
    width: 100%;
    flex-wrap: wrap;
  }

  .jukebox-playlist {
    grid-template-columns: 1fr;
  }
}

.jukebox-block--fullscreen,
.jukebox-block:fullscreen,
.jukebox-block:-webkit-full-screen {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 16px;
  border-radius: 0;
  box-sizing: border-box;
}

.jukebox-block--fullscreen {
  min-height: min(90vh, 960px);
}

.jukebox-block:fullscreen,
.jukebox-block:-webkit-full-screen {
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}

.jukebox-block--fullscreen .jukebox-chrome,
.jukebox-block:fullscreen .jukebox-chrome,
.jukebox-block:-webkit-full-screen .jukebox-chrome {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

.jukebox-block--fullscreen .jukebox-cabinet,
.jukebox-block:fullscreen .jukebox-cabinet,
.jukebox-block:-webkit-full-screen .jukebox-cabinet {
  flex: 1 1 auto;
  min-height: 0;
}

.jukebox-block--fullscreen .jukebox-playlist,
.jukebox-block:fullscreen .jukebox-playlist,
.jukebox-block:-webkit-full-screen .jukebox-playlist {
  flex: 0 0 auto;
}

.jukebox-block:fullscreen .game-fullscreen-btn__icon--enter,
.jukebox-block:-webkit-full-screen .game-fullscreen-btn__icon--enter {
  display: none;
}

.jukebox-block:fullscreen .game-fullscreen-btn__icon--exit,
.jukebox-block:-webkit-full-screen .game-fullscreen-btn__icon--exit {
  display: inline;
}

.jukebox-settings .jukebox-standalone-btn {
  width: 100%;
}

body.jukebox-standalone {
  overflow: hidden;
}

body.jukebox-standalone .topbar,
body.jukebox-standalone .sidebar,
body.jukebox-standalone #left-panel,
body.jukebox-standalone #left-splitter,
body.jukebox-standalone .right-panel,
body.jukebox-standalone #right-panel,
body.jukebox-standalone #right-splitter,
body.jukebox-standalone #floating-toc,
body.jukebox-standalone .mobile-page-fabs,
body.jukebox-standalone .jukebox-dock {
  display: none !important;
}

body.jukebox-standalone .app-shell {
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: minmax(0, 1fr);
}

body.jukebox-standalone .main-pane {
  grid-column: 1 / -1 !important;
  grid-row: 1 / -1 !important;
  padding: 0;
  margin: 0;
  height: 100%;
  min-height: 0;
}

body.jukebox-standalone .editor-wrap {
  padding: 0;
  height: 100%;
}

body.jukebox-standalone .editor-wrap,
body.jukebox-standalone #preview-wrap,
body.jukebox-standalone .preview-layout,
body.jukebox-standalone .preview-content {
  height: 100%;
  min-height: 0;
  max-width: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 0;
}

body.jukebox-standalone .preview-content {
  display: flex;
  flex-direction: column;
}

body.jukebox-standalone .preview-content > .jukebox-block {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  margin: 0;
  border-radius: 0;
}

body.jukebox-standalone.has-jukebox-dock {
  padding-bottom: 0;
}

body.public-page:not(.public-tree) .sidebar,
body.public-page:not(.public-tree) #left-panel,
body.public-page:not(.public-tree) #left-splitter,
body.public-page:not(.public-tree) #toggle-left,
body.public-page .right-panel,
body.public-page #right-panel,
body.public-page #right-splitter,
body.public-page #quick-notes-wrap,
body.public-page .mobile-page-fabs {
  display: none !important;
}

body.public-page.public-tree .tree-actions,
body.public-page.public-tree #ws-add-btn,
body.public-page.public-tree #ws-settings-btn,
body.public-page.public-tree #ws-rename-btn,
body.public-page.public-tree #ws-delete-btn,
body.public-page.public-tree #tag-search,
body.public-page.public-tree #tag-rebuild-btn,
body.public-page.public-tree #tag-search-results,
body.public-page.public-tree #tag-suggestions,
body.public-page.public-tree .sidebar .panel-card ~ .panel-card {
  display: none !important;
}

body.public-page.public-tree #workspace-select,
body.public-page.public-tree .workspace-row .btn-group {
  pointer-events: none;
}

body.public-page.public-tree .workspace-row .btn-group {
  display: none !important;
}

body.public-page:not(.public-tree) .app-shell {
  --sidebar-width: 0px;
  --splitter-width: 0px;
  --right-width: 0px;
  --right-splitter-width: 0px;
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  height: var(--vvh, 100dvh);
  max-height: var(--vvh, 100dvh);
}

body.public-page.public-tree .app-shell {
  --right-width: 0px;
  --right-splitter-width: 0px;
  grid-template-columns: var(--sidebar-width) var(--splitter-width) minmax(0, 1fr) !important;
  height: 100vh;
  height: var(--vvh, 100dvh);
  max-height: var(--vvh, 100dvh);
}

body.public-page .preview-content {
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}

body.public-page:not(.public-tree) .main-pane,
body.public-page:not(.public-tree):not(.editing) .main-pane,
body.public-page:not(.public-tree) .app-shell:has(.editor-wrap--preview-only) .main-pane,
body.public-page:not(.public-tree) .app-shell:has(.right-panel:not(.collapsed)) .main-pane {
  grid-column: 1 !important;
  grid-row: 2 !important;
}

.panel-type-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.panel-type-btn {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  background: #fff;
  cursor: pointer;
}

.panel-type-btn.active {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}

.panel-type-btn--info { border-left: 4px solid #2563eb; }
.panel-type-btn--success { border-left: 4px solid #16a34a; }
.panel-type-btn--warning { border-left: 4px solid #d97706; }
.panel-type-btn--danger { border-left: 4px solid #dc2626; }
.panel-type-btn--note { border-left: 4px solid #64748b; }

.snippets-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 320px;
  overflow-y: auto;
}

.snippets-list-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #1e293b;
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  cursor: pointer;
}

.snippets-list-item:hover,
.snippets-list-item.active {
  border-color: var(--accent);
  background: rgba(37, 99, 235, 0.15);
}

.snippets-quick-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.snippets-quick-btn {
  text-align: left;
  justify-content: flex-start;
}

.sheet-block-name {
  font-weight: 600;
  color: #0f172a;
}

.spreadsheet-table {
  width: max-content;
  max-width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
}

.spreadsheet-table--fixed-cols {
  table-layout: fixed;
  width: 100%;
  max-width: 100%;
}

.spreadsheet-table th,
.spreadsheet-table td {
  border: 1px solid #cbd5e1;
  padding: 6px 10px;
  overflow: hidden;
  vertical-align: middle;
}

.spreadsheet-table th {
  background: #e2e8f0;
  font-weight: 600;
  color: #0f172a;
}

.sheet-preview-block {
  margin: 16px 0;
  max-width: 100%;
  overflow-x: auto;
}

.sheet-table-wrap {
  display: inline-block;
  max-width: 100%;
}

.spreadsheet-table--bands .sheet-band-corner {
  width: 32px;
  min-width: 32px;
  padding: 0;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
}

.spreadsheet-table--bands .sheet-col-band,
.spreadsheet-table--bands .sheet-row-band {
  padding: 0;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  cursor: pointer;
  user-select: none;
  vertical-align: middle;
  text-align: center;
}

.spreadsheet-table--bands .sheet-col-band {
  width: auto;
  min-width: 2em;
  height: 24px;
  min-height: 24px;
}

.spreadsheet-table--bands .sheet-row-band {
  width: 32px;
  min-width: 32px;
  min-height: 24px;
}

.spreadsheet-table--bands .sheet-band-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  color: #64748b;
  pointer-events: none;
}

.spreadsheet-table--bands .sheet-col-band:hover,
.spreadsheet-table--bands .sheet-row-band:hover {
  background: #e2e8f0;
}

.spreadsheet-table--bands .sheet-col-band:focus-visible,
.spreadsheet-table--bands .sheet-row-band:focus-visible {
  outline: 2px solid var(--accent, #2563eb);
  outline-offset: -2px;
}

.spreadsheet-table--bands .sheet-col-band--selected,
.spreadsheet-table--bands .sheet-row-band--selected {
  background: #2563eb;
  border-color: #1d4ed8;
  box-shadow: inset 0 0 0 1px #1e40af;
}

.spreadsheet-table--bands .sheet-col-band--selected .sheet-band-label,
.spreadsheet-table--bands .sheet-row-band--selected .sheet-band-label {
  color: #fff;
}

.sheet-structure-menu {
  position: fixed;
  z-index: 1080;
  min-width: 160px;
  padding: 4px;
  border-radius: 8px;
  background: #0f172a;
  border: 1px solid #334155;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.35);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sheet-structure-menu-btn {
  appearance: none;
  border: 0;
  margin: 0;
  padding: 8px 10px;
  border-radius: 6px;
  background: transparent;
  color: #e2e8f0;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.sheet-structure-menu-btn:hover,
.sheet-structure-menu-btn:focus-visible {
  background: #1e293b;
  color: #fff;
  outline: none;
}

.sheet-cell-structure-toolbar {
  position: fixed;
  z-index: 1075;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: #0f172a;
  border: 1px solid #334155;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.35);
  pointer-events: auto;
}

.sheet-cell-structure-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.sheet-cell-structure-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-right: 2px;
}

.sheet-cell-structure-toolbar .sheet-band-btn {
  pointer-events: auto;
  appearance: none;
  border: 0;
  margin: 0;
  padding: 0;
  width: 22px;
  height: 22px;
  line-height: 20px;
  border-radius: 5px;
  background: #fff;
  color: #334155;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px #cbd5e1;
  -webkit-tap-highlight-color: transparent;
}

.sheet-cell-structure-toolbar .sheet-band-btn:hover {
  background: #eff6ff;
  color: #1d4ed8;
  box-shadow: inset 0 0 0 1px #93c5fd;
}

.sheet-cell-structure-toolbar .sheet-band-btn--remove:hover {
  background: #fef2f2;
  color: #b91c1c;
  box-shadow: inset 0 0 0 1px #fecaca;
}

body.mobile-layout .sheet-cell-structure-toolbar {
  gap: 10px;
  padding: 8px 10px;
}

body.mobile-layout .sheet-cell-structure-toolbar .sheet-band-btn {
  width: 28px;
  height: 28px;
  font-size: 17px;
  line-height: 26px;
}

.spreadsheet-table--bands .sheet-cell--col-selected,
.spreadsheet-table--bands .sheet-cell--row-selected {
  background: rgba(37, 99, 235, 0.1);
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.35);
}

.spreadsheet-table--bands .sheet-cell-editable.sheet-cell--col-selected:focus,
.spreadsheet-table--bands .sheet-cell-editable.sheet-cell--row-selected:focus {
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--accent, #2563eb);
}

.spreadsheet-table .sheet-cell-editable {
  cursor: text;
  min-width: 2.5em;
}

.spreadsheet-table .sheet-cell-editable:focus {
  outline: 2px solid var(--accent, #2563eb);
  outline-offset: -2px;
  background: #fff;
}

.spreadsheet-table strong,
.spreadsheet-table b {
  font-weight: 700;
}

.spreadsheet-table em,
.spreadsheet-table i {
  font-style: italic;
}

.spreadsheet-table del {
  text-decoration: line-through;
}

.spreadsheet-table code {
  font-size: 0.9em;
  padding: 0 0.2em;
}

.spreadsheet-table .sheet-cell-editable a {
  pointer-events: none;
}

.spreadsheet-table .sheet-cell-editable.sheet-cell--ref-pick:focus {
  outline: 2px solid #0d9488;
  box-shadow: inset 0 0 0 1px rgba(13, 148, 136, 0.35);
}

.spreadsheet-table .sheet-cell-err {
  color: #dc2626;
  font-weight: 600;
}

.spreadsheet-table .sheet-cell-editable.sheet-cell-err {
  cursor: text;
}

.spreadsheet-table .sheet-cell-editable.sheet-cell-err:focus {
  color: #0f172a;
  font-weight: normal;
}

.spreadsheet-table .sheet-cell-image {
  padding: 4px;
  vertical-align: middle;
  overflow: hidden;
}

.spreadsheet-table .sheet-cell-form {
  vertical-align: top;
  padding: 4px 6px;
}

.spreadsheet-table .sheet-cell-form .form-widget {
  margin: 0;
  padding: 6px 8px;
  border-radius: 8px;
}

.spreadsheet-table .sheet-cell-form .form-widget-header {
  margin-bottom: 6px;
}

.spreadsheet-table .sheet-cell-form .form-widget-textarea {
  min-height: 2.4em;
}

.spreadsheet-table .sheet-cell-form .form-widget-vote-foot {
  font-size: 0.75rem;
}

.form-widget--untitled .form-widget-title {
  display: none;
}

.form-widget--sheet .form-widget-meta {
  font-size: 0.7rem;
  cursor: pointer;
}

.spreadsheet-table .sheet-cell-image .md-image-wrap--sheet-cell,
.spreadsheet-table .sheet-cell-image .md-image-wrap--full {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0;
}

.spreadsheet-table .sheet-cell-image a.md-image-link,
.spreadsheet-table .sheet-cell-image a.md-image-link--full {
  display: block;
  width: 100%;
  max-width: 100%;
  line-height: 0;
}

.spreadsheet-table .sheet-cell-image img.md-image,
.spreadsheet-table .sheet-cell-image .md-image-wrap--sheet-cell img.md-image {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  vertical-align: middle;
}

/* Explicit non-100% widths keep inline style from renderSheetMarkdownImage */

/* Markdown GFM tables: full-width images fill the cell */
.preview-content table td .md-image-wrap--full,
.preview-content table th .md-image-wrap--full,
.preview-layout table td .md-image-wrap--full,
.preview-layout table th .md-image-wrap--full,
.editor-preview-side table td .md-image-wrap--full,
.EasyMDEContainer .editor-preview table td .md-image-wrap--full {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 6px 0;
}

.preview-content table td a.md-image-link--full,
.preview-content table th a.md-image-link--full,
.preview-layout table td a.md-image-link--full,
.preview-layout table th a.md-image-link--full,
.editor-preview-side table td a.md-image-link--full,
.EasyMDEContainer .editor-preview table td a.md-image-link--full,
.preview-content table td img.md-image--full,
.preview-content table th img.md-image--full,
.preview-layout table td img.md-image--full,
.preview-layout table th img.md-image--full {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}

body.editing .spreadsheet-table .sheet-cell-editable:hover,
body.mobile-layout .spreadsheet-table .sheet-cell-editable:hover {
  background: #f1f5f9;
}

body.mobile-layout .spreadsheet-table--bands .sheet-band-corner,
body.mobile-layout .spreadsheet-table--bands .sheet-row-band {
  width: 36px;
  min-width: 36px;
}

body.mobile-layout .spreadsheet-table--bands .sheet-col-band {
  min-width: 2.25em;
  height: 28px;
  min-height: 28px;
}

body.mobile-layout .spreadsheet-table--bands .sheet-band-label {
  font-size: 12px;
}

body.mobile-layout .sheet-structure-menu {
  min-width: 200px;
}

body.mobile-layout .sheet-structure-menu-btn {
  padding: 12px 14px;
  font-size: 15px;
  min-height: 44px;
}

.body.editing .sheet-preview-block .spreadsheet-table {
  outline: 1px solid #cbd5e1;
  outline-offset: 2px;
}

.calendar-block {
  --calendar-bg: #fff;
  --calendar-border: #cbd5e1;
  --calendar-title: #0f172a;
  --calendar-meta: #64748b;
  --calendar-group: #334155;
  --calendar-unit-bg: #dbeafe;
  --calendar-unit-border: #bfdbfe;
  --calendar-unit-text: #1e3a8a;
  --calendar-unit-secondary: #64748b;
  --calendar-accent: #2563eb;
  border: 1px solid var(--calendar-border);
  border-left: 4px solid var(--calendar-accent);
  background: var(--calendar-bg);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 16px 0;
  color: var(--calendar-title);
}

.calendar-block--error {
  --calendar-bg: #fef2f2;
  --calendar-border: #fecaca;
  --calendar-title: #991b1b;
  --calendar-accent: #dc2626;
}

.calendar-block--info {
  --calendar-bg: #eff6ff;
  --calendar-border: #bfdbfe;
  --calendar-title: #1d4ed8;
  --calendar-meta: #3b82f6;
  --calendar-group: #1e40af;
  --calendar-unit-bg: #dbeafe;
  --calendar-unit-border: #93c5fd;
  --calendar-unit-text: #1e3a8a;
  --calendar-unit-secondary: #3b82f6;
  --calendar-accent: #2563eb;
}

.calendar-block--success {
  --calendar-bg: #f0fdf4;
  --calendar-border: #bbf7d0;
  --calendar-title: #15803d;
  --calendar-meta: #16a34a;
  --calendar-group: #166534;
  --calendar-unit-bg: #dcfce7;
  --calendar-unit-border: #86efac;
  --calendar-unit-text: #14532d;
  --calendar-unit-secondary: #16a34a;
  --calendar-accent: #16a34a;
}

.calendar-block--warning {
  --calendar-bg: #fffbeb;
  --calendar-border: #fde68a;
  --calendar-title: #b45309;
  --calendar-meta: #d97706;
  --calendar-group: #92400e;
  --calendar-unit-bg: #fef3c7;
  --calendar-unit-border: #fcd34d;
  --calendar-unit-text: #78350f;
  --calendar-unit-secondary: #d97706;
  --calendar-accent: #d97706;
}

.calendar-block--danger {
  --calendar-bg: #fef2f2;
  --calendar-border: #fecaca;
  --calendar-title: #b91c1c;
  --calendar-meta: #dc2626;
  --calendar-group: #991b1b;
  --calendar-unit-bg: #fee2e2;
  --calendar-unit-border: #fca5a5;
  --calendar-unit-text: #7f1d1d;
  --calendar-unit-secondary: #dc2626;
  --calendar-accent: #dc2626;
}

.calendar-block--note {
  --calendar-bg: #f8fafc;
  --calendar-border: #e2e8f0;
  --calendar-title: #475569;
  --calendar-meta: #64748b;
  --calendar-group: #334155;
  --calendar-unit-bg: #e2e8f0;
  --calendar-unit-border: #cbd5e1;
  --calendar-unit-text: #0f172a;
  --calendar-unit-secondary: #64748b;
  --calendar-accent: #64748b;
}

.app-settings-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.app-settings-links .btn {
  min-width: 4.5rem;
}

.app-settings-about-version {
  color: var(--text, #e2e8f0);
}

.app-settings-about-credits {
  margin-top: 4px;
}

.app-settings-about-credits-summary {
  cursor: pointer;
  color: var(--muted, #94a3b8);
  user-select: none;
}

.app-settings-about-credits-summary:hover {
  color: var(--text, #e2e8f0);
}

.app-settings-about-license {
  margin-bottom: 8px;
}

.app-settings-license-text {
  margin: 8px 0 0;
  color: var(--text, #e2e8f0);
}

.app-settings-license-text p {
  margin: 0 0 8px;
}

.app-settings-credits-list {
  margin: 8px 0 0;
  padding-left: 1.1rem;
  color: var(--text, #e2e8f0);
}

.app-settings-credits-list li + li {
  margin-top: 4px;
}

.app-settings-credits-list a {
  color: var(--accent, #38bdf8);
  text-decoration: none;
}

.app-settings-credits-list a:hover {
  color: #fff;
}

.app-settings-shop-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 1.5rem;
}

.app-settings-shop-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel-2);
}

.app-settings-shop-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-settings-shop-thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 0.7rem;
  height: 0.7rem;
  padding: 0;
  opacity: 0.9;
}

.app-settings-shop-image-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.app-settings-shop-image-row .form-control {
  flex: 1 1 auto;
}

.calendar-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.calendar-block-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--calendar-title);
}

.calendar-block-meta {
  font-size: 12px;
  color: var(--calendar-meta);
  flex-shrink: 0;
}

.calendar-mode-selector {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  justify-content: flex-end;
}

.calendar-mode-btn {
  border: 1px solid var(--calendar-unit-border);
  background: var(--calendar-unit-bg);
  color: var(--calendar-unit-text);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  text-transform: none;
}

.calendar-mode-btn--active {
  background: var(--calendar-accent);
  color: #fff;
  border-color: var(--calendar-accent);
}

.calendar-mode-btn:disabled {
  cursor: default;
  opacity: 0.92;
}

.calendar-mode-btn:not(:disabled):hover {
  filter: brightness(0.97);
}

.calendar-archive-btn {
  border: 1px solid var(--calendar-unit-border);
  background: var(--calendar-unit-bg);
  color: var(--calendar-unit-secondary);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
}

.calendar-archive-btn:hover {
  border-color: var(--calendar-accent);
  color: var(--calendar-title);
}

.calendar-block--old {
  opacity: 0.94;
}

.calendar-archive-section {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px dashed var(--calendar-unit-border);
}

.calendar-archive-section > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--calendar-meta);
  margin-bottom: 10px;
}

.calendar-archive-section-body {
  margin-top: 8px;
}

.calendar-group {
  margin-top: 12px;
}

.calendar-group:first-of-type {
  margin-top: 0;
}

.calendar-group-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--calendar-group);
  margin-bottom: 8px;
}

.calendar-units {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.calendar-units--weeks {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-wrap: nowrap;
}

.calendar-week-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  align-items: stretch;
}

.calendar-week-row--header {
  gap: 6px;
}

.calendar-weekday-label {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--calendar-unit-secondary);
  padding: 2px 0 4px;
}

.calendar-unit {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 2px;
  min-width: 72px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--calendar-unit-bg);
  color: var(--calendar-unit-text);
  border: 1px solid var(--calendar-unit-border);
}

.calendar-unit--pad {
  visibility: hidden;
  pointer-events: none;
  min-height: 52px;
  background: transparent;
  border-color: transparent;
}

.calendar-unit-primary {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.calendar-unit-secondary {
  font-size: 11px;
  color: var(--calendar-unit-secondary);
  line-height: 1.2;
}

.calendar-unit--today {
  box-shadow: inset 0 0 0 2px var(--calendar-accent);
}

.calendar-block[data-calendar-mode="day"] .calendar-unit {
  min-width: 0;
  width: 100%;
  height: 100%;
  min-height: 64px;
  align-items: stretch;
}

.calendar-block[data-calendar-mode="day"] .calendar-unit-primary {
  text-align: left;
}

.calendar-unit-note--period {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
}

.calendar-unit-note--period-content {
  width: 100%;
  margin-top: 4px;
}

.calendar-unit-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
}

.calendar-unit-period-stack {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 3px;
  width: 100%;
  flex: 0 0 auto;
  margin-top: auto;
  padding-top: 6px;
}

.calendar-unit-period-bar-wrap {
  width: 100%;
  cursor: pointer;
  height: 18px;
  display: flex;
  align-items: flex-end;
  overflow: visible;
}

.calendar-unit-period-bar-wrap--labeled {
  min-height: 18px;
}

.calendar-unit-period-bar-line {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: 100%;
  min-height: 18px;
}

.calendar-unit-period-bar-line--labeled {
  gap: 2px;
}

.calendar-unit-event-points {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  margin-top: 6px;
}

.calendar-unit-event-point-row {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  cursor: pointer;
}

.calendar-unit-event-point {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--calendar-accent);
  border: 1px solid color-mix(in srgb, var(--calendar-accent) 45%, #fff);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--calendar-accent) 30%, transparent);
  flex-shrink: 0;
}

.calendar-unit-event-point--allday {
  background: color-mix(in srgb, var(--calendar-accent) 35%, #fff);
}

.calendar-unit-event-time {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--calendar-unit-secondary);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-hover-tooltip {
  position: fixed;
  z-index: 1100;
  pointer-events: none;
  max-width: min(320px, calc(100vw - 16px));
  padding: 6px 10px;
  border-radius: 8px;
  background: #0f172a;
  color: #f8fafc;
  font-size: 12px;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.28);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.calendar-hover-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.calendar-unit-period-bar {
  display: flex;
  align-items: center;
  height: 6px;
  width: calc(100% + 20px + 6px);
  margin: 0;
  margin-left: -10px;
  background: var(--period-color, var(--calendar-accent));
  border-radius: 0;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--period-color, var(--calendar-accent)) 35%, transparent);
  flex-shrink: 0;
  overflow: hidden;
}

.calendar-unit-period-bar-label {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: var(--calendar-unit-secondary);
}

.calendar-unit-period-bar--start {
  width: calc(100% + 10px + 6px);
  margin-left: 0;
  border-radius: 4px 0 0 4px;
}

.calendar-unit-period-bar--end {
  width: calc(100% + 10px + 6px);
  margin-left: -10px;
  border-radius: 0 4px 4px 0;
}

.calendar-unit-period-bar--middle {
  border-radius: 0;
}

.calendar-unit-note + .calendar-unit-note {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid color-mix(in srgb, var(--calendar-unit-border) 80%, transparent);
}

.calendar-block[data-calendar-mode="week"] .calendar-unit {
  min-width: 150px;
}

.calendar-block[data-calendar-mode="week"] .calendar-unit--day {
  min-width: 0;
  width: 100%;
  height: 100%;
  min-height: 64px;
  align-items: stretch;
}

.calendar-block[data-calendar-mode="week"] .calendar-unit-primary {
  text-align: left;
}

.calendar-week-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.calendar-week-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 2px 4px 4px;
}

.calendar-week-header--editable {
  cursor: pointer;
}

.calendar-week-header--editable:hover {
  filter: brightness(0.97);
}

.calendar-week-header--has-note {
  font-weight: 600;
}

.calendar-week-header .calendar-unit-note {
  margin-top: 0;
  width: auto;
  flex: 1 1 100%;
}

.calendar-block[data-calendar-mode="month"] .calendar-unit {
  min-width: 0;
  width: 100%;
  align-items: stretch;
}

.calendar-month-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.calendar-month-row {
  width: 100%;
  min-width: 0;
  align-items: stretch;
}

.calendar-month-row-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.calendar-month-notes {
  width: 100%;
  margin-bottom: 6px;
}

.calendar-month-notes .calendar-unit-note {
  margin-top: 0;
}

.calendar-month-events {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
}

.calendar-month-event {
  display: grid;
  grid-template-columns: minmax(84px, auto) minmax(96px, auto) minmax(0, 1fr);
  gap: 8px 12px;
  align-items: baseline;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.3;
}

.calendar-month-event--editable {
  cursor: pointer;
}

.calendar-month-event--editable:hover {
  background: color-mix(in srgb, var(--calendar-unit-border) 40%, transparent);
}

.calendar-month-event-date {
  font-weight: 700;
  color: var(--calendar-unit-secondary);
  white-space: nowrap;
}

.calendar-month-event-time {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--calendar-unit-secondary);
  white-space: nowrap;
}

.calendar-month-event-title {
  min-width: 0;
  word-break: break-word;
  color: var(--calendar-unit-text);
}

.calendar-month-event-empty {
  opacity: 0.45;
}

.calendar-block[data-calendar-mode="year"] .calendar-unit {
  min-width: 72px;
  align-items: center;
}

.calendar-unit--editable {
  cursor: pointer;
}

.calendar-unit--editable:hover {
  filter: brightness(0.97);
}

.calendar-unit--drop,
.calendar-week-header--drop,
.calendar-unit--paste-target,
.calendar-week-header--paste-target {
  outline: 2px dashed #38bdf8;
  outline-offset: -2px;
}

.calendar-unit--has-note {
  filter: saturate(1.15);
  font-weight: 600;
}

.calendar-unit-note {
  margin-top: 6px;
  width: 100%;
}

.calendar-unit-allday {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--calendar-accent);
  border: 2px solid color-mix(in srgb, var(--calendar-accent) 55%, #fff);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--calendar-accent) 35%, transparent);
  margin-bottom: 4px;
  vertical-align: middle;
  flex-shrink: 0;
}

.calendar-unit-note--allday {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px;
}

.calendar-unit-note--allday .calendar-unit-allday {
  margin-top: 2px;
  margin-bottom: 0;
}

.calendar-unit-note--allday .calendar-unit-text,
.calendar-unit-note--allday .calendar-unit-image {
  flex: 1 1 calc(100% - 20px);
  min-width: 0;
}

.calendar-unit-time {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--calendar-unit-secondary);
  margin-bottom: 4px;
}

.calendar-unit-time-start,
.calendar-unit-time-stop {
  display: inline-block;
  white-space: nowrap;
}

.calendar-unit-time-stop {
  opacity: 0.85;
}

.calendar-unit-text {
  font-size: 11px;
  font-weight: 500;
  color: var(--calendar-unit-text);
  line-height: 1.25;
  white-space: normal;
  word-break: break-word;
}

.calendar-unit-text > :first-child { margin-top: 0; }
.calendar-unit-text > :last-child { margin-bottom: 0; }
.calendar-unit-text p,
.calendar-unit-text ul,
.calendar-unit-text ol {
  margin: 0 0 4px;
}
.calendar-unit-text code {
  font-size: 10px;
}
.calendar-unit-text a {
  color: inherit;
  text-decoration: underline;
}

.calendar-unit-image {
  display: block;
  width: 100%;
  max-height: 72px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 4px;
}

.calendar-unit-thumbs {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin: 4px 0 2px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

.calendar-unit-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 5px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  pointer-events: auto;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-drag: none;
}

.calendar-unit-thumbs:hover .calendar-unit-thumb {
  outline: 2px solid var(--calendar-accent, #2563eb);
  outline-offset: 1px;
}

.calendar-unit[data-calendar-day-gallery],
.calendar-week-header[data-calendar-day-gallery],
.calendar-month-event[data-calendar-day-gallery] {
  cursor: pointer;
}

.calendar-unit[data-calendar-day-gallery]:hover,
.calendar-week-header[data-calendar-day-gallery]:hover {
  filter: brightness(0.97);
}

.calendar-unit-thumbs-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 4px;
  border-radius: 5px;
  background: rgba(15, 23, 42, 0.08);
  color: var(--calendar-unit-secondary, #64748b);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  pointer-events: auto;
}

@media (max-width: 768px) {
  .calendar-block[data-calendar-mode="day"] .calendar-unit,
  .calendar-block[data-calendar-mode="week"] .calendar-unit--day {
    padding: 6px 4px;
  }

  .calendar-unit-thumbs {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 3px;
    margin: 6px 0 0;
    width: 100%;
  }

  .calendar-unit-thumb {
    width: 100%;
    min-width: 0;
    height: 40px;
    min-height: 40px;
  }

  .calendar-unit-thumbs-more {
    width: 28px;
    min-width: 28px;
    height: 40px;
  }
}

.calendar-note-modal--drop .modal-content {
  outline: 2px dashed #38bdf8;
  outline-offset: -4px;
}

.calendar-note-preview {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.calendar-note-preview-item {
  position: relative;
  width: calc(50% - 4px);
  max-width: 160px;
}

.calendar-note-preview-img {
  max-width: 100%;
  max-height: 160px;
  border-radius: 8px;
  object-fit: contain;
  background: #0f172a;
}

.calendar-note-preview-item .calendar-note-preview-img {
  width: 100%;
  height: 96px;
  object-fit: cover;
}

.calendar-note-image-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 28px;
  height: 28px;
  padding: 0;
  line-height: 1;
}

.gantt-block {
  --gantt-bg: #fff;
  --gantt-border: #cbd5e1;
  --gantt-title: #0f172a;
  --gantt-meta: #64748b;
  --gantt-track: #f1f5f9;
  --gantt-label: #334155;
  --gantt-dates: #64748b;
  --gantt-accent: #2563eb;
  border: 1px solid var(--gantt-border);
  border-left: 4px solid var(--gantt-accent);
  background: var(--gantt-bg);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 16px 0;
  color: var(--gantt-title);
  overflow-x: auto;
}

.gantt-block--error {
  --gantt-bg: #fef2f2;
  --gantt-border: #fecaca;
  --gantt-title: #991b1b;
  --gantt-accent: #dc2626;
}

.gantt-block--info {
  --gantt-bg: #eff6ff;
  --gantt-border: #bfdbfe;
  --gantt-title: #1d4ed8;
  --gantt-meta: #3b82f6;
  --gantt-track: #dbeafe;
  --gantt-label: #1e3a8a;
  --gantt-dates: #3b82f6;
  --gantt-accent: #2563eb;
}

.gantt-block--success {
  --gantt-bg: #f0fdf4;
  --gantt-border: #bbf7d0;
  --gantt-title: #15803d;
  --gantt-meta: #16a34a;
  --gantt-track: #dcfce7;
  --gantt-label: #14532d;
  --gantt-dates: #16a34a;
  --gantt-accent: #16a34a;
}

.gantt-block--warning {
  --gantt-bg: #fffbeb;
  --gantt-border: #fde68a;
  --gantt-title: #b45309;
  --gantt-meta: #d97706;
  --gantt-track: #fef3c7;
  --gantt-label: #78350f;
  --gantt-dates: #d97706;
  --gantt-accent: #d97706;
}

.gantt-block--danger {
  --gantt-bg: #fef2f2;
  --gantt-border: #fecaca;
  --gantt-title: #b91c1c;
  --gantt-meta: #dc2626;
  --gantt-track: #fee2e2;
  --gantt-label: #7f1d1d;
  --gantt-dates: #dc2626;
  --gantt-accent: #dc2626;
}

.gantt-block--note {
  --gantt-bg: #f8fafc;
  --gantt-border: #e2e8f0;
  --gantt-title: #475569;
  --gantt-meta: #64748b;
  --gantt-track: #e2e8f0;
  --gantt-label: #0f172a;
  --gantt-dates: #64748b;
  --gantt-accent: #64748b;
}

.gantt-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.gantt-block-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--gantt-title);
}

.gantt-block-title--editable {
  cursor: pointer;
  border-radius: 6px;
  padding: 2px 4px;
  margin: -2px -4px;
}

.gantt-block-title--editable:hover {
  background: color-mix(in srgb, var(--gantt-track) 70%, transparent);
}

.gantt-block-meta {
  font-size: 12px;
  color: var(--gantt-meta);
  text-transform: lowercase;
}

.gantt-scale {
  position: relative;
  height: 22px;
  margin: 0 0 8px 140px;
  min-width: 280px;
}

.gantt-scale-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  overflow: hidden;
  border-left: 1px solid color-mix(in srgb, var(--gantt-border) 70%, transparent);
  font-size: 10px;
  color: var(--gantt-meta);
  line-height: 22px;
  padding-left: 4px;
  white-space: nowrap;
}

.gantt-scale-tick--day {
  width: 0;
  border-left: none;
  transform: translateX(-50%);
  padding-left: 0;
  text-align: center;
}

.gantt-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 420px;
}

.gantt-empty {
  font-size: 13px;
  color: var(--gantt-meta);
  padding: 8px 0;
}

.gantt-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  grid-template-rows: auto auto;
  gap: 4px 10px;
  align-items: center;
}

.gantt-row-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.gantt-row-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--gantt-label);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gantt-row-dates {
  font-size: 11px;
  color: var(--gantt-dates);
}

.gantt-row-track {
  position: relative;
  height: 22px;
  border-radius: 8px;
  background: var(--gantt-track);
  overflow: hidden;
}

.gantt-bar {
  position: absolute;
  top: 3px;
  bottom: 3px;
  border-radius: 6px;
  min-width: 6px;
  opacity: 0.92;
}

.gantt-task-note {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--gantt-label);
  line-height: 1.35;
  padding: 0 2px 2px;
}

.gantt-task-text > :first-child { margin-top: 0; }
.gantt-task-text > :last-child { margin-bottom: 0; }
.gantt-task-text p,
.gantt-task-text ul,
.gantt-task-text ol {
  margin: 0 0 4px;
}
.gantt-task-text a {
  color: inherit;
  text-decoration: underline;
}

.gantt-task-image {
  display: block;
  max-width: 160px;
  max-height: 72px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 4px;
}

.gantt-row--editable {
  cursor: pointer;
  border-radius: 8px;
  padding: 4px 2px;
  margin: 0 -2px;
}

.gantt-row--editable:hover {
  background: color-mix(in srgb, var(--gantt-track) 55%, transparent);
}

.gantt-row--has-note .gantt-row-name {
  font-weight: 700;
}

.kanban-block {
  --kanban-bg: #fff;
  --kanban-border: #cbd5e1;
  --kanban-title: #0f172a;
  --kanban-meta: #64748b;
  --kanban-column-bg: #f1f5f9;
  --kanban-column-title: #334155;
  --kanban-card-bg: #fff;
  --kanban-card-border: #e2e8f0;
  --kanban-accent: #2563eb;
  border: 1px solid var(--kanban-border);
  border-left: 4px solid var(--kanban-accent);
  background: var(--kanban-bg);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 16px 0;
  color: var(--kanban-title);
  overflow-x: auto;
}

.kanban-block--info {
  --kanban-bg: #eff6ff;
  --kanban-border: #bfdbfe;
  --kanban-title: #1d4ed8;
  --kanban-meta: #3b82f6;
  --kanban-column-bg: #dbeafe;
  --kanban-column-title: #1e3a8a;
  --kanban-accent: #2563eb;
}

.kanban-block--success {
  --kanban-bg: #f0fdf4;
  --kanban-border: #bbf7d0;
  --kanban-title: #15803d;
  --kanban-meta: #16a34a;
  --kanban-column-bg: #dcfce7;
  --kanban-column-title: #14532d;
  --kanban-accent: #16a34a;
}

.kanban-block--warning {
  --kanban-bg: #fffbeb;
  --kanban-border: #fde68a;
  --kanban-title: #b45309;
  --kanban-meta: #d97706;
  --kanban-column-bg: #fef3c7;
  --kanban-column-title: #78350f;
  --kanban-accent: #d97706;
}

.kanban-block--danger {
  --kanban-bg: #fef2f2;
  --kanban-border: #fecaca;
  --kanban-title: #b91c1c;
  --kanban-meta: #dc2626;
  --kanban-column-bg: #fee2e2;
  --kanban-column-title: #7f1d1d;
  --kanban-accent: #dc2626;
}

.kanban-block--note {
  --kanban-bg: #f8fafc;
  --kanban-border: #e2e8f0;
  --kanban-title: #475569;
  --kanban-meta: #64748b;
  --kanban-column-bg: #e2e8f0;
  --kanban-column-title: #0f172a;
  --kanban-accent: #64748b;
}

.kanban-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.kanban-block-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--kanban-title);
}

.kanban-block-title--editable {
  cursor: pointer;
  border-radius: 6px;
  padding: 2px 4px;
  margin: -2px -4px;
}

.kanban-block-title--editable:hover {
  background: color-mix(in srgb, var(--kanban-column-bg) 70%, transparent);
}

.kanban-block-meta {
  font-size: 12px;
  color: var(--kanban-meta);
  text-transform: lowercase;
}

.kanban-board {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-width: min-content;
}

.kanban-column {
  flex: 1 1 180px;
  min-width: 160px;
  max-width: 280px;
  background: var(--kanban-column-bg);
  border-radius: 12px;
  padding: 10px;
  min-height: 120px;
  transition: box-shadow 0.15s ease, outline-color 0.15s ease;
}

.kanban-column--drop-target {
  outline: 2px dashed var(--kanban-accent);
  outline-offset: 2px;
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  padding: 0 2px;
}

.kanban-column-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--kanban-column-title);
}

.kanban-column-header-end {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.kanban-column-count {
  font-size: 11px;
  color: var(--kanban-meta);
  background: color-mix(in srgb, #fff 70%, transparent);
  border-radius: 999px;
  padding: 1px 7px;
}

.kanban-column-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px dashed color-mix(in srgb, var(--kanban-border) 85%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, #fff 55%, transparent);
  color: var(--kanban-meta);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.kanban-column-add:hover {
  background: #fff;
  border-color: var(--kanban-accent);
  color: var(--kanban-accent);
}

.kanban-column-add:focus-visible {
  outline: 2px solid var(--kanban-accent);
  outline-offset: 2px;
}

.kanban-column-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 48px;
}

.kanban-column-empty {
  font-size: 12px;
  color: var(--kanban-meta);
  padding: 12px 6px;
  text-align: center;
  border: 1px dashed color-mix(in srgb, var(--kanban-border) 80%, transparent);
  border-radius: 8px;
}

.kanban-card {
  background: var(--kanban-card-bg);
  border: 1px solid var(--kanban-card-border);
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  color: #0f172a;
  user-select: none;
}

.kanban-card--editable,
.kanban-card--draggable {
  cursor: grab;
}

.kanban-card--editable:active,
.kanban-card--draggable:active {
  cursor: grabbing;
}

.kanban-card--dragging {
  opacity: 0.45;
}

.kanban-card--drop-before {
  box-shadow: 0 -3px 0 0 var(--kanban-accent);
}

.kanban-card-label {
  font-size: 13px;
  font-weight: 650;
  line-height: 1.3;
}

.kanban-card-text {
  margin-top: 6px;
  font-size: 12px;
  color: #475569;
  line-height: 1.35;
}

.kanban-card-label del,
.kanban-card-label s,
.kanban-card-text del,
.kanban-card-text s,
.kg-card-label del,
.kg-card-label s,
.kg-card-text del,
.kg-card-text s {
  text-decoration: line-through;
}

.kanban-card-text > :first-child { margin-top: 0; }
.kanban-card-text > :last-child { margin-bottom: 0; }
.kanban-card-text p,
.kanban-card-text ul,
.kanban-card-text ol {
  margin: 0 0 4px;
}

.kanban-card-image {
  display: block;
  width: 100%;
  max-height: 96px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 6px;
  pointer-events: none;
}

.checklist-block {
  --checklist-bg: #fff;
  --checklist-border: #cbd5e1;
  --checklist-title: #0f172a;
  --checklist-meta: #64748b;
  --checklist-row: #f8fafc;
  --checklist-accent: #2563eb;
  border: 1px solid var(--checklist-border);
  border-left: 4px solid var(--checklist-accent);
  background: var(--checklist-bg);
  border-radius: 14px;
  padding: 14px 16px 12px;
  margin: 16px 0;
  color: var(--checklist-title);
}

.checklist-block--info {
  --checklist-bg: #eff6ff;
  --checklist-border: #bfdbfe;
  --checklist-title: #1d4ed8;
  --checklist-meta: #3b82f6;
  --checklist-row: #dbeafe;
  --checklist-accent: #2563eb;
}

.checklist-block--success {
  --checklist-bg: #f0fdf4;
  --checklist-border: #bbf7d0;
  --checklist-title: #15803d;
  --checklist-meta: #16a34a;
  --checklist-row: #dcfce7;
  --checklist-accent: #16a34a;
}

.checklist-block--warning {
  --checklist-bg: #fffbeb;
  --checklist-border: #fde68a;
  --checklist-title: #b45309;
  --checklist-meta: #d97706;
  --checklist-row: #fef3c7;
  --checklist-accent: #d97706;
}

.checklist-block--danger {
  --checklist-bg: #fef2f2;
  --checklist-border: #fecaca;
  --checklist-title: #b91c1c;
  --checklist-meta: #ef4444;
  --checklist-row: #fee2e2;
  --checklist-accent: #dc2626;
}

.checklist-block--note {
  --checklist-bg: #f8fafc;
  --checklist-border: #cbd5e1;
  --checklist-title: #334155;
  --checklist-meta: #64748b;
  --checklist-row: #e2e8f0;
  --checklist-accent: #64748b;
}

.checklist-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.checklist-block-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--checklist-title);
  min-width: 0;
  outline: none;
}

.checklist-block-title--editable {
  cursor: text;
  border-radius: 6px;
  padding: 2px 4px;
  margin: -2px -4px;
}

.checklist-block-title--editable:hover,
.checklist-block-title--editable:focus {
  background: color-mix(in srgb, var(--checklist-row) 70%, transparent);
}

.checklist-block-meta {
  font-size: 12px;
  color: var(--checklist-meta);
  white-space: nowrap;
}

.checklist-align {
  display: inline-flex;
  border: 1px solid var(--checklist-border);
  border-radius: 999px;
  overflow: hidden;
  flex-shrink: 0;
}

.checklist-align-btn {
  border: 0;
  background: transparent;
  color: var(--checklist-meta);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  cursor: pointer;
}

.checklist-align-btn.is-active {
  background: var(--checklist-accent);
  color: #fff;
}

.checklist-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 32px;
  padding: 4px 8px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--checklist-row) 65%, transparent);
}

.checklist-drag {
  order: -1;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  margin-top: 0.2rem;
  color: var(--checklist-meta);
  cursor: grab;
  user-select: none;
  font-size: 14px;
  line-height: 1;
  opacity: 0.7;
}

.checklist-drag:hover {
  opacity: 1;
  color: var(--checklist-title);
}

.checklist-drag:active,
.checklist-item--dragging .checklist-drag {
  cursor: grabbing;
}

.checklist-item--dragging {
  opacity: 0.45;
}

.checklist-item--drop-before {
  box-shadow: inset 0 2px 0 var(--checklist-accent);
}

.checklist-item--drop-after {
  box-shadow: inset 0 -2px 0 var(--checklist-accent);
}

.checklist-check {
  order: 0;
  flex-shrink: 0;
  width: 1.1rem;
  height: 1.1rem;
  margin: 0.25rem 0 0;
  accent-color: var(--checklist-accent);
  cursor: pointer;
}

.checklist-text-view {
  order: 1;
  flex: 1;
  min-width: 0;
  font-size: 14px;
  line-height: 1.45;
  padding: 2px 0;
  cursor: text;
  overflow-wrap: anywhere;
}

.checklist-text-view p,
.checklist-text-view ul,
.checklist-text-view ol {
  margin: 0;
}

.checklist-text-view a {
  color: var(--checklist-accent);
  text-decoration: underline;
}

.checklist-text-placeholder {
  color: var(--checklist-meta);
}

textarea.checklist-text {
  display: none;
  order: 1;
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 1.6rem;
  resize: none;
  overflow: hidden;
  border: 0;
  background: transparent;
  outline: none;
  color: inherit;
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
  padding: 2px 0;
}

.checklist-item.is-editing textarea.checklist-text {
  display: block;
}

.checklist-item.is-editing .checklist-text-view {
  display: none;
}

.checklist-recover {
  order: 2;
  flex-shrink: 0;
  margin-top: 0.1rem;
  border: 1px solid var(--checklist-border);
  background: var(--checklist-bg);
  color: var(--checklist-meta);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
}

.checklist-recover:hover {
  border-color: var(--checklist-accent);
  color: var(--checklist-title);
}

.checklist-delete {
  order: 3;
  flex-shrink: 0;
  margin-top: 0.05rem;
  width: 1.6rem;
  height: 1.6rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--checklist-meta);
  cursor: pointer;
  line-height: 1;
}

.checklist-delete:hover {
  background: color-mix(in srgb, var(--checklist-accent) 16%, transparent);
  color: var(--checklist-title);
}

.checklist-block--align-right .checklist-drag { order: -1; }
.checklist-block--align-right .checklist-text-view,
.checklist-block--align-right textarea.checklist-text { order: 0; }
.checklist-block--align-right .checklist-check { order: 1; }
.checklist-block--align-right .checklist-recover { order: 2; }
.checklist-block--align-right .checklist-delete { order: 3; }

.checklist-item.is-checked .checklist-text-view,
.checklist-item.is-checked textarea.checklist-text {
  text-decoration: line-through;
  opacity: 0.65;
}

.checklist-item.is-checked .checklist-text-view a {
  opacity: 1;
}

.checklist-empty {
  font-size: 13px;
  color: var(--checklist-meta);
  padding: 8px 4px;
}

.checklist-add {
  margin-top: 8px;
  border: 0;
  background: transparent;
  color: var(--checklist-accent);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 2px;
  cursor: pointer;
}

.checklist-add:hover {
  text-decoration: underline;
}

.checklist-check:disabled {
  cursor: default;
}

.form-widget {
  --form-widget-bg: #fff;
  --form-widget-border: #cbd5e1;
  --form-widget-title: #0f172a;
  --form-widget-meta: #64748b;
  --form-widget-row: #f8fafc;
  --form-widget-accent: #2563eb;
  border: 1px solid var(--form-widget-border);
  border-left: 4px solid var(--form-widget-accent);
  background: var(--form-widget-bg);
  border-radius: 14px;
  padding: 14px 16px 12px;
  margin: 16px 0;
  color: var(--form-widget-title);
}

.form-widget--info {
  --form-widget-bg: #eff6ff;
  --form-widget-border: #bfdbfe;
  --form-widget-title: #1d4ed8;
  --form-widget-meta: #3b82f6;
  --form-widget-row: #dbeafe;
  --form-widget-accent: #2563eb;
}

.form-widget--success {
  --form-widget-bg: #f0fdf4;
  --form-widget-border: #bbf7d0;
  --form-widget-title: #15803d;
  --form-widget-meta: #16a34a;
  --form-widget-row: #dcfce7;
  --form-widget-accent: #16a34a;
}

.form-widget--warning {
  --form-widget-bg: #fffbeb;
  --form-widget-border: #fde68a;
  --form-widget-title: #b45309;
  --form-widget-meta: #d97706;
  --form-widget-row: #fef3c7;
  --form-widget-accent: #d97706;
}

.form-widget--danger {
  --form-widget-bg: #fef2f2;
  --form-widget-border: #fecaca;
  --form-widget-title: #b91c1c;
  --form-widget-meta: #ef4444;
  --form-widget-row: #fee2e2;
  --form-widget-accent: #dc2626;
}

.form-widget--note {
  --form-widget-bg: #f8fafc;
  --form-widget-border: #cbd5e1;
  --form-widget-title: #334155;
  --form-widget-meta: #64748b;
  --form-widget-row: #e2e8f0;
  --form-widget-accent: #64748b;
}

.form-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.form-widget-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.form-widget-settings-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--form-widget-border);
  border-radius: 8px;
  background: color-mix(in srgb, #fff 70%, transparent);
  color: var(--form-widget-title);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.form-widget-settings-btn.is-open,
.form-widget-settings-btn:hover {
  background: color-mix(in srgb, var(--form-widget-accent) 16%, transparent);
  border-color: var(--form-widget-accent);
}

.form-widget-title {
  font-size: 15px;
  font-weight: 700;
  min-width: 0;
  outline: none;
}

.form-widget-title--editable {
  cursor: text;
  border-radius: 6px;
  padding: 2px 4px;
  margin: -2px -4px;
}

.form-widget-title--editable:hover,
.form-widget-title--editable:focus {
  background: color-mix(in srgb, var(--form-widget-row) 70%, transparent);
}

.form-widget-meta {
  font-size: 12px;
  color: var(--form-widget-meta);
  white-space: nowrap;
}

.form-widget-field {
  width: 100%;
  border: 1px solid var(--form-widget-border);
  border-radius: 8px;
  background: color-mix(in srgb, #fff 70%, transparent);
  color: inherit;
  font: inherit;
  font-size: 14px;
  padding: 8px 10px;
}

.form-widget-textarea {
  min-height: 6rem;
  resize: vertical;
}

.form-widget-select,
.form-widget-number {
  max-width: 20rem;
}

.form-widget-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}

.form-widget-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 4px 8px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--form-widget-row) 65%, transparent);
}

.form-widget-option.is-selected {
  outline: 1px solid color-mix(in srgb, var(--form-widget-accent) 45%, transparent);
}

.form-widget-choice {
  flex-shrink: 0;
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  accent-color: var(--form-widget-accent);
  cursor: pointer;
}

.form-widget-option-text {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  color: inherit;
  font: inherit;
  font-size: 14px;
}

.form-widget-vote-count {
  flex-shrink: 0;
  min-width: 1.4rem;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--form-widget-accent);
}

.form-widget-voters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 40%;
}

.form-widget-voter {
  font-size: 11px;
  line-height: 1.2;
  padding: 1px 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--form-widget-accent) 16%, transparent);
  color: var(--form-widget-title);
}

.form-widget-delete {
  flex-shrink: 0;
  width: 1.6rem;
  height: 1.6rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--form-widget-meta);
  cursor: pointer;
  line-height: 1;
}

.form-widget-delete:hover {
  background: color-mix(in srgb, var(--form-widget-accent) 16%, transparent);
  color: var(--form-widget-title);
}

.form-widget-empty {
  font-size: 13px;
  color: var(--form-widget-meta);
  padding: 8px 4px;
}

.form-widget-add {
  margin-top: 8px;
  border: 0;
  background: transparent;
  color: var(--form-widget-accent);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 2px;
  cursor: pointer;
}

.form-widget-add:hover {
  text-decoration: underline;
}

.form-widget-guest-email {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 650;
  color: var(--form-widget-title);
}

.form-widget-email {
  flex: 1;
  min-width: 0;
  padding: 4px 8px;
  border: 1px solid var(--form-widget-border);
  border-radius: 8px;
  background: var(--form-widget-bg);
  color: var(--form-widget-title);
  font: inherit;
  font-weight: 600;
}

.form-widget-vote-foot {
  margin-top: 8px;
  font-size: 12px;
  color: var(--form-widget-meta);
}

.form-widget--enum .form-widget-option .form-widget-choice {
  display: none;
}

.form-widget--radio .form-widget-option-edit,
.form-widget--radio .form-widget-delete,
.form-widget--radio > .form-widget-add,
.form-widget--enum .form-widget-options,
.form-widget--enum > .form-widget-add {
  display: none;
}

.form-widget--radio.form-widget--settings-open .form-widget-option-label {
  display: none;
}

.form-widget--radio.form-widget--settings-open .form-widget-option-edit {
  display: block;
  flex: 1;
  min-width: 0;
}

.form-widget--radio.form-widget--settings-open .form-widget-delete,
.form-widget--radio.form-widget--settings-open > .form-widget-add {
  display: inline-flex;
  align-items: center;
}

.form-widget--enum.form-widget--settings-open .form-widget-options {
  display: flex;
}

.form-widget--enum.form-widget--settings-open > .form-widget-add {
  display: inline-block;
}

.form-widget--enum .form-widget-option-label {
  display: none;
}

.form-widget-choice:disabled {
  cursor: default;
}

/* --- Kanban Gantt (time + cost) --- */
.kg-block {
  --kg-bg: #fff;
  --kg-border: #cbd5e1;
  --kg-title: #0f172a;
  --kg-meta: #64748b;
  --kg-column-bg: #f1f5f9;
  --kg-column-title: #334155;
  --kg-card-bg: #fff;
  --kg-card-border: #e2e8f0;
  --kg-accent: #0d9488;
  border: 1px solid var(--kg-border);
  border-left: 4px solid var(--kg-accent);
  background: var(--kg-bg);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 16px 0;
  color: var(--kg-title);
  overflow-x: hidden;
}

.kg-block--info {
  --kg-bg: #eff6ff;
  --kg-border: #bfdbfe;
  --kg-title: #1d4ed8;
  --kg-meta: #3b82f6;
  --kg-column-bg: #dbeafe;
  --kg-column-title: #1e3a8a;
  --kg-accent: #2563eb;
}

.kg-block--success {
  --kg-bg: #f0fdf4;
  --kg-border: #bbf7d0;
  --kg-title: #15803d;
  --kg-meta: #16a34a;
  --kg-column-bg: #dcfce7;
  --kg-column-title: #14532d;
  --kg-accent: #16a34a;
}

.kg-block--warning {
  --kg-bg: #fffbeb;
  --kg-border: #fde68a;
  --kg-title: #b45309;
  --kg-meta: #d97706;
  --kg-column-bg: #fef3c7;
  --kg-column-title: #78350f;
  --kg-accent: #d97706;
}

.kg-block--danger {
  --kg-bg: #fef2f2;
  --kg-border: #fecaca;
  --kg-title: #b91c1c;
  --kg-meta: #dc2626;
  --kg-column-bg: #fee2e2;
  --kg-column-title: #7f1d1d;
  --kg-accent: #dc2626;
}

.kg-block--note {
  --kg-bg: #f8fafc;
  --kg-border: #e2e8f0;
  --kg-title: #475569;
  --kg-meta: #64748b;
  --kg-column-bg: #e2e8f0;
  --kg-column-title: #0f172a;
  --kg-accent: #64748b;
}

.kg-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.kg-block-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--kg-title);
}

.kg-block-title--editable {
  cursor: pointer;
  border-radius: 6px;
  padding: 2px 4px;
  margin: -2px -4px;
}

.kg-block-title--editable:hover {
  background: color-mix(in srgb, var(--kg-column-bg) 70%, transparent);
}

.kg-block-meta {
  font-size: 12px;
  color: var(--kg-meta);
}

.kg-block-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--kg-border);
  font-size: 13px;
  color: var(--kg-title);
}

.kg-board {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: stretch;
}

.kg-column {
  /* Grow to fill row; wrap to next row when less than ~200px each */
  flex: 1 1 200px;
  min-width: min(200px, 100%);
  max-width: 100%;
  background: var(--kg-column-bg);
  border-radius: 10px;
  padding: 10px;
  box-sizing: border-box;
}

.kg-column--drop-target {
  outline: 2px dashed var(--kg-accent);
  outline-offset: 2px;
}

.kg-column--suspended {
  --kg-column-bg: #fef3c7;
  --kg-column-title: #92400e;
}

.kg-column--suspended .kg-column-cost {
  color: #b45309;
}

.kg-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  gap: 8px;
}

.kg-column-header-end {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.kg-column-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px dashed color-mix(in srgb, var(--kg-border) 85%, transparent);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--kg-meta);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.kg-column-add:hover {
  background: #fff;
  border-color: var(--kg-accent);
  color: var(--kg-accent);
}

.kg-column-add:focus-visible {
  outline: 2px solid var(--kg-accent);
  outline-offset: 2px;
}

.kg-column-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--kg-column-title);
}

.kg-column-count {
  font-size: 11px;
  color: var(--kg-meta);
  background: rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  padding: 1px 7px;
}

.kg-column-cost {
  font-size: 11px;
  color: var(--kg-meta);
  margin-bottom: 8px;
}

.kg-column-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 40px;
}

.kg-column-empty {
  font-size: 12px;
  color: var(--kg-meta);
  padding: 12px 8px;
  text-align: center;
  border: 1px dashed color-mix(in srgb, var(--kg-border) 80%, transparent);
  border-radius: 8px;
}

.kg-card {
  background: var(--kg-card-bg);
  border: 1px solid var(--kg-card-border);
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  position: relative;
}

.kg-drag-handle {
  display: block;
  width: fit-content;
  margin: -2px 0 6px auto;
  padding: 0 4px;
  font-size: 14px;
  line-height: 1;
  color: #94a3b8;
  cursor: grab;
  user-select: none;
  border-radius: 4px;
}

.kg-drag-handle:hover {
  color: #64748b;
  background: rgba(148, 163, 184, 0.15);
}

.kg-drag-handle:active {
  cursor: grabbing;
}

.kg-card--editable {
  cursor: default;
}

.kg-card--dragging {
  opacity: 0.45;
}

.kg-card--drop-before {
  box-shadow: 0 -3px 0 0 var(--kg-accent);
}

.kg-card--drop-after {
  box-shadow: 0 3px 0 0 var(--kg-accent);
}

.kg-card--running {
  border-color: #14b8a6;
  box-shadow: 0 0 0 1px rgba(20, 184, 166, 0.25);
}

.kg-card--suspended {
  border-color: #f59e0b;
}

.kg-card--stopped {
  border-color: #94a3b8;
}

.kg-card-label {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 4px;
}

.kg-card-status {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 999px;
  padding: 2px 7px;
  margin-bottom: 6px;
  background: #e2e8f0;
  color: #475569;
}

.kg-card-status--running { background: #ccfbf1; color: #0f766e; }
.kg-card-status--suspended { background: #fef3c7; color: #b45309; }
.kg-card-status--stopped { background: #e2e8f0; color: #64748b; }
.kg-card-status--idle { background: #e0e7ff; color: #4338ca; }

.kg-card-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 11px;
  color: #64748b;
  margin-bottom: 6px;
}

.kg-card-times {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  font-size: 11px;
  color: #64748b;
  margin-bottom: 6px;
}

.kg-card-times--multi {
  max-height: 72px;
  overflow: auto;
}

.kg-card-times span {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 2px 6px;
}

.kg-card-sessions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  max-height: 160px;
  overflow: auto;
}

.kg-card-session {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 12px;
  color: #334155;
}

.kg-card-session-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kg-card-session-delete {
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: #b91c1c;
  font-size: 14px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
}

.kg-card-session-delete:hover {
  background: #fee2e2;
}

.kg-time-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  align-items: stretch;
}

.kg-time-cal-day {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  min-height: 64px;
  padding: 6px 4px 4px;
  border-radius: 8px;
  color: #64748b;
  font-size: 11px;
}

.kg-time-cal-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.kg-time-cal-starts {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  margin-top: 4px;
  min-width: 0;
}

.kg-time-cal-start {
  display: grid;
  grid-template-columns: 8px auto minmax(0, 1fr);
  gap: 4px;
  align-items: baseline;
  min-width: 0;
  font-size: 10px;
  line-height: 1.2;
}

.kg-time-cal-start-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--kg-bar-color, #0d9488);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--kg-bar-color, #0d9488) 35%, transparent);
  flex-shrink: 0;
  align-self: center;
}

.kg-time-cal-start-time {
  font-weight: 700;
  color: #0f766e;
  white-space: nowrap;
}

.kg-time-cal-start-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #334155;
}

.kg-time-cal-stack {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 3px;
  width: 100%;
  flex: 0 0 auto;
  margin-top: auto;
  padding-top: 6px;
}

.kg-time-cal-bar-wrap {
  width: 100%;
  min-height: 6px;
  display: flex;
  align-items: flex-end;
  overflow: visible;
}

.kg-time-cal-bar-wrap--labeled {
  min-height: 18px;
}

.kg-time-cal-bar-line {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: 100%;
  min-height: 18px;
}

.kg-time-cal-bar-line--labeled {
  gap: 2px;
}

.kg-time-cal-bar-label {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: #64748b;
}

.kg-time-cal-bar {
  height: 6px;
  width: calc(100% + 8px + 6px);
  margin-left: -4px;
  background: var(--kg-bar-color, #0d9488);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--kg-bar-color, #0d9488) 35%, transparent);
  flex-shrink: 0;
}

.kg-time-cal-bar--single {
  width: calc(100% + 4px);
  margin-left: 0;
  border-radius: 4px;
}

.kg-time-cal-bar--start {
  width: calc(100% + 4px + 6px);
  margin-left: 0;
  border-radius: 4px 0 0 4px;
}

.kg-time-cal-bar--end {
  width: calc(100% + 4px + 6px);
  margin-left: -4px;
  border-radius: 0 4px 4px 0;
}

.kg-time-cal-bar--middle {
  border-radius: 0;
}

.kg-time-cal-day--active {
  background: #ccfbf1;
  color: #0f766e;
  font-weight: 600;
}

.kg-time-cal-day--today {
  outline: 2px solid #0d9488;
  outline-offset: 1px;
}

.kg-time-cal-dow {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 10px;
}

.kg-time-cal-num {
  font-size: 14px;
  font-weight: 700;
}

.kg-card-cost {
  font-weight: 700;
  color: #0f766e;
}

.kg-card-bar {
  height: 5px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}

.kg-card-bar > span {
  display: block;
  height: 100%;
  background: var(--kg-accent);
  border-radius: 999px;
}

.kg-card-text {
  margin-top: 4px;
  font-size: 12px;
  color: #475569;
  line-height: 1.35;
}

.kg-card-label del,
.kg-card-label s,
.kg-card-text del,
.kg-card-text s {
  text-decoration: line-through;
}

.kg-card-text > :first-child { margin-top: 0; }
.kg-card-text > :last-child { margin-bottom: 0; }
.kg-card-text p,
.kg-card-text ul,
.kg-card-text ol {
  margin: 0 0 4px;
}

.kg-card-image {
  display: block;
  width: 100%;
  max-height: 96px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 6px;
  pointer-events: none;
}

.kg-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.kg-action-btn {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  cursor: pointer;
  line-height: 1.2;
}

.kg-action-btn:hover {
  background: #e2e8f0;
}

.kg-action-start {
  border-color: #99f6e4;
  background: #f0fdfa;
  color: #0f766e;
}

.kg-action-suspend {
  border-color: #fde68a;
  background: #fffbeb;
  color: #b45309;
}

.kg-action-stop {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

/* --- Speisekarte (menu card) --- */
.speisekarte-block {
  --speisekarte-bg: #fffaf3;
  --speisekarte-border: #e7d3b0;
  --speisekarte-title: #5c3d1e;
  --speisekarte-meta: #a07848;
  --speisekarte-accent: #b45309;
  --speisekarte-item: #3f2a14;
  --speisekarte-note: #8b6914;
  --speisekarte-price: #9a3412;
  --speisekarte-hover: #fff7ed;
  border: 1px solid var(--speisekarte-border);
  border-left: 4px solid var(--speisekarte-accent);
  background: var(--speisekarte-bg);
  border-radius: 14px;
  padding: 16px 18px 18px;
  margin: 16px 0;
  color: var(--speisekarte-title);
  max-width: 42rem;
}

.speisekarte-block--info {
  --speisekarte-bg: #eff6ff;
  --speisekarte-border: #bfdbfe;
  --speisekarte-title: #1d4ed8;
  --speisekarte-meta: #3b82f6;
  --speisekarte-accent: #2563eb;
  --speisekarte-item: #1e3a8a;
  --speisekarte-note: #3b82f6;
  --speisekarte-price: #1d4ed8;
  --speisekarte-hover: #dbeafe;
}

.speisekarte-block--success {
  --speisekarte-bg: #f0fdf4;
  --speisekarte-border: #bbf7d0;
  --speisekarte-title: #15803d;
  --speisekarte-meta: #16a34a;
  --speisekarte-accent: #16a34a;
  --speisekarte-item: #14532d;
  --speisekarte-note: #15803d;
  --speisekarte-price: #166534;
  --speisekarte-hover: #dcfce7;
}

.speisekarte-block--warning {
  --speisekarte-bg: #fffbeb;
  --speisekarte-border: #fde68a;
  --speisekarte-title: #b45309;
  --speisekarte-meta: #d97706;
  --speisekarte-accent: #d97706;
  --speisekarte-item: #78350f;
  --speisekarte-note: #b45309;
  --speisekarte-price: #9a3412;
  --speisekarte-hover: #fef3c7;
}

.speisekarte-block--danger {
  --speisekarte-bg: #fef2f2;
  --speisekarte-border: #fecaca;
  --speisekarte-title: #b91c1c;
  --speisekarte-meta: #dc2626;
  --speisekarte-accent: #dc2626;
  --speisekarte-item: #7f1d1d;
  --speisekarte-note: #b91c1c;
  --speisekarte-price: #991b1b;
  --speisekarte-hover: #fee2e2;
}

.speisekarte-block--note {
  --speisekarte-bg: #f8fafc;
  --speisekarte-border: #e2e8f0;
  --speisekarte-title: #475569;
  --speisekarte-meta: #64748b;
  --speisekarte-accent: #64748b;
  --speisekarte-item: #0f172a;
  --speisekarte-note: #64748b;
  --speisekarte-price: #334155;
  --speisekarte-hover: #e2e8f0;
}

.speisekarte-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.speisekarte-heading {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.speisekarte-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--speisekarte-title);
}

.speisekarte-meta {
  font-size: 12px;
  color: var(--speisekarte-meta);
}

.speisekarte-settings-btn {
  margin-left: auto;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--speisekarte-border);
  border-radius: 8px;
  background: #fff;
  color: var(--speisekarte-title);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.speisekarte-settings-btn.is-open,
.speisekarte-settings-btn:hover {
  background: var(--speisekarte-hover);
  border-color: var(--speisekarte-accent);
}

.speisekarte-settings[hidden] {
  display: none !important;
}

.speisekarte-settings {
  flex: 1 0 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
  padding: 10px 12px;
  border: 1px dashed color-mix(in srgb, var(--speisekarte-accent) 45%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--speisekarte-hover) 70%, #fff);
}

.speisekarte-settings-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 650;
  color: var(--speisekarte-title);
}

.speisekarte-tables-input {
  width: 4.5rem;
  padding: 4px 8px;
  border: 1px solid var(--speisekarte-border);
  border-radius: 8px;
  background: #fff;
  color: var(--speisekarte-item);
  font: inherit;
  font-weight: 700;
  text-align: center;
}

.speisekarte-archive {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed color-mix(in srgb, var(--speisekarte-accent) 45%, transparent);
}

.speisekarte-archive > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--speisekarte-accent);
}

.speisekarte-archive-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.speisekarte-archive-entry {
  margin: 0;
}

.speisekarte-section + .speisekarte-section {
  margin-top: 16px;
}

.speisekarte-section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--speisekarte-accent);
  margin: 0 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px dashed color-mix(in srgb, var(--speisekarte-accent) 45%, transparent);
}

.speisekarte-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 8px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--speisekarte-item);
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.speisekarte-item:hover,
.speisekarte-item:focus-visible {
  background: var(--speisekarte-hover);
  outline: none;
}

.speisekarte-item:disabled {
  opacity: 0.65;
  cursor: wait;
}

.speisekarte-item-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.speisekarte-item-name {
  font-weight: 650;
}

.speisekarte-item-note {
  font-size: 12px;
  color: var(--speisekarte-note);
}

.speisekarte-item-dots {
  flex: 1 1 auto;
  min-width: 12px;
  border-bottom: 1px dotted color-mix(in srgb, var(--speisekarte-meta) 70%, transparent);
  transform: translateY(-4px);
}

.speisekarte-item-price {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--speisekarte-price);
}

.speisekarte-block--custom {
  background: var(--speisekarte-bg);
}

.speisekarte-empty {
  margin: 0;
  font-size: 13px;
  color: var(--speisekarte-meta);
}

.speisekarte-item.is-sent .speisekarte-item-name::after {
  content: ' ✓';
  color: var(--speisekarte-accent);
  font-weight: 700;
}

.speisekarte-tables {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.speisekarte-block:has(.speisekarte-tables) {
  max-width: 56rem;
}

.speisekarte-table-panel {
  margin: 0;
  cursor: pointer;
  min-width: 0;
}

.speisekarte-table-panel.is-active {
  box-shadow: 0 0 0 2px var(--speisekarte-accent);
}

.speisekarte-table-panel.is-occupied .speisekarte-table-name {
  font-weight: 800;
}

.speisekarte-table-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-right: 12px;
}

.speisekarte-table-name {
  flex: 1 1 auto;
  min-width: 0;
}

.speisekarte-table-count {
  flex: 0 0 auto;
  min-width: 1.25rem;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--speisekarte-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}

.speisekarte-table-panel .speisekarte-bill-clear {
  flex: 0 0 auto;
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}

.speisekarte-table-panel .speisekarte-bill-empty {
  margin-bottom: 6px;
}

.speisekarte-table-panel .speisekarte-bill-lines {
  margin-bottom: 8px;
  min-height: 1.2em;
}

.speisekarte-table-panel .speisekarte-bill-line {
  font-size: 12px;
}

.speisekarte-table-panel .speisekarte-bill-btn {
  padding: 6px 10px;
  font-size: 12px;
}

.speisekarte-bill {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed color-mix(in srgb, var(--speisekarte-accent) 45%, transparent);
}

.speisekarte-bill-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.speisekarte-bill-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--speisekarte-accent);
}

.speisekarte-bill-clear {
  border: 0;
  background: transparent;
  color: var(--speisekarte-meta);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}

.speisekarte-bill-clear:hover {
  color: var(--speisekarte-title);
  text-decoration: underline;
}

.speisekarte-bill-empty {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--speisekarte-meta);
}

.speisekarte-bill-lines {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
}

.speisekarte-bill-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 0;
  font-size: 13px;
  color: var(--speisekarte-item);
}

.speisekarte-bill-name {
  font-weight: 650;
}

.speisekarte-bill-qty {
  margin-left: 4px;
  color: var(--speisekarte-meta);
  font-weight: 700;
}

.speisekarte-bill-note {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12px;
  color: var(--speisekarte-note);
}

.speisekarte-bill-price {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--speisekarte-price);
}

.speisekarte-bill-total {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  font-weight: 700;
  color: var(--speisekarte-title);
}

.speisekarte-bill-sum {
  font-variant-numeric: tabular-nums;
  color: var(--speisekarte-price);
}

.speisekarte-bill-btn {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--speisekarte-accent);
  border-radius: 10px;
  background: var(--speisekarte-accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.speisekarte-bill-btn:hover:not(:disabled) {
  filter: brightness(1.05);
}

.speisekarte-bill-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.speisekarte-bill-btn.is-sending {
  cursor: wait;
}

/* --- Shop --- */
.shop-block {
  --shop-bg: #f8fafc;
  --shop-border: #cbd5e1;
  --shop-title: #0f172a;
  --shop-meta: #64748b;
  --shop-accent: #2563eb;
  --shop-item: #1e293b;
  --shop-note: #64748b;
  --shop-price: #1d4ed8;
  --shop-hover: #eff6ff;
  border: 1px solid var(--shop-border);
  border-left: 4px solid var(--shop-accent);
  background: var(--shop-bg);
  border-radius: 14px;
  padding: 16px 18px 18px;
  margin: 16px 0;
  color: var(--shop-title);
  max-width: 56rem;
}

.shop-block--info {
  --shop-bg: #eff6ff;
  --shop-border: #bfdbfe;
  --shop-title: #1d4ed8;
  --shop-meta: #3b82f6;
  --shop-accent: #2563eb;
  --shop-item: #1e3a8a;
  --shop-note: #3b82f6;
  --shop-price: #1d4ed8;
  --shop-hover: #dbeafe;
}

.shop-block--success {
  --shop-bg: #f0fdf4;
  --shop-border: #bbf7d0;
  --shop-title: #15803d;
  --shop-meta: #16a34a;
  --shop-accent: #16a34a;
  --shop-item: #14532d;
  --shop-note: #15803d;
  --shop-price: #166534;
  --shop-hover: #dcfce7;
}

.shop-block--warning {
  --shop-bg: #fffbeb;
  --shop-border: #fde68a;
  --shop-title: #b45309;
  --shop-meta: #d97706;
  --shop-accent: #d97706;
  --shop-item: #78350f;
  --shop-note: #b45309;
  --shop-price: #9a3412;
  --shop-hover: #fef3c7;
}

.shop-block--danger {
  --shop-bg: #fef2f2;
  --shop-border: #fecaca;
  --shop-title: #b91c1c;
  --shop-meta: #dc2626;
  --shop-accent: #dc2626;
  --shop-item: #7f1d1d;
  --shop-note: #b91c1c;
  --shop-price: #991b1b;
  --shop-hover: #fee2e2;
}

.shop-block--note {
  --shop-bg: #f8fafc;
  --shop-border: #e2e8f0;
  --shop-title: #475569;
  --shop-meta: #64748b;
  --shop-accent: #64748b;
  --shop-item: #0f172a;
  --shop-note: #64748b;
  --shop-price: #334155;
  --shop-hover: #e2e8f0;
}

.shop-block--custom {
  background: var(--shop-bg);
}

.shop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.shop-heading {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.shop-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--shop-title);
}

.shop-meta {
  font-size: 12px;
  color: var(--shop-meta);
}

.shop-merchant-desc {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--shop-item);
}

.shop-extra-info,
.shop-card-info {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--shop-item);
}

.shop-extra-info summary,
.shop-card-info summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--shop-accent);
}

.shop-extra-info p,
.shop-card-info p {
  margin: 6px 0 0;
  white-space: pre-wrap;
}

.shop-card-info {
  margin: 6px 0 0;
}

.shop-merchant-images {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 0 0 10px;
}

.shop-merchant-images img {
  height: 72px;
  width: auto;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--shop-border);
}

.shop-pay-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.shop-pay-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.shop-pay-badge--paypal {
  background: #003087;
  color: #fff;
}

.shop-pay-badge--visa {
  background: #1a1f71;
  color: #fff;
}

.shop-pay-badge--mastercard {
  background: linear-gradient(90deg, #eb001b 0%, #f79e1b 100%);
  color: #fff;
}

.shop-pay-prompt {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed color-mix(in srgb, var(--shop-border) 80%, transparent);
}

.shop-pay-prompt-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--shop-title);
}

.shop-pay-prompt-empty {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--shop-meta);
}

.shop-pay-prompt-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.shop-pay-prompt-btn {
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.shop-pay-prompt-btn--paypal {
  background: #003087;
}

.shop-pay-prompt-btn--visa {
  background: #1a1f71;
}

.shop-pay-prompt-btn--mastercard {
  background: linear-gradient(90deg, #eb001b 0%, #f79e1b 100%);
}

.shop-pay-prompt-btn:hover:not(:disabled) {
  filter: brightness(1.08);
}

.shop-pay-prompt-btn:disabled,
.shop-pay-prompt-btn.is-sending {
  opacity: 0.7;
  cursor: wait;
}

.shop-pay-prompt-cancel {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 6px 12px;
  border: 0;
  background: transparent;
  color: var(--shop-meta);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.shop-pay-prompt-cancel:hover {
  color: var(--shop-title);
}

.shop-pay-konto-to {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--shop-title);
}

.shop-pay-konto-to strong {
  display: block;
  margin-top: 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.02em;
}

.shop-pay-konto-field {
  flex-direction: column;
  align-items: stretch;
  margin: 0 0 8px;
}

.shop-pay-prompt-btn--transfer {
  background: var(--shop-accent);
}

.shop-settings-hint {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--shop-meta);
}

.shop-block--drop {
  outline: 2px dashed var(--shop-accent);
  outline-offset: 2px;
}

.shop-settings-btn {
  margin-left: auto;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--shop-border);
  border-radius: 8px;
  background: #fff;
  color: var(--shop-title);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.shop-settings-btn.is-open,
.shop-settings-btn:hover {
  background: var(--shop-hover);
  border-color: var(--shop-accent);
}

.shop-settings[hidden] {
  display: none !important;
}

.shop-settings {
  flex: 1 0 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
  padding: 10px 12px;
  border: 1px dashed color-mix(in srgb, var(--shop-accent) 45%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--shop-hover) 70%, #fff);
}

.shop-settings-field,
.shop-note-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 650;
  color: var(--shop-title);
}

.shop-note-field {
  margin: 8px 0;
}

.shop-currency-input,
.shop-note-input {
  min-width: 0;
  padding: 4px 8px;
  border: 1px solid var(--shop-border);
  border-radius: 8px;
  background: #fff;
  color: var(--shop-item);
  font: inherit;
  font-weight: 600;
}

.shop-currency-input {
  width: 5.5rem;
  text-align: center;
}

.shop-settings-field--block {
  flex: 1 1 100%;
  flex-direction: column;
  align-items: stretch;
}

.shop-settings-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 650;
  color: var(--shop-title);
}

.shop-address-input {
  width: 100%;
  min-height: 3.2rem;
  resize: vertical;
  padding: 6px 8px;
  border: 1px solid var(--shop-border);
  border-radius: 8px;
  background: #fff;
  color: var(--shop-item);
  font: inherit;
  font-weight: 500;
  line-height: 1.35;
}

.shop-cart-addresses {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--shop-note);
}

.shop-cart-addresses p,
.shop-archive-address {
  margin: 0 0 4px;
}

.shop-cart-addresses span,
.shop-archive-address span {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--shop-accent);
}

.shop-archive-address {
  font-size: 12px;
  color: var(--shop-note);
}

.shop-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 16rem);
  gap: 14px;
  align-items: start;
}

@media (max-width: 720px) {
  .shop-layout {
    grid-template-columns: 1fr;
  }
}

.shop-section + .shop-section {
  margin-top: 16px;
}

.shop-section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--shop-accent);
  margin: 0 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px dashed color-mix(in srgb, var(--shop-accent) 45%, transparent);
}

.shop-products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.shop-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--shop-border);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.shop-card-image {
  display: block;
  width: 100%;
  height: 140px;
  object-fit: cover;
  background: var(--shop-hover);
}

.shop-card-image--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--shop-meta);
}

.shop-card-note {
  font-size: 12px;
  line-height: 1.35;
  color: var(--shop-note);
  margin: 0;
  white-space: normal;
}

.shop-card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 10px 6px;
  min-width: 0;
  flex: 1 1 auto;
}

.shop-card-name {
  font-weight: 700;
  color: var(--shop-item);
}

.shop-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px 10px;
}

.shop-card-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.shop-download-btn {
  padding: 4px 10px;
  border: 1px solid var(--shop-accent);
  border-radius: 8px;
  background: #fff;
  color: var(--shop-accent);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.shop-download-btn:hover {
  background: var(--shop-hover);
  color: var(--shop-title);
}

.shop-card-price {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--shop-price);
}

.shop-add-btn {
  padding: 4px 10px;
  border: 1px solid var(--shop-accent);
  border-radius: 8px;
  background: var(--shop-accent);
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.shop-add-btn:hover,
.shop-add-btn.is-added {
  filter: brightness(1.06);
}

.shop-empty {
  margin: 0;
  font-size: 13px;
  color: var(--shop-meta);
}

.shop-cart {
  margin: 0;
}

.shop-cart-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-right: 12px;
}

.shop-cart-count {
  flex: 0 0 auto;
  min-width: 1.25rem;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--shop-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}

.shop-cart-clear {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--shop-meta);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}

.shop-cart-clear:hover {
  color: var(--shop-title);
  text-decoration: underline;
}

.shop-cart-empty {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--shop-meta);
}

.shop-cart-lines {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
}

.shop-cart-line {
  display: grid;
  grid-template-columns: 1fr auto auto;
  grid-template-areas: "name qty remove" "note price remove";
  column-gap: 8px;
  row-gap: 2px;
  padding: 6px 0;
  border-bottom: 1px dotted color-mix(in srgb, var(--shop-border) 80%, transparent);
  font-size: 13px;
  color: var(--shop-item);
}

.shop-cart-name {
  grid-area: name;
  font-weight: 650;
}

.shop-cart-note {
  grid-area: note;
  font-size: 11px;
  color: var(--shop-note);
}

.shop-qty {
  grid-area: qty;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.shop-qty-btn,
.shop-remove-btn {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--shop-border);
  border-radius: 6px;
  background: #fff;
  color: var(--shop-title);
  font: inherit;
  line-height: 1;
  cursor: pointer;
}

.shop-qty-value {
  min-width: 1.1rem;
  text-align: center;
  font-weight: 700;
}

.shop-cart-price {
  grid-area: price;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--shop-price);
  justify-self: end;
}

.shop-remove-btn {
  grid-area: remove;
  align-self: center;
}

.shop-cart-total {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 8px 0 10px;
  font-weight: 700;
  color: var(--shop-title);
}

.shop-cart-sum {
  font-variant-numeric: tabular-nums;
  color: var(--shop-price);
}

.shop-checkout-btn {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--shop-accent);
  border-radius: 10px;
  background: var(--shop-accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.shop-checkout-btn:hover:not(:disabled) {
  filter: brightness(1.05);
}

.shop-checkout-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.shop-checkout-btn.is-sending {
  cursor: wait;
}

.shop-archive {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed color-mix(in srgb, var(--shop-accent) 45%, transparent);
}

.shop-archive > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--shop-accent);
}

.shop-archive-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.shop-archive-entry {
  margin: 0;
}

.shop-archive-note {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--shop-note);
}

/* --- NotesList / classifieds --- */
.cl-block {
  --cl-bg: #f4f4f4;
  --cl-paper: #fff;
  --cl-ink: #222;
  --cl-link: #00e;
  --cl-visited: #551a8b;
  --cl-muted: #555;
  --cl-line: #ccc;
  --cl-brand: #5c2d91;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--cl-ink);
  background: var(--cl-bg);
  border: 1px solid var(--cl-line);
  padding: 12px 14px 16px;
  margin: 16px 0;
}

.cl-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
  margin-bottom: 8px;
}

.cl-brand {
  font-size: 22px;
  letter-spacing: -0.03em;
}

.cl-brand-name {
  color: var(--cl-brand);
  font-weight: 700;
}

.cl-brand-sub {
  color: var(--cl-ink);
  font-weight: 400;
}

.cl-title,
.cl-city {
  font-size: 18px;
  font-weight: 700;
}

.cl-meta {
  margin: 0;
  width: 100%;
  font-size: 12px;
  color: var(--cl-muted);
}

.cl-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 8px 0 12px;
}

.cl-search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.cl-search {
  flex: 1;
  min-width: 0;
  max-width: 360px;
  padding: 4px 8px;
  border: 1px solid #999;
  font: inherit;
}

.cl-add-btn,
.cl-add-send,
.cl-add-cancel {
  border: 1px solid #999;
  background: #f6f6f6;
  font: inherit;
  font-size: 13px;
  padding: 4px 10px;
  cursor: pointer;
}

.cl-add-btn:hover,
.cl-add-send:hover:not(:disabled),
.cl-add-cancel:hover {
  background: #ececec;
}

.cl-add-form {
  display: grid;
  grid-template-columns: minmax(10rem, 1fr) minmax(10rem, 1fr);
  gap: 8px 12px;
  width: 100%;
  background: var(--cl-paper);
  border: 1px solid var(--cl-line);
  padding: 10px 12px;
}

.cl-add-form[hidden] {
  display: none !important;
}

.cl-add-field,
.cl-add-text-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}

.cl-add-text-field {
  grid-column: 1 / -1;
}

.cl-add-to,
.cl-add-cat,
.cl-add-title,
.cl-add-price,
.cl-add-location,
.cl-add-until,
.cl-add-desc,
.cl-add-text,
.cl-reply-to,
.cl-reply-text {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid #999;
  font: inherit;
}

.cl-until-hint {
  font-size: 11px;
  color: #666;
}

.cl-until {
  display: block;
  font-size: 12px;
  color: #555;
}

.cl-add-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
}

.cl-add-send.is-sending,
.cl-add-send:disabled {
  opacity: 0.65;
  cursor: wait;
}

.cl-layout {
  display: grid;
  grid-template-columns: minmax(140px, 200px) 1fr;
  gap: 16px;
}

.cl-cats {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.cl-cat {
  border: 0;
  background: transparent;
  color: var(--cl-link);
  font: inherit;
  font-size: 14px;
  padding: 2px 0;
  cursor: pointer;
  text-align: left;
}

.cl-cat span {
  color: var(--cl-muted);
  font-size: 12px;
}

.cl-cat.is-active {
  font-weight: 700;
  color: var(--cl-ink);
}

.cl-results {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--cl-paper);
  border: 1px solid var(--cl-line);
}

.cl-row {
  border-bottom: 1px solid #eee;
}

.cl-row:last-child {
  border-bottom: 0;
}

.cl-row-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.cl-row-btn:hover {
  background: #f7f7ff;
}

.cl-thumb {
  width: 54px;
  height: 54px;
  object-fit: cover;
  flex-shrink: 0;
  background: #ddd;
}

.cl-thumb--empty {
  display: inline-block;
}

.cl-row-body {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  min-width: 0;
}

.cl-row-title {
  color: var(--cl-link);
  font-size: 15px;
}

.cl-row-btn:hover .cl-row-title {
  text-decoration: underline;
}

.cl-price {
  font-weight: 700;
  color: var(--cl-ink);
}

.cl-hood {
  color: var(--cl-muted);
  font-size: 13px;
}

.cl-none,
.cl-empty {
  margin: 12px 0;
  color: var(--cl-muted);
  font-size: 14px;
}

.cl-posting {
  background: var(--cl-paper);
  border: 1px solid var(--cl-line);
  padding: 14px 16px 18px;
}

.cl-back,
.cl-reply-btn,
.cl-edit-btn {
  border: 1px solid #999;
  background: #f6f6f6;
  font: inherit;
  font-size: 13px;
  padding: 4px 10px;
  cursor: pointer;
}

.cl-back {
  margin-bottom: 10px;
  color: var(--cl-link);
  border: 0;
  background: transparent;
  padding: 0;
}

.cl-posting-cat {
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--cl-muted);
  text-transform: lowercase;
}

.cl-posting-title {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
}

.cl-posting-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0 0 12px;
  font-size: 14px;
}

.cl-posting-img {
  display: block;
  max-width: min(100%, 420px);
  height: auto;
  margin: 0 0 12px;
}

.cl-posting-body {
  margin: 0 0 14px;
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.cl-reply-form {
  display: grid;
  grid-template-columns: minmax(10rem, 1fr);
  gap: 8px 12px;
  margin-top: 12px;
  background: var(--cl-paper);
  border: 1px solid var(--cl-line);
  padding: 10px 12px;
}

.cl-reply-form[hidden] {
  display: none !important;
}

.cl-posting-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.cl-edit-form {
  margin-top: 12px;
}

.cl-reply-btn:hover:not(:disabled),
.cl-edit-btn:hover:not(:disabled) {
  background: #ececec;
}

.cl-reply-btn.is-sending,
.cl-reply-btn:disabled,
.cl-edit-btn.is-sending,
.cl-edit-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.cl-block.is-posting .cl-cats,
.cl-block.is-posting .cl-toolbar {
  display: none;
}

.cl-block.is-posting .cl-layout {
  grid-template-columns: 1fr;
}

@media (max-width: 720px) {
  .cl-layout {
    grid-template-columns: 1fr;
  }
  .cl-cats {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px 14px;
  }
}

/* --- Mindmap --- */
.mindmap-block {
  --mindmap-bg: #fff;
  --mindmap-border: #cbd5e1;
  --mindmap-title: #0f172a;
  --mindmap-meta: #64748b;
  --mindmap-line: #94a3b8;
  --mindmap-card-bg: #eff6ff;
  --mindmap-card-border: #bfdbfe;
  --mindmap-card-text: #1e3a8a;
  --mindmap-accent: #2563eb;
  border: 1px solid var(--mindmap-border);
  border-left: 4px solid var(--mindmap-accent);
  background: var(--mindmap-bg);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 16px 0;
  overflow-x: auto;
}

.mindmap-block--info {
  --mindmap-bg: #eff6ff;
  --mindmap-border: #bfdbfe;
  --mindmap-title: #1d4ed8;
  --mindmap-meta: #3b82f6;
  --mindmap-line: #93c5fd;
  --mindmap-card-bg: #dbeafe;
  --mindmap-card-border: #93c5fd;
  --mindmap-card-text: #1e3a8a;
  --mindmap-accent: #2563eb;
}

.mindmap-block--success {
  --mindmap-bg: #f0fdf4;
  --mindmap-border: #bbf7d0;
  --mindmap-title: #15803d;
  --mindmap-meta: #16a34a;
  --mindmap-line: #86efac;
  --mindmap-card-bg: #dcfce7;
  --mindmap-card-border: #86efac;
  --mindmap-card-text: #14532d;
  --mindmap-accent: #16a34a;
}

.mindmap-block--warning {
  --mindmap-bg: #fffbeb;
  --mindmap-border: #fde68a;
  --mindmap-title: #b45309;
  --mindmap-meta: #d97706;
  --mindmap-line: #fcd34d;
  --mindmap-card-bg: #fef3c7;
  --mindmap-card-border: #fcd34d;
  --mindmap-card-text: #78350f;
  --mindmap-accent: #d97706;
}

.mindmap-block--danger {
  --mindmap-bg: #fef2f2;
  --mindmap-border: #fecaca;
  --mindmap-title: #b91c1c;
  --mindmap-meta: #dc2626;
  --mindmap-line: #fca5a5;
  --mindmap-card-bg: #fee2e2;
  --mindmap-card-border: #fca5a5;
  --mindmap-card-text: #7f1d1d;
  --mindmap-accent: #dc2626;
}

.mindmap-block--note {
  --mindmap-bg: #f8fafc;
  --mindmap-border: #e2e8f0;
  --mindmap-title: #475569;
  --mindmap-meta: #64748b;
  --mindmap-line: #cbd5e1;
  --mindmap-card-bg: #e2e8f0;
  --mindmap-card-border: #cbd5e1;
  --mindmap-card-text: #0f172a;
  --mindmap-accent: #64748b;
}

.mindmap-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.mindmap-block-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--mindmap-title);
}

.mindmap-block-title--editable {
  cursor: pointer;
  border-radius: 6px;
  padding: 2px 4px;
  margin: -2px -4px;
}

.mindmap-block-title--editable:hover {
  background: color-mix(in srgb, var(--mindmap-accent) 12%, transparent);
}

.mindmap-block-meta {
  font-size: 12px;
  color: var(--mindmap-meta);
  white-space: nowrap;
}

.mindmap-empty {
  font-size: 13px;
  color: var(--mindmap-meta);
  padding: 16px;
  text-align: center;
}

.mindmap-canvas {
  overflow-x: auto;
  padding-bottom: 8px;
}

.mindmap-tree,
.mindmap-children {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mindmap-dir-right .mindmap-tree,
.mindmap-dir-right .mindmap-children {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mindmap-dir-right .mindmap-node {
  display: flex;
  align-items: stretch;
  gap: 0;
  position: relative;
}

.mindmap-dir-right .mindmap-children {
  margin-left: 18px;
  padding-left: 18px;
  border-left: 2px solid var(--mindmap-line);
  justify-content: center;
}

.mindmap-dir-right .mindmap-node::before {
  content: '';
  position: absolute;
  left: calc(100% - 18px);
  top: 50%;
  width: 18px;
  height: 2px;
  background: var(--mindmap-line);
  display: none;
}

.mindmap-dir-right > .mindmap-tree > .mindmap-node > .mindmap-children {
  margin-left: 14px;
}

.mindmap-dir-down .mindmap-tree {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.mindmap-dir-down .mindmap-node {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}

.mindmap-dir-down .mindmap-children {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
  margin-left: 18px;
  padding-top: 10px;
  border-top: 2px solid var(--mindmap-line);
  padding-left: 4px;
}

.mindmap-node-card {
  background: var(--mindmap-card-bg);
  border: 1px solid var(--mindmap-card-border);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 120px;
  max-width: 240px;
  color: var(--mindmap-card-text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.mindmap-node-card--editable {
  cursor: pointer;
}

.mindmap-node-card--editable:hover {
  filter: brightness(0.97);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.1);
}

.mindmap-node--has-note .mindmap-node-card {
  border-width: 2px;
}

.mindmap-node-label {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}

.mindmap-node-text {
  margin-top: 6px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
}

.mindmap-node-text > :first-child { margin-top: 0; }
.mindmap-node-text > :last-child { margin-bottom: 0; }
.mindmap-node-text p,
.mindmap-node-text ul,
.mindmap-node-text ol {
  margin: 0 0 4px;
}

.mindmap-node-image {
  display: block;
  width: 100%;
  max-height: 72px;
  object-fit: cover;
  border-radius: 6px;
  margin-top: 6px;
}

/* --- Calcs --- */
.calcs-block {
  --calcs-bg: #fff;
  --calcs-border: #cbd5e1;
  --calcs-title: #0f172a;
  --calcs-meta: #64748b;
  --calcs-src: #334155;
  --calcs-value: #0f172a;
  --calcs-accent: #2563eb;
  --calcs-row: #f8fafc;
  --calcs-grid: #e2e8f0;
  border: 1px solid var(--calcs-border);
  border-left: 4px solid var(--calcs-accent);
  background: var(--calcs-bg);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 16px 0;
  overflow-x: auto;
}

.calcs-block--info {
  --calcs-bg: #eff6ff;
  --calcs-border: #bfdbfe;
  --calcs-title: #1d4ed8;
  --calcs-meta: #3b82f6;
  --calcs-accent: #2563eb;
  --calcs-row: #dbeafe;
}

.calcs-block--success {
  --calcs-bg: #f0fdf4;
  --calcs-border: #bbf7d0;
  --calcs-title: #15803d;
  --calcs-meta: #16a34a;
  --calcs-accent: #16a34a;
  --calcs-row: #dcfce7;
}

.calcs-block--warning {
  --calcs-bg: #fffbeb;
  --calcs-border: #fde68a;
  --calcs-title: #b45309;
  --calcs-meta: #d97706;
  --calcs-accent: #d97706;
  --calcs-row: #fef3c7;
}

.calcs-block--danger {
  --calcs-bg: #fef2f2;
  --calcs-border: #fecaca;
  --calcs-title: #991b1b;
  --calcs-meta: #dc2626;
  --calcs-accent: #dc2626;
  --calcs-row: #fee2e2;
}

.calcs-block--note {
  --calcs-bg: #f8fafc;
  --calcs-border: #cbd5e1;
  --calcs-title: #334155;
  --calcs-meta: #64748b;
  --calcs-accent: #64748b;
  --calcs-row: #e2e8f0;
}

.calcs-block--custom {
  --calcs-value: var(--calcs-custom-color, #0f172a);
  --calcs-title: var(--calcs-custom-color, #0f172a);
  --calcs-accent: var(--calcs-custom-color, #2563eb);
  --calcs-src: var(--calcs-custom-color, #334155);
  background: var(--calcs-custom-bg, var(--calcs-bg));
  --calcs-row: color-mix(in srgb, var(--calcs-custom-bg, var(--calcs-bg)) 88%, #fff 12%);
}

.calcs-block--error {
  --calcs-bg: #fef2f2;
  --calcs-border: #fecaca;
  --calcs-title: #991b1b;
  --calcs-accent: #dc2626;
}

.calcs-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.calcs-block-title {
  font-weight: 700;
  color: var(--calcs-title);
}

.calcs-block-meta {
  font-size: 12px;
  color: var(--calcs-meta);
}

.calcs-row {
  display: grid;
  grid-template-columns: minmax(8rem, 1fr) minmax(8rem, 1.2fr);
  gap: 10px 16px;
  padding: 6px 8px;
  border-radius: 8px;
}

.calcs-row:nth-child(even) {
  background: var(--calcs-row);
}

.calcs-row--md {
  display: block;
  padding: 8px 10px;
}

.calcs-md {
  font-family: Inter, system-ui, sans-serif;
  font-size: 14px;
  color: var(--calcs-title);
  line-height: 1.5;
}

.calcs-md :first-child { margin-top: 0; }
.calcs-md :last-child { margin-bottom: 0; }
.calcs-md p { margin: 0 0 0.35em; }
.calcs-md strong { font-weight: 700; }
.calcs-md em { font-style: italic; }

.calcs-md-inline {
  font-family: Inter, system-ui, sans-serif;
  font-size: 14px;
  color: var(--calcs-title);
  line-height: 1.5;
}

.calcs-md-inline strong { font-weight: 700; }
.calcs-md-inline em { font-style: italic; }

.calcs-src code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  color: var(--calcs-src);
  white-space: pre-wrap;
}

.calcs-out {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  color: #1d4ed8;
  white-space: pre-wrap;
}

.calcs-out--multi {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0;
}

.calcs-out-sep {
  color: var(--calcs-meta);
}

.calcs-out-line {
  display: inline;
}

.calcs-out-line--plot {
  display: block;
  width: 100%;
  margin-top: 6px;
}

.calcs-out-line--error {
  color: #b91c1c;
}

.calcs-error { color: #b91c1c; }
.calcs-format { color: var(--calcs-meta); font-style: italic; }
.calcs-empty { color: var(--calcs-meta); font-size: 13px; }

.calcs-matrix {
  border-collapse: collapse;
}

.calcs-matrix td {
  padding: 2px 8px;
  text-align: right;
  border: 1px solid var(--calcs-grid);
}

.calcs-plot-wrap {
  position: relative;
  display: inline-block;
  max-width: 100%;
  cursor: crosshair;
}

.calcs-plot-tooltip {
  position: fixed;
  z-index: 1200;
  white-space: pre-line;
}

.calcs-plot {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.calcs-plot-bg { fill: #fff; }
.calcs-plot-grid { stroke: #e2e8f0; stroke-width: 1; }
.calcs-plot-tick { fill: #64748b; font-size: 10px; font-family: Inter, system-ui, sans-serif; }
.calcs-plot-line { stroke-width: 2; }
.calcs-plot-snap-line {
  stroke: #94a3b8;
  stroke-width: 1;
  stroke-dasharray: 3 3;
  pointer-events: none;
}
.calcs-plot-snap-point { pointer-events: none; }
.calcs-plot-legend-box {
  fill: #fff;
  fill-opacity: 1;
  stroke: #94a3b8;
  stroke-width: 1;
}
.calcs-plot-legend-swatch { stroke-width: 2.5; stroke-linecap: round; }
.calcs-plot-legend-label {
  fill: #0f172a;
  font-size: 11px;
  font-family: Inter, system-ui, sans-serif;
  font-weight: 600;
}

.chart-block {
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 14px;
  padding: 12px 14px 8px;
  margin: 16px 0;
  min-height: 200px;
  position: relative;
}

.chart-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.chart-block-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-bottom: 0;
}

.chart-block-settings {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.chart-block-settings.active {
  background: var(--accent, #2563eb);
  border-color: var(--accent, #2563eb);
  color: #fff;
}

.chart-settings-icon {
  font-size: 16px;
  line-height: 1;
}

.chart-block-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.chart-block-axis-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chart-block-axis-label {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}

.chart-block-axis-buttons {
  gap: 8px;
}

.chart-block-axis-buttons .chart-axis-btn {
  font-size: 14px;
  min-width: 88px;
  padding: 8px 20px;
  border-radius: 8px;
}

.chart-block-canvas {
  width: 100%;
  overflow-x: auto;
  position: relative;
}

.chart-block-canvas svg {
  display: block;
  max-width: 100%;
}

.chart-bar {
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.chart-bar:hover,
.chart-pie-slice:hover {
  opacity: 0.82;
}

.chart-pie-slice {
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.chart-point {
  cursor: pointer;
}

.chart-point:hover {
  opacity: 0.85;
}

.chart-tooltip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  padding: 6px 10px;
  border-radius: 8px;
  background: #0f172a;
  color: #f8fafc;
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.25);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.chart-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.calcs-plot-tooltip.chart-tooltip {
  position: fixed;
  z-index: 1200;
  white-space: pre-line;
}

.chart-block-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 8px;
  font-size: 12px;
  color: #475569;
}

.chart-axis-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chart-axis-buttons .chart-axis-btn.active {
  background: var(--accent, #2563eb);
  border-color: var(--accent, #2563eb);
  color: #fff;
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}

.chart-block.chart-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
  font-size: 14px;
}

.md-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.md-tag {
  background: #dbeafe;
  color: #1d4ed8;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.tag-suggestions,
.tag-search-results {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag-suggestion,
.tag-result-page {
  background: #dbeafe;
  color: #1d4ed8;
  border: none;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.tag-suggestion:hover,
.tag-result-page:hover {
  background: #bfdbfe;
}

.tag-search-results {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
}

.tag-result-page {
  border-radius: 8px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag-search-empty {
  color: var(--muted, #64748b);
  font-size: 12px;
  padding: 4px 2px;
}

.right-panel {
  grid-column: 5;
  grid-row: 2;
  border-left: 1px solid var(--line);
  padding: 16px;
  background: var(--panel-2);
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.right-panel-mobile-header {
  display: none;
}

.right-panel-backdrop {
  display: none;
}

.right-panel-comm {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.right-panel-members {
  flex-shrink: 0;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  max-height: min(42vh, 320px);
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.right-panel-members .workspace-members-card-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.workspace-members-search-wrap {
  flex-shrink: 0;
  overflow: visible;
  z-index: 20;
}

.right-panel-members .workspace-members-list {
  flex: 1;
  min-height: 0;
  max-height: none;
}

.comm-tabs {
  flex-shrink: 0;
}

.comm-tabs .nav-link {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
}

.comm-tabs .nav-link.active {
  color: var(--text);
  background: rgba(37, 99, 235, 0.15);
}

.comm-pane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.chat-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #0b141a;
}

.chat-bubble {
  max-width: 85%;
  padding: 6px 8px 4px;
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.4;
  word-break: break-word;
  position: relative;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

.chat-bubble.mine {
  align-self: flex-end;
  background: #005c4b;
  color: #e9edef;
  border-top-right-radius: 0;
}

.chat-bubble.theirs {
  align-self: flex-start;
  background: #202c33;
  color: #e9edef;
  border-top-left-radius: 0;
}

.chat-bubble-sender {
  font-size: 0.72rem;
  font-weight: 600;
  color: #53bdeb;
  margin-bottom: 2px;
}

.chat-bubble-body {
  white-space: pre-wrap;
}

.chat-bubble-time {
  font-size: 0.65rem;
  color: rgba(233, 237, 239, 0.6);
}

.chat-bubble-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 2px;
}

.chat-bubble-status {
  font-size: 0.65rem;
  color: #53bdeb;
  letter-spacing: -1px;
}

.chat-date-separator {
  align-self: center;
  font-size: 0.68rem;
  color: rgba(233, 237, 239, 0.55);
  background: rgba(17, 24, 39, 0.85);
  padding: 4px 10px;
  border-radius: 6px;
  margin: 8px 0 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.chat-bubble-attachment {
  margin-top: 4px;
}

.chat-bubble-attachment img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 6px;
  cursor: pointer;
  display: block;
}

.chat-bubble-attachment a {
  color: #53bdeb;
  text-decoration: none;
  font-size: 0.8rem;
}

.chat-bubble-attachment a:hover {
  text-decoration: underline;
}

.chat-form {
  flex-shrink: 0;
}

.chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  background: #202c33;
  border-radius: 8px;
  padding: 6px;
}

.chat-input {
  flex: 1;
  resize: none;
  min-height: 36px;
  max-height: 120px;
  background: #2a3942;
  border: none;
  color: #e9edef;
  font-size: 0.85rem;
}

.chat-input:focus {
  background: #2a3942;
  color: #e9edef;
  box-shadow: none;
  border-color: transparent;
}

.chat-attach-btn,
.chat-send-btn {
  flex-shrink: 0;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-send-btn {
  background: #00a884;
  border-color: #00a884;
}

.chat-send-btn:hover {
  background: #008f72;
  border-color: #008f72;
}

.chat-attachment-preview {
  font-size: 0.75rem;
  color: var(--muted);
  padding: 4px 8px;
  background: #202c33;
  border-radius: 6px;
  margin-bottom: 4px;
}

.chat-bubble .meta {
  display: none;
}

#chat-mode-tabs {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}

.dm-list-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dm-list-header {
  padding: 4px 2px 8px;
}

.dm-list-title {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.dm-list-subtitle {
  display: block;
  font-size: 0.68rem;
  color: #25d366;
}

.dm-conversation-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.dm-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 16px;
  color: var(--muted);
}

.dm-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.85;
}

#comm-chat-pane[data-pane-mode="private"]:not(.dm-thread-active) > #chat-messages,
#comm-chat-pane[data-pane-mode="private"]:not(.dm-thread-active) > #chat-form {
  display: none !important;
}

#comm-chat-pane[data-pane-mode="group"] > #dm-list-view,
#comm-chat-pane[data-pane-mode="group"] > #dm-thread-header,
#comm-chat-pane[data-pane-mode="group"] > #dm-typing-indicator {
  display: none !important;
}

#comm-chat-pane[data-pane-mode="group"] > #chat-messages {
  display: flex !important;
}

#comm-chat-pane[data-pane-mode="group"] > #chat-form {
  display: block !important;
}

.private-chat-pane[data-pane-mode="group"] .chat-messages {
  background: #0b141a;
  background-image: none;
}

.private-chat-pane[data-pane-mode="private"] .chat-messages {
  background-color: #0b141a;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

#comm-chat-pane.dm-thread-active .dm-thread-header {
  background: #202c33;
  margin: -2px -8px 4px;
  padding: 10px 8px;
  border-bottom: none;
}

.private-message-btn {
  font-size: 1rem;
  line-height: 1;
  opacity: 0.75;
}

.private-message-btn:hover {
  opacity: 1;
}

.dm-typing-dots::after {
  content: '…';
  animation: dm-typing-pulse 1.2s infinite;
}

@keyframes dm-typing-pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

.dm-search-results:empty,
.dm-conversation-list:empty {
  display: none;
}

.dm-conversation-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 8px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.dm-conversation-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.dm-conversation-avatar,
.dm-thread-avatar {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #374151;
  color: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
}

.dm-conversation-body {
  flex: 1;
  min-width: 0;
}

.dm-conversation-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.dm-conversation-time {
  flex-shrink: 0;
  font-size: 0.68rem;
  color: var(--muted);
}

.dm-lock-badge {
  flex-shrink: 0;
  font-size: 0.75rem;
  opacity: 0.7;
}

.dm-conversation-item .dm-preview {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: none;
  margin-top: 2px;
}

.dm-search-hit {
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}

.dm-search-hit:hover {
  background: rgba(255, 255, 255, 0.06);
}

.dm-thread-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}

.dm-back-btn {
  color: #53bdeb !important;
  text-decoration: none !important;
  min-width: 28px;
}

.dm-thread-title {
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
  line-height: 1.25;
  padding-left: 0;
}

.dm-p2p-status {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
}

.dm-p2p-status[data-status="p2p"] {
  color: #25d366;
}

.dm-typing {
  font-size: 0.72rem;
  color: #25d366;
  padding: 0 8px 4px;
  font-style: italic;
}

#comm-chat-pane.dm-thread-active .dm-list-view {
  display: none !important;
}

#comm-mail-pane > .nav {
  flex-shrink: 0;
}

#comm-mail-pane {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#mail-list-view,
#mail-read-view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

#mail-compose-view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.right-panel .form-control,
.right-panel .form-select {
  background: #fff;
  color: #0f172a;
}

.mail-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.mail-item {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  margin-bottom: 8px;
  cursor: pointer;
  background: var(--panel);
}

.mail-item:hover {
  border-color: var(--accent);
}

#mail-table-body tr[data-mail-id],
#chat-table-body tr[data-chat-id],
.chat-bubble {
  cursor: pointer;
}

.mail-item.unread {
  border-left: 3px solid var(--accent);
}

.arrival-list {
  position: fixed;
  z-index: 1060;
  right: 16px;
  bottom: 16px;
  width: min(380px, calc(100vw - 32px));
  max-height: min(52vh, 440px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel, #1e1e2e);
  color: var(--text, #e2e8f0);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.arrival-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#arrival-list-body {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.arrival-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 8px;
  width: 100%;
  text-align: left;
  color: inherit;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
}

.arrival-item:hover {
  border-color: var(--accent);
}

.arrival-kind {
  grid-row: 1 / span 2;
  align-self: center;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #111;
  background: var(--accent, #38bdf8);
  border-radius: 999px;
  padding: 3px 6px;
}

.arrival-item--chat .arrival-kind { background: #4ade80; }
.arrival-item--private .arrival-kind { background: #c4b5fd; }

.arrival-title {
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arrival-detail {
  color: var(--muted, #94a3b8);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-read-body {
  white-space: pre-wrap;
  color: var(--text);
}

.incomes-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.income-item {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  cursor: pointer;
  font-size: 0.85rem;
}

.income-item:hover {
  border-color: var(--accent);
}

.income-item-subject {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#comm-issues-pane {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#comm-issues-pane .issues-toolbar,
#comm-issues-pane .issues-actions {
  flex-shrink: 0;
}

.issues-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.issue-item {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  cursor: pointer;
  font-size: 0.85rem;
}

.issue-item:hover {
  border-color: var(--accent);
}

.issue-item-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.issue-item-num {
  flex-shrink: 0;
  font-weight: 700;
  color: var(--accent);
  font-size: 0.8rem;
}

.issue-item-title {
  flex: 1;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.issue-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
  align-items: center;
}

.issue-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.4;
  text-transform: capitalize;
}

.issue-badge--status-open,
.issue-badge--status-New,
.issue-badge--status-new { background: rgba(56, 189, 248, 0.2); color: #7dd3fc; }
.issue-badge--status-in_progress,
.issue-badge--status-Doing,
.issue-badge--status-doing { background: rgba(251, 191, 36, 0.2); color: #fcd34d; }
.issue-badge--status-review,
.issue-badge--status-Feedback,
.issue-badge--status-feedback { background: rgba(167, 139, 250, 0.2); color: #c4b5fd; }
.issue-badge--status-closed,
.issue-badge--status-Closed,
.issue-badge--status-Rejected,
.issue-badge--status-rejected { background: rgba(148, 163, 184, 0.2); color: #94a3b8; }

.issue-badge--priority-low { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }
.issue-badge--priority-normal { background: rgba(56, 189, 248, 0.12); color: #7dd3fc; }
.issue-badge--priority-high { background: rgba(251, 146, 60, 0.2); color: #fdba74; }
.issue-badge--priority-urgent { background: rgba(248, 113, 113, 0.25); color: #fca5a5; }

.issue-item-assignee {
  font-size: 0.72rem;
  color: var(--muted);
  margin-left: auto;
}

.issues-empty {
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
  padding: 12px 4px;
}

.issue-hover-tooltip {
  position: fixed;
  z-index: 1100;
  pointer-events: none;
  max-width: min(360px, calc(100vw - 16px));
  max-height: min(240px, calc(100vh - 16px));
  overflow: hidden;
  padding: 8px 10px;
  border-radius: 8px;
  background: #0f172a;
  color: #f8fafc;
  font-size: 12px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.28);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.issue-hover-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.issues-table-wrap {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
}

.main-pane--issues .editor-wrap,
.main-pane--issues .keep-wrap {
  display: none !important;
}

.issues-table-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.issues-table-heading {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.issues-table-count {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.issues-table-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.issues-table-tools .form-select,
.issues-table-tools .form-control {
  width: auto;
  min-width: 9rem;
}

.issues-table-tools .form-control {
  min-width: 14rem;
}

.issues-table-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 12px 16px;
}

.issues-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.issues-table th,
.issues-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap;
}

.issues-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
}

.issues-table th.is-sorted {
  color: var(--text);
}

.issues-table tbody tr {
  cursor: pointer;
}

.issues-table tbody tr:hover {
  background: rgba(37, 99, 235, 0.12);
}

.issues-table-title-cell {
  white-space: normal;
  font-weight: 600;
  min-width: 12rem;
}

.issues-table-num {
  font-weight: 700;
  color: var(--accent);
}

.issues-table-updated {
  color: var(--muted);
  font-size: 0.8rem;
}

.issues-table-labels {
  white-space: normal;
}

.issue-label {
  display: inline-block;
  margin: 0 4px 2px 0;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  color: var(--text);
  font-size: 0.72rem;
}

.issues-table-page-link {
  background: none;
  border: 0;
  padding: 0;
  color: #7dd3fc;
  cursor: pointer;
  text-decoration: underline;
  font: inherit;
}

.issues-table-empty {
  text-align: center;
  color: var(--muted);
  padding: 28px 12px !important;
  cursor: default;
}

.income-item-meta {
  color: var(--muted);
  font-size: 0.75rem;
}

.incomes-detail-body {
  max-height: 140px;
  overflow: auto;
  font-size: 0.8rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  white-space: pre-wrap;
}

.incomes-route-warnings {
  background: rgba(255, 193, 7, 0.12);
  border: 1px solid rgba(255, 193, 7, 0.45);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.8rem;
  color: var(--text);
}

.incomes-select-missing {
  border-color: #ffc107 !important;
  box-shadow: 0 0 0 0.15rem rgba(255, 193, 7, 0.25);
}

.panel-card {
  background: var(--panel-2);
  border-radius: 14px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.06);
  margin-bottom: 16px;
  overflow: hidden;
}

/* header */
.panel-header {
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  color: var(--text);
}

/* icon animation */
.toggle-icon {
  transition: transform 0.25s ease;
}

/* body */
.panel-body {
  max-height: 2000px;
  overflow: hidden;
  transition: all 0.25s ease;
  padding: 16px;
}

/* collapsed state */
.panel-body.collapsed {
  max-height: 0;
  padding: 0 16px;
}

/* rotate arrow */
.panel-header.collapsed .toggle-icon {
  transform: rotate(-90deg);
}

.dropzone {
  border: 2px dashed #475569;
  border-radius: 14px;
  padding: 18px;
  text-align: center;
  color: var(--muted);
}

.dropzone.active {
  border-color: var(--accent);
  background: rgba(37, 99, 235, 0.14);
  color: var(--text);
}

.file-list {
  margin-top: 12px;
  max-height: 400px;
  overflow: auto;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.file-item a {
  color: #93c5fd;
  text-decoration: none;
}

.file-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: grab;
}

.file-item-name:active,
.file-item.is-dragging .file-item-name {
  cursor: grabbing;
}

.file-item.is-dragging .file-item-name {
  opacity: 0.45;
}

.file-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

#markdown-wrap.is-file-drop .CodeMirror {
  box-shadow: inset 0 0 0 2px var(--accent, #2563eb);
}

#save-status {
  color: var(--muted);
  font-size: 14px;
}

.offline-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  background: #92400e;
  color: #fef3c7;
  white-space: nowrap;
}

.offline-badge.is-syncing {
  background: #1e3a8a;
  color: #dbeafe;
}

.offline-warning {
  grid-column: 1 / -1;
  margin: 12px -16px -12px;
  padding: 7px 16px;
  background: #92400e;
  color: #fef3c7;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
}

.workspace-members-body {
  padding-top: 0;
}

.workspace-members-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: visible;
}

.workspace-members-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.35);
}

.workspace-members-title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.workspace-members-count-btn {
  background: none;
  border: none;
  padding: 0;
  line-height: 1;
  cursor: pointer;
}

.workspace-members-count-btn:hover .badge,
.workspace-members-count-btn:focus-visible .badge {
  filter: brightness(1.15);
}

.workspace-members-count-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 999px;
}

.workspace-members-modal-list .list-group-item {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
  padding: 10px 16px;
}

.workspace-members-modal-list .list-group-item:hover {
  background: rgba(37, 99, 235, 0.08);
}

.workspace-members-card-body {
  padding: 10px 12px 12px;
}

.workspace-members-search .input-group-text,
.workspace-members-search .form-control,
.workspace-members-search .form-select {
  background: var(--panel-2);
  border-color: var(--line);
  color: var(--text);
}

.workspace-members-search .input-group-text {
  color: var(--muted);
}

.workspace-members-search .form-control::placeholder {
  color: var(--muted);
}

.workspace-members-search .form-control:focus {
  background: var(--panel-2);
  border-color: var(--accent);
  color: var(--text);
  box-shadow: none;
}

.workspace-members-dropdown {
  z-index: 1050;
  max-height: 200px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  top: calc(100% + 4px);
  left: 0;
  right: 0;
}

.workspace-members-dropdown .list-group-item {
  background: var(--panel);
  border-color: var(--line);
  color: var(--text);
}

.workspace-members-dropdown .list-group-item:hover {
  background: var(--panel-2);
}

.workspace-members-invite {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 10px;
}

.workspace-members-invite .form-label,
.workspace-members-hint {
  color: var(--muted);
}

.workspace-members-list {
  max-height: 250px;
  font-size: 0.85rem;
}

.workspace-members-list .list-group-item {
  background: transparent;
  color: var(--text);
}

.workspace-member-name {
  font-size: 0.85rem;
  color: var(--text);
}

.user-row-hover:hover {
  background: rgba(37, 99, 235, 0.12) !important;
}

.workspace-members-list .btn-link {
  color: var(--muted);
}

.workspace-members-list .btn-link:hover {
  color: var(--text);
}

.workspace-members-list .text-danger {
  color: #f87171 !important;
}

.input-group:focus-within .input-group-text {
    border-color: #86b7fe;
}
#user-search-input:focus {
    box-shadow: none;
    border-color: var(--accent);
}

.jstree-default .jstree-node {
  margin-left: 4px;
  line-height: var(--tree-line-height, 28px);
  min-height: var(--tree-node-min-height, 28px);
}

.jstree-default .jstree-anchor {
  color: var(--text);
  padding-top: 4px;
  padding-bottom: 4px;
  min-height: var(--tree-node-min-height, 28px);
  line-height: var(--tree-line-height, 28px);
  height: auto;
  font-size: var(--tree-font-size, 15px);
}

.jstree-default .jstree-icon {
    line-height: var(--tree-line-height, 28px);
    height: var(--tree-node-min-height, 28px);
}

.vakata-context li > a {
  padding: 2px 10px;
  line-height: 1.35;
  font-size: 0.875rem;
}
.jstree-default .jstree-clicked {
  background: var(--accent);
  color: #fff;
  box-shadow: none;
  border-radius: 6px;
}

.jstree-default .jstree-hovered {
  background: #1e293b;
  color: #fff;
  box-shadow: none;
  line-height: var(--tree-line-height, 28px);
  min-height: var(--tree-node-min-height, 28px);
  border-radius: 2px;
}

button, select, input {
  min-height: 40px;
}

/* Die Toolbar bleibt nun am oberen Rand dieses Containers hängen */
.editor-toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #fff;
  flex-wrap: wrap;
}


@media (max-width: 1200px) {
  .app-shell {
    grid-template-columns: var(--sidebar-width) var(--splitter-width) minmax(0, 1fr);
  }

  .app-shell:has(.right-panel) {
    grid-template-columns: var(--sidebar-width) var(--splitter-width) minmax(0, 1fr) var(--right-splitter-width) var(--right-width);
  }
}

@media (max-width: 991px), (max-height: 1000px) {
  .app-shell {
    grid-template-columns: var(--sidebar-width) var(--splitter-width) minmax(0, 1fr);
  }

  .app-shell:has(.right-panel) {
    grid-template-columns: var(--sidebar-width) var(--splitter-width) minmax(0, 1fr) var(--right-splitter-width) var(--right-width);
  }

  .preview-layout {
    grid-template-columns: 1fr;
  }

  .slug-box {
    display: none !important;
  }

  .sidebar {
    --tree-font-size: 16px;
    --tree-line-height: 30px;
    --tree-node-min-height: 30px;
  }
}

/* Mobile-Spezifisch */
@media (max-width: 768px) {
  .topbar {
    padding: 8px 10px;
    gap: 6px;
  }

  .offline-warning {
    margin: 8px -10px -8px;
    padding: 7px 10px;
  }

  .title-wrap {
    gap: 0.5rem !important;
    font-size: 13px;
  }

  .topbar-app-label {
    display: none !important;
  }

  .title-wrap strong {
    font-size: 13px;
    font-weight: 600;
  }

  .page-title-preview {
    font-size: 14px;
    font-weight: 600;
  }

  .topbar #page-title.form-control {
    font-size: 14px;
    padding: 0.25rem 0.5rem;
  }

  .topbar-actions {
    gap: 4px;
    position: relative;
  }

  .mobile-topbar-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    padding-inline: 0.55rem;
    font-size: 20px;
    line-height: 1;
  }

  .mobile-topbar-menu-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1055;
    background: rgba(15, 23, 42, 0.45);
  }

  .topbar-actions-menu {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(86vw, 300px);
    z-index: 1060;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 14px 12px 16px;
    background: var(--panel);
    border-left: 1px solid var(--line);
    transform: translateX(100%);
    transition: transform 0.2s ease;
    box-shadow: -12px 0 32px rgba(0, 0, 0, 0.22);
    overflow-y: auto;
    pointer-events: none;
  }

  .topbar-actions-menu.active {
    transform: translateX(0);
    pointer-events: auto;
  }

  .mobile-topbar-menu-title {
    display: block;
    margin: 0 4px 8px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
  }

  .topbar-actions-menu .btn,
  .topbar-actions-menu form {
    width: 100%;
    margin: 0;
  }

  .topbar-actions-menu .btn {
    justify-content: flex-start;
    height: 44px;
    min-height: 44px;
    font-size: 15px;
    padding-inline: 12px;
  }

  .topbar-actions-menu form button {
    width: 100%;
  }

  body.mobile-layout .right-panel-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1058;
    background: rgba(15, 23, 42, 0.45);
  }

  body.mobile-layout .right-panel-backdrop.d-none {
    display: none !important;
  }

  body.mobile-layout .right-panel:not(.collapsed) {
    display: flex;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: min(92vw, 400px);
    height: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    grid-column: auto;
    grid-row: auto;
    z-index: 1062;
    margin: 0;
    border-radius: 16px 0 0 16px;
    border-left: 1px solid var(--line);
    box-shadow: -12px 0 32px rgba(0, 0, 0, 0.22);
    transform: none;
  }

  body.mobile-layout #right-splitter {
    display: none !important;
  }

  body.mobile-layout .right-panel-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
    margin: -4px 0 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
  }

  body.mobile-layout .right-panel-mobile-header strong {
    font-size: 15px;
  }

  .topbar-actions-menu .slug-box {
    margin-top: 4px;
    padding: 8px 12px;
    font-size: 12px;
    border-top: 1px solid var(--line);
  }

  body.editing .topbar-actions-menu .slug-box {
    display: block !important;
  }

  .topbar .btn.btn-sm {
    font-size: 11px;
    height: 32px;
    min-height: 32px;
    padding: 0.2rem 0.45rem;
  }

  .mobile-page-fabs {
    display: none;
  }

  body.mobile-layout .mobile-page-fabs:has(.mobile-toc-btn.visible) {
    display: flex;
    position: fixed;
    right: 14px;
    bottom: 14px;
    z-index: 1045;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    pointer-events: none;
  }

  .mobile-toc-btn {
    display: none;
  }

  body.mobile-layout .mobile-page-fabs .mobile-toc-btn.visible {
    display: inline-flex;
    pointer-events: auto;
    position: static;
  }

  body.mobile-layout .mobile-page-fabs .mobile-undo-btn.visible {
    min-width: 64px;
  }

  body.mobile-layout .floating-toc {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(86vw, 320px);
    height: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    z-index: 1050;
    margin: 0;
    border-radius: 16px 0 0 16px;
    transform: translateX(100%);
    transition: transform 0.2s ease;
    box-shadow: -12px 0 32px rgba(0, 0, 0, 0.22);
    overflow: hidden;
  }

  body.mobile-layout .floating-toc #floating-toc-list {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  body.mobile-layout .floating-toc.active {
    transform: translateX(0);
  }

  body.mobile-layout .floating-toc:not(.active) {
    pointer-events: none;
  }

  .preview-layout {
    grid-template-columns: 1fr;
  }

  body.editing .editor-wrap:not(.editor-wrap--split) #preview-wrap,
  body.mobile-layout.editing .editor-wrap:not(.editor-wrap--split) #preview-wrap {
    display: none !important;
  }

  body.editing .editor-wrap:not(.editor-wrap--split) #editor-splitter,
  body.mobile-layout.editing .editor-wrap:not(.editor-wrap--split) #editor-splitter {
    display: none !important;
  }

  body.editing .editor-wrap--split,
  body.editing .editor-wrap,
  body.mobile-layout.editing .editor-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    padding: 0;
  }

  body.editing .editor-wrap:not(.editor-wrap--split) #markdown-wrap,
  body.mobile-layout.editing .editor-wrap:not(.editor-wrap--split) #markdown-wrap {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    border-radius: 0;
  }

  /* Mobile edit: editor only — hide live preview so the markdown pane can fill the screen */
  body.editing #preview-wrap,
  body.mobile-layout.editing .editor-wrap--split #preview-wrap,
  body.mobile-layout.editing .editor-wrap #preview-wrap,
  body.mobile-layout.editing #preview-wrap {
    display: none !important;
  }

  body.mobile-layout.editing .editor-wrap--split #markdown-wrap,
  body.mobile-layout.editing .editor-wrap #markdown-wrap,
  body.mobile-layout.editing #markdown-wrap {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    height: auto !important;
    border-bottom: none !important;
  }

  body.mobile-layout.editing .editor-wrap--split #editor-splitter,
  body.mobile-layout.editing #editor-splitter {
    display: none !important;
  }

  body.mobile-layout.editing .editor-wrap--split {
    display: flex !important;
    flex-direction: column;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }

  body.mobile-layout.editing #markdown-wrap .EasyMDEContainer {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    overflow: hidden;
  }

  body.mobile-layout.editing #markdown-wrap .CodeMirror {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
  }

  body.mobile-layout.editing #markdown-wrap .CodeMirror-scroll {
    height: 100%;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.mobile-layout.editing #markdown-wrap .editor-toolbar button.side-by-side,
  body.mobile-layout.editing .editor-toolbar-split-control,
  body.mobile-layout.editing .editor-toolbar-lineheight-control {
    display: none !important;
  }

  .editor-wrap--split {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  }

  .editor-wrap--split #markdown-wrap {
    grid-column: 1;
    grid-row: 1;
  }

  .editor-wrap--split #editor-splitter {
    display: none;
  }

  .editor-wrap--split #preview-wrap {
    grid-column: 1;
    grid-row: 2;
    display: flex !important;
  }

  body.mobile-layout.editing .editor-wrap--split #preview-wrap {
    display: none !important;
  }

  .sidebar {
    --tree-font-size: 18px;
    --tree-line-height: 36px;
    --tree-node-min-height: 36px;
  }

  #tree-search,
  #tag-search {
    font-size: 16px;
    min-height: 44px;
  }

  .tree-actions .btn {
    font-size: 14px;
    min-height: 40px;
  }
}

@media (min-width: 769px) {
  .mobile-page-fabs,
  .mobile-toc-btn,
  .mobile-toc-backdrop,
  .mobile-topbar-menu-btn,
  .mobile-topbar-menu-backdrop,
  .mobile-topbar-menu-title,
  .right-panel-backdrop,
  .right-panel-mobile-header { display: none !important; }
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}


@page {
  size: A4;
  margin: 20mm;
  color: #000 !important;
}

.pdf-export {
  color: #000;
  background: #fff;
  font-family: Inter, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

.pdf-export a {
  color: #000;
  text-decoration: underline;
}

.pdf-export.preview-layout h1 {
  border-bottom: 5px solid #333;
  padding-bottom: 5px;
  margin-bottom: 15px;
}

.pdf-export.preview-layout h2 {
  border-bottom: 4px solid #ccc;
  padding-bottom: 3px;
}

.pdf-export.preview-layout h3 {
  border-bottom: 2px solid #ccc;
  padding-bottom: 3px;
}

@media print {
  * {
    color: #000 !important;
  }
}


.page h1:not(:first-child) {
  page-break-before: always;
}


img,
table {
  page-break-inside: avoid;
  break-inside: avoid;
}

/* --- Sudoku --- */
.sudoku-block {
  --sudoku-bg: var(--panel, #1e1e2e);
  --sudoku-border: var(--line, #3b3b52);
  --sudoku-title: var(--text, #e2e8f0);
  --sudoku-meta: var(--muted, #94a3b8);
  --sudoku-accent: #38bdf8;
  --sudoku-cell-bg: rgba(255, 255, 255, 0.04);
  --sudoku-cell-given: rgba(56, 189, 248, 0.12);
  --sudoku-cell-selected: rgba(56, 189, 248, 0.22);
  --sudoku-cell-error: rgba(248, 113, 113, 0.25);
  --sudoku-cell-match: rgba(74, 222, 128, 0.18);
  border: 1px solid var(--sudoku-border);
  border-left: 4px solid var(--sudoku-accent);
  background: var(--sudoku-bg);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 16px 0;
  max-width: 420px;
}

.sudoku-block--info { --sudoku-accent: #38bdf8; }
.sudoku-block--success { --sudoku-accent: #4ade80; }
.sudoku-block--warning { --sudoku-accent: #fbbf24; }
.sudoku-block--danger { --sudoku-accent: #f87171; }
.sudoku-block--note { --sudoku-accent: #94a3b8; }

.sudoku-block--custom {
  --sudoku-accent: var(--sudoku-accent-custom, #38bdf8);
  background: var(--sudoku-bg-custom, var(--sudoku-bg));
}

.sudoku-block--error {
  color: #f87171;
  padding: 12px 14px;
}

.sudoku-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.sudoku-block-title {
  font-weight: 700;
  color: var(--sudoku-title);
}

.sudoku-block-meta {
  font-size: 12px;
  color: var(--sudoku-meta);
  text-transform: capitalize;
}

.sudoku-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 0;
  border: 2px solid var(--sudoku-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--sudoku-border);
}

.sudoku-cell {
  aspect-ratio: 1;
  border: none;
  margin: 0;
  padding: 0;
  background: var(--sudoku-cell-bg);
  color: var(--sudoku-title);
  font-size: clamp(14px, 3.2vw, 20px);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  line-height: 1;
}

.sudoku-cell--box-right {
  box-shadow: inset -2px 0 0 var(--sudoku-border);
}

.sudoku-cell--box-bottom {
  box-shadow: inset 0 -2px 0 var(--sudoku-border);
}

.sudoku-cell--box-right.sudoku-cell--box-bottom {
  box-shadow: inset -2px 0 0 var(--sudoku-border), inset 0 -2px 0 var(--sudoku-border);
}

.sudoku-cell--given {
  background: var(--sudoku-cell-given);
  color: var(--sudoku-accent);
  cursor: default;
  font-weight: 800;
}

.sudoku-cell--selected {
  background: var(--sudoku-cell-selected);
  outline: 2px solid var(--sudoku-accent);
  outline-offset: -2px;
  z-index: 1;
}

.sudoku-cell--error {
  background: var(--sudoku-cell-error);
  color: #fecaca;
}

.sudoku-cell--match {
  background: var(--sudoku-cell-match);
  color: #bbf7d0;
}

.sudoku-numpad {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.sudoku-num {
  min-width: 34px;
  width: auto;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--sudoku-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--sudoku-title);
  font-weight: 600;
  cursor: pointer;
}

.sudoku-num:hover {
  border-color: var(--sudoku-accent);
}

.sudoku-num--erase {
  min-width: 42px;
}

.sudoku-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.sudoku-actions .btn,
.puzzle-actions .btn {
  width: auto;
  min-width: 4.75rem;
  min-height: 31px;
  height: auto;
  white-space: nowrap;
  padding-left: 0.65rem;
  padding-right: 0.65rem;
}

.sudoku-status {
  min-height: 1.25rem;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--sudoku-meta);
}

.sudoku-status--success { color: #4ade80; }
.sudoku-status--warn { color: #fbbf24; }
.sudoku-status--info { color: var(--sudoku-meta); }

/* --- Puzzle (jigsaw) --- */
.puzzle-block {
  --puzzle-bg: var(--panel, #1e1e2e);
  --puzzle-border: var(--line, #3b3b52);
  --puzzle-title: var(--text, #e2e8f0);
  --puzzle-meta: var(--muted, #94a3b8);
  --puzzle-accent: #a78bfa;
  border: 1px solid var(--puzzle-border);
  border-left: 4px solid var(--puzzle-accent);
  background: var(--puzzle-bg);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 16px 0;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
}

.puzzle-block--info { --puzzle-accent: #38bdf8; }
.puzzle-block--success { --puzzle-accent: #4ade80; }
.puzzle-block--warning { --puzzle-accent: #fbbf24; }
.puzzle-block--danger { --puzzle-accent: #f87171; }
.puzzle-block--note { --puzzle-accent: #94a3b8; }

.puzzle-block--custom {
  background: var(--puzzle-bg-custom, var(--puzzle-bg));
}

.puzzle-block--error {
  color: #f87171;
  padding: 12px 14px;
}

.puzzle-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.puzzle-block-title {
  font-weight: 700;
  color: var(--puzzle-title);
}

.puzzle-block-meta {
  font-size: 12px;
  color: var(--puzzle-meta);
}

.puzzle-block-hint {
  font-size: 0.82rem;
  color: var(--puzzle-meta);
  margin: 0 0 10px;
}

.puzzle-jq-mount {
  position: relative;
  min-height: 48px;
  overflow: visible;
  width: fit-content;
  max-width: 100%;
}

.puzzle-jq-mount img {
  display: block;
  max-width: 100%;
  height: auto;
}

.puzzle-block .jigsaw.jigsaw--embedded {
  position: relative !important;
  left: 0 !important;
  top: 0 !important;
  width: auto !important;
  max-width: 100%;
  border-color: var(--puzzle-border);
  background: rgba(0, 0, 0, 0.15);
}

.puzzle-block .jigsaw.jigsaw--embedded div.puzzle {
  opacity: 0.35;
  background-repeat: no-repeat;
}

.puzzle-block .jigsaw.jigsaw--embedded.highlight {
  border-color: var(--puzzle-accent, #60a5fa);
}

.puzzle-block .jigsaw.jigsaw--embedded.resolved {
  border-color: #4ade80;
}

.puzzle-block .jigsaw.jigsaw--embedded .menu {
  display: none;
}

.puzzle-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.puzzle-status {
  min-height: 1.25rem;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--puzzle-meta);
}

.puzzle-status--success { color: #4ade80; }
.puzzle-status--warn { color: #fbbf24; }
.puzzle-status--info { color: var(--puzzle-meta); }

.puzzle-paste-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 88px;
  margin-top: 8px;
  padding: 16px 12px;
  border: 2px dashed var(--puzzle-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--puzzle-meta);
  cursor: pointer;
  text-align: center;
  outline: none;
}

.puzzle-paste-zone:focus,
.puzzle-paste-zone--hover {
  border-color: var(--puzzle-accent);
  color: var(--puzzle-title);
  background: rgba(167, 139, 250, 0.08);
}

.puzzle-paste-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.puzzle-paste-label {
  font-size: 0.82rem;
}

.puzzle-block--draft {
  min-width: min(100%, 280px);
}

.puzzle-block--uploading {
  opacity: 0.65;
  pointer-events: none;
}

/* --- Pinball --- */
.pinball-block {
  --pinball-bg: var(--panel, #1e1e2e);
  --pinball-border: var(--line, #3b3b52);
  --pinball-title: var(--text, #e2e8f0);
  --pinball-meta: var(--muted, #94a3b8);
  --pinball-accent: #fbbf24;
  border: 1px solid var(--pinball-border);
  border-left: 4px solid var(--pinball-accent);
  background: var(--pinball-bg);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 16px 0;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
}

.pinball-block--info { --pinball-accent: #38bdf8; }
.pinball-block--success { --pinball-accent: #4ade80; }
.pinball-block--warning { --pinball-accent: #fbbf24; }
.pinball-block--danger { --pinball-accent: #f87171; }
.pinball-block--note { --pinball-accent: #94a3b8; }

.pinball-block--custom {
  background: var(--pinball-bg-custom, var(--pinball-bg));
}

.pinball-block--error {
  color: #f87171;
  padding: 12px 14px;
}

.pinball-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.pinball-block-title {
  font-weight: 700;
  color: var(--pinball-title);
}

.pinball-block-meta {
  font-size: 12px;
  color: var(--pinball-meta);
  text-transform: capitalize;
}

.pinball-block-hint {
  font-size: 0.82rem;
  color: var(--pinball-meta);
  margin: 0 0 8px;
}

.pinball-frame-wrap {
  width: min(100%, 600px);
  aspect-ratio: 4 / 5;
  max-height: min(70vh, 640px);
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--pinball-border);
  background: #000;
}

.pinball-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.pinball-status {
  min-height: 1.25rem;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--pinball-meta);
}

.pinball-status--success { color: #4ade80; }
.pinball-status--info { color: var(--pinball-meta); }

/* --- Pac-Man --- */
.pacman-block {
  --pacman-bg: var(--panel, #1e1e2e);
  --pacman-border: var(--line, #3b3b52);
  --pacman-title: var(--text, #e2e8f0);
  --pacman-meta: var(--muted, #94a3b8);
  --pacman-accent: #ffe500;
  border: 1px solid var(--pacman-border);
  border-left: 4px solid var(--pacman-accent);
  background: var(--pacman-bg);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 16px 0;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
}

.pacman-block--info { --pacman-accent: #38bdf8; }
.pacman-block--success { --pacman-accent: #4ade80; }
.pacman-block--warning { --pacman-accent: #fbbf24; }
.pacman-block--danger { --pacman-accent: #f87171; }
.pacman-block--note { --pacman-accent: #94a3b8; }

.pacman-block--custom {
  background: var(--pacman-bg-custom, var(--pacman-bg));
}

.pacman-block--error {
  color: #f87171;
  padding: 12px 14px;
}

.pacman-block:focus {
  outline: 2px solid var(--pacman-accent);
  outline-offset: 2px;
}

.pacman-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.pacman-block-title {
  font-weight: 700;
  color: var(--pacman-title);
}

.pacman-block-meta {
  font-size: 12px;
  color: var(--pacman-meta);
  text-transform: capitalize;
}

.pacman-block-hint {
  font-size: 0.82rem;
  color: var(--pacman-meta);
  margin: 0 0 8px;
}

.pacman-stage {
  width: min(100%, 448px);
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--pacman-border);
  background: #000;
  transform: translateZ(0);
}

.pacman-canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #000;
  image-rendering: auto;
}

.pacman-pad {
  display: none;
  margin-top: 10px;
  grid-template-columns: 72px 72px 72px;
  grid-template-areas:
    ". up ."
    "left down right";
  justify-content: center;
  gap: 8px;
  user-select: none;
  -webkit-user-select: none;
}

.pacman-pad.is-visible {
  display: grid;
}

.pacman-pad__btn {
  touch-action: none;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.72);
  color: #e2e8f0;
  font: 600 16px/1 system-ui, sans-serif;
  border-radius: 14px;
  min-height: 52px;
}

.pacman-pad__btn--up { grid-area: up; }
.pacman-pad__btn--left { grid-area: left; }
.pacman-pad__btn--down { grid-area: down; }
.pacman-pad__btn--right { grid-area: right; }

.pacman-pad__btn:active,
.pacman-pad__btn.is-active {
  background: rgba(255, 229, 0, 0.28);
  border-color: rgba(255, 229, 0, 0.85);
  color: #fff;
}

.pacman-status {
  min-height: 1.25rem;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--pacman-meta);
}

/* --- Super Mario --- */
.mario-block {
  --mario-bg: var(--panel, #1e1e2e);
  --mario-border: var(--line, #3b3b52);
  --mario-title: var(--text, #e2e8f0);
  --mario-meta: var(--muted, #94a3b8);
  --mario-accent: #e52521;
  border: 1px solid var(--mario-border);
  border-left: 4px solid var(--mario-accent);
  background: var(--mario-bg);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 16px 0;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
}

.mario-block--info { --mario-accent: #38bdf8; }
.mario-block--success { --mario-accent: #4ade80; }
.mario-block--warning { --mario-accent: #fbbf24; }
.mario-block--danger { --mario-accent: #f87171; }
.mario-block--note { --mario-accent: #94a3b8; }

.mario-block--custom {
  background: var(--mario-bg-custom, var(--mario-bg));
}

.mario-block--error {
  color: #f87171;
  padding: 12px 14px;
}

.mario-block:focus {
  outline: 2px solid var(--mario-accent);
  outline-offset: 2px;
}

.mario-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.mario-block-title {
  font-weight: 700;
  color: var(--mario-title);
}

.mario-block-meta {
  font-size: 12px;
  color: var(--mario-meta);
  text-transform: capitalize;
}

.mario-block-hint {
  font-size: 0.82rem;
  color: var(--mario-meta);
  margin: 0 0 8px;
}

.mario-stage {
  width: min(100%, 640px);
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--mario-border);
  background: #5c94fc;
  transform: translateZ(0);
}

.mario-canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #5c94fc;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.mario-pad {
  display: none;
  margin-top: 10px;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: stretch;
  user-select: none;
  -webkit-user-select: none;
}

.mario-pad.is-visible {
  display: grid;
}

.mario-pad__btn {
  touch-action: none;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.72);
  color: #e2e8f0;
  font: 600 15px/1 system-ui, sans-serif;
  border-radius: 16px;
  min-height: 56px;
}

.mario-pad__btn--jump {
  min-width: 88px;
  background: rgba(229, 37, 33, 0.35);
  border-color: rgba(229, 37, 33, 0.7);
}

.mario-pad__btn:active,
.mario-pad__btn.is-active {
  background: rgba(252, 188, 24, 0.35);
  border-color: rgba(252, 188, 24, 0.85);
  color: #fff;
}

.mario-status {
  min-height: 1.25rem;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--mario-meta);
}

/* --- Lemmings --- */
.lemmings-block {
  --lemmings-bg: var(--panel, #1e1e2e);
  --lemmings-border: var(--line, #3b3b52);
  --lemmings-title: var(--text, #e2e8f0);
  --lemmings-meta: var(--muted, #94a3b8);
  --lemmings-accent: #7cfc00;
  border: 1px solid var(--lemmings-border);
  border-left: 4px solid var(--lemmings-accent);
  background: var(--lemmings-bg);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 16px 0;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
}

.lemmings-block--info { --lemmings-accent: #38bdf8; }
.lemmings-block--success { --lemmings-accent: #4ade80; }
.lemmings-block--warning { --lemmings-accent: #fbbf24; }
.lemmings-block--danger { --lemmings-accent: #f87171; }
.lemmings-block--note { --lemmings-accent: #94a3b8; }

.lemmings-block--custom {
  background: var(--lemmings-bg-custom, var(--lemmings-bg));
}

.lemmings-block--error {
  color: #f87171;
  padding: 12px 14px;
}

.lemmings-block:focus {
  outline: 2px solid var(--lemmings-accent);
  outline-offset: 2px;
}

.lemmings-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.lemmings-block-title {
  font-weight: 700;
  color: var(--lemmings-title);
}

.lemmings-block-meta {
  font-size: 12px;
  color: var(--lemmings-meta);
  text-transform: capitalize;
}

.lemmings-block-hint {
  font-size: 0.82rem;
  color: var(--lemmings-meta);
  margin: 0 0 8px;
}

.lemmings-stage {
  width: min(100%, 640px);
  border-radius: 10px 10px 0 0;
  overflow: hidden;
  border: 2px solid var(--lemmings-border);
  border-bottom: none;
  background: #5aa0d6;
  transform: translateZ(0);
}

.lemmings-canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #5aa0d6;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.lemmings-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  width: min(100%, 640px);
  box-sizing: border-box;
  border: 2px solid var(--lemmings-border);
  border-radius: 0 0 10px 10px;
  background: #1a1d28;
}

.lemmings-skill {
  flex: 1 1 72px;
  min-height: 52px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.85);
  color: #e2e8f0;
  font: 600 11px/1.2 system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
}

.lemmings-skill.is-active {
  background: rgba(124, 252, 0, 0.22);
  border-color: #7cfc00;
  color: #fff;
}

.lemmings-skill__key {
  font-size: 9px;
  opacity: 0.65;
}

.lemmings-skill__n {
  font-size: 13px;
  color: #7cfc00;
}

.lemmings-skill--ctrl {
  background: rgba(229, 37, 33, 0.18);
  border-color: rgba(229, 37, 33, 0.45);
}

.lemmings-status {
  min-height: 1.25rem;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--lemmings-meta);
}

/* --- Tic Tac Toe --- */
.tictactoe-block {
  --tictactoe-bg: var(--panel, #1e1e2e);
  --tictactoe-border: var(--line, #3b3b52);
  --tictactoe-title: var(--text, #e2e8f0);
  --tictactoe-meta: var(--muted, #94a3b8);
  --tictactoe-accent: #38bdf8;
  border: 1px solid var(--tictactoe-border);
  border-left: 4px solid var(--tictactoe-accent);
  background: var(--tictactoe-bg);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 16px 0;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
}

.tictactoe-block--info { --tictactoe-accent: #38bdf8; }
.tictactoe-block--success { --tictactoe-accent: #4ade80; }
.tictactoe-block--warning { --tictactoe-accent: #fbbf24; }
.tictactoe-block--danger { --tictactoe-accent: #f87171; }
.tictactoe-block--note { --tictactoe-accent: #94a3b8; }

.tictactoe-block--custom {
  background: var(--tictactoe-bg-custom, var(--tictactoe-bg));
}

.tictactoe-block--error {
  color: #f87171;
  padding: 12px 14px;
}

.tictactoe-block:focus {
  outline: 2px solid var(--tictactoe-accent);
  outline-offset: 2px;
}

.tictactoe-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.tictactoe-block-title {
  font-weight: 700;
  color: var(--tictactoe-title);
}

.tictactoe-block-meta {
  font-size: 12px;
  color: var(--tictactoe-meta);
  text-transform: capitalize;
}

.tictactoe-block-hint {
  font-size: 0.82rem;
  color: var(--tictactoe-meta);
  margin: 0 0 8px;
}

.tictactoe-play-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.tictactoe-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: min(100%, 360px);
}

.tictactoe-toolbar-gap {
  width: 8px;
}

.tictactoe-chip {
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.65);
  color: #cbd5e1;
  border-radius: 999px;
  width: auto;
  min-width: max-content;
  height: auto;
  min-height: 32px;
  padding: 6px 14px;
  font: 600 12px/1.2 system-ui, sans-serif;
  white-space: nowrap;
  cursor: pointer;
}

.tictactoe-chip.is-active {
  background: rgba(56, 189, 248, 0.22);
  border-color: rgba(56, 189, 248, 0.7);
  color: #e0f2fe;
}

.tictactoe-score {
  display: flex;
  gap: 14px;
  font: 600 13px/1.2 system-ui, sans-serif;
  color: var(--tictactoe-meta);
}

.tictactoe-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(78px, 118px));
  grid-template-rows: repeat(3, minmax(78px, 118px));
  gap: 8px;
  width: min(100%, 380px);
}

.tictactoe-cell {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.72);
  color: #e2e8f0;
  font: 700 2.4rem/1 system-ui, sans-serif;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}

.tictactoe-cell--empty:hover {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.55);
}

.tictactoe-cell--last:not(.tictactoe-cell--win) {
  box-shadow: inset 0 0 0 2px rgba(250, 204, 21, 0.7);
}

.tictactoe-block--busy .tictactoe-cell--empty {
  cursor: wait;
}

.tictactoe-cell:disabled {
  cursor: default;
}

.tictactoe-cell--x { color: #38bdf8; }
.tictactoe-cell--o { color: #fb923c; }
.tictactoe-cell--win {
  background: rgba(74, 222, 128, 0.22);
  border-color: #4ade80;
}

.tictactoe-actions {
  display: flex;
  gap: 8px;
}

.tictactoe-status {
  min-height: 1.25rem;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--tictactoe-meta);
}

.tictactoe-status--success { color: #4ade80; }
.tictactoe-status--warn { color: #fbbf24; }
.tictactoe-status--info { color: var(--tictactoe-meta); }

/* --- Strategy boards (chess, connect 4, reversi) --- */
.chess-block,
.connect4-block,
.reversi-block, .muhle-block {
  --strat-bg: var(--panel, #1e1e2e);
  --strat-border: var(--line, #3b3b52);
  --strat-title: var(--text, #e2e8f0);
  --strat-meta: var(--muted, #94a3b8);
  --strat-accent: #38bdf8;
  border: 1px solid var(--strat-border);
  border-left: 4px solid var(--strat-accent);
  background: var(--strat-bg);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 16px 0;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
}
.chess-block { --strat-accent: #e2e8f0; --chess-accent: var(--strat-accent); --chess-bg: var(--strat-bg); --chess-meta: var(--strat-meta); }
.connect4-block { --strat-accent: #38bdf8; --connect4-accent: var(--strat-accent); --connect4-bg: var(--strat-bg); --connect4-meta: var(--strat-meta); }
.reversi-block { --strat-accent: #4ade80; --reversi-accent: var(--strat-accent); --reversi-bg: var(--strat-bg); --reversi-meta: var(--strat-meta); }
.muhle-block { --strat-accent: #f59e0b; --muhle-accent: var(--strat-accent); --muhle-bg: var(--strat-bg); --muhle-meta: var(--strat-meta); }
.chess-block--info, .connect4-block--info, .reversi-block--info, .muhle-block--info { --strat-accent: #38bdf8; }
.chess-block--success, .connect4-block--success, .reversi-block--success, .muhle-block--success { --strat-accent: #4ade80; }
.chess-block--warning, .connect4-block--warning, .reversi-block--warning, .muhle-block--warning { --strat-accent: #fbbf24; }
.chess-block--danger, .connect4-block--danger, .reversi-block--danger, .muhle-block--danger { --strat-accent: #f87171; }
.chess-block--note, .connect4-block--note, .reversi-block--note, .muhle-block--note { --strat-accent: #94a3b8; }
.chess-block--custom, .connect4-block--custom, .reversi-block--custom, .muhle-block--custom { background: var(--strat-bg); }
.chess-block--error, .connect4-block--error, .reversi-block--error, .muhle-block--error { color: #f87171; padding: 12px 14px; }
.chess-block:focus, .connect4-block:focus, .reversi-block:focus, .muhle-block:focus {
  outline: 2px solid var(--strat-accent);
  outline-offset: 2px;
}
.chess-block-header, .connect4-block-header, .reversi-block-header, .muhle-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.chess-block-title, .connect4-block-title, .reversi-block-title, .muhle-block-title { font-weight: 700; color: var(--strat-title); }
.chess-block-meta, .connect4-block-meta, .reversi-block-meta, .muhle-block-meta {
  font-size: 12px;
  color: var(--strat-meta);
  text-transform: capitalize;
}
.chess-play-area, .connect4-play-area, .reversi-play-area, .muhle-play-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.chess-toolbar, .connect4-toolbar, .reversi-toolbar, .muhle-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: min(100%, 420px);
}
.chess-toolbar-gap, .connect4-toolbar-gap, .reversi-toolbar-gap, .muhle-toolbar-gap { width: 8px; }
.chess-chip, .connect4-chip, .reversi-chip, .muhle-chip {
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.65);
  color: #cbd5e1;
  border-radius: 999px;
  width: auto;
  min-width: max-content;
  height: auto;
  min-height: 32px;
  padding: 6px 14px;
  font: 600 12px/1.2 system-ui, sans-serif;
  white-space: nowrap;
  cursor: pointer;
}
.chess-chip.is-active, .connect4-chip.is-active, .reversi-chip.is-active, .muhle-chip.is-active {
  background: rgba(56, 189, 248, 0.22);
  border-color: rgba(56, 189, 248, 0.7);
  color: #e0f2fe;
}
.chess-score, .connect4-score, .reversi-score, .muhle-score {
  display: flex;
  gap: 14px;
  font: 600 13px/1.2 system-ui, sans-serif;
  color: var(--strat-meta);
}
.chess-actions, .connect4-actions, .reversi-actions, .muhle-actions { display: flex; gap: 8px; }
.chess-status, .connect4-status, .reversi-status, .muhle-status {
  min-height: 1.25rem;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--strat-meta);
}
.chess-status--success, .connect4-status--success, .reversi-status--success, .muhle-status--success { color: #4ade80; }
.chess-status--warn, .connect4-status--warn, .reversi-status--warn, .muhle-status--warn { color: #fbbf24; }
.chess-status--info, .connect4-status--info, .reversi-status--info, .muhle-status--info { color: var(--strat-meta); }
.chess-block--busy .chess-sq, .connect4-block--busy .connect4-cell, .reversi-block--busy .reversi-cell { cursor: wait; }

.chess-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(36px, 52px));
  grid-template-rows: repeat(8, minmax(36px, 52px));
  width: min(100%, 420px);
  border: 2px solid #0f172a;
  border-radius: 8px;
  overflow: hidden;
}
.chess-sq {
  border: none;
  font: 700 1.45rem/1 "Segoe UI Symbol", "Noto Sans Symbols 2", serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.chess-sq--light { background: #e7edf5; }
.chess-sq--dark { background: #5b7c99; }
.chess-sq--sel { box-shadow: inset 0 0 0 3px #facc15; }
.chess-sq--dest { box-shadow: inset 0 0 0 3px #4ade80; }
.chess-sq--w {
  color: #f8fafc;
  -webkit-text-stroke: 0.7px #1e293b;
  text-shadow: 0 1px 1px rgba(15, 23, 42, 0.45);
}
.chess-sq--b {
  color: #0f172a;
  -webkit-text-stroke: 0.5px #e2e8f0;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.connect4-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(42px, 58px));
  grid-template-rows: repeat(6, minmax(42px, 58px));
  gap: 6px;
  padding: 10px;
  width: min(100%, 440px);
  background: #1d4ed8;
  border-radius: 16px;
}
.connect4-cell {
  border: none;
  border-radius: 50%;
  background: #0f172a;
  cursor: pointer;
  padding: 0;
}
.connect4-cell--x { background: radial-gradient(circle at 35% 30%, #fb7185, #dc2626); }
.connect4-cell--o { background: radial-gradient(circle at 35% 30%, #fde047, #ca8a04); }
.connect4-cell--empty:hover { background: #1e293b; }
.connect4-cell--win { box-shadow: 0 0 0 3px #4ade80; }

.reversi-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(36px, 48px));
  grid-template-rows: repeat(8, minmax(36px, 48px));
  width: min(100%, 400px);
  background: #14532d;
  border: 3px solid #052e16;
  border-radius: 8px;
}
.reversi-cell {
  border: 1px solid rgba(20, 83, 45, 0.7);
  background: #15803d;
  cursor: pointer;
  padding: 0;
  position: relative;
}
.reversi-cell--b::after,
.reversi-cell--w::after,
.reversi-cell--hint::after {
  content: "";
  position: absolute;
  inset: 18%;
  border-radius: 50%;
}
.reversi-cell--b::after { background: radial-gradient(circle at 35% 30%, #475569, #020617); }
.reversi-cell--w::after { background: radial-gradient(circle at 35% 30%, #fff, #cbd5e1); }
.reversi-cell--hint::after {
  background: rgba(254, 240, 138, 0.35);
  inset: 38%;
}
.reversi-cell--empty:hover { background: #16a34a; }

.chess-block--fullscreen,
.connect4-block--fullscreen,
.reversi-block--fullscreen, .muhle-block--fullscreen, .backgammon-block--fullscreen {
  background: #0f172a;
  min-height: min(90vh, 960px);
}


.muhle-board {
  position: relative;
  width: min(100%, 440px);
  aspect-ratio: 1;
  background: radial-gradient(circle at 50% 40%, #166534, #14532d 55%, #052e16);
  border: 8px solid #92400e;
  border-radius: 18px;
  box-shadow: inset 0 0 0 3px #fbbf24;
}
.muhle-lines { position: absolute; inset: 0; width: 100%; height: 100%; }
.muhle-lines path { fill: none; stroke: #f8fafc; stroke-width: 1.6; stroke-linecap: square; }
.muhle-point {
  position: absolute;
  width: 12%;
  height: 12%;
  transform: translate(-50%, -50%);
  border: none;
  border-radius: 50%;
  background: transparent;
  padding: 0;
  cursor: pointer;
}
.muhle-point::after {
  content: "";
  display: block;
  width: 34%;
  height: 34%;
  margin: 33%;
  border-radius: 50%;
  background: #0f172a;
  box-shadow: inset 0 0 0 2px rgba(248, 250, 252, 0.35);
}
.muhle-point--x::after,
.muhle-point--o::after { width: 78%; height: 78%; margin: 11%; }
.muhle-point--x::after { background: radial-gradient(circle at 35% 30%, #fff, #e2e8f0 45%, #94a3b8); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35); }
.muhle-point--o::after { background: radial-gradient(circle at 35% 30%, #475569, #0f172a 55%, #020617); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.45); }
.muhle-point--mill::after { box-shadow: 0 0 0 3px #fbbf24; }
.muhle-point--dest::after { box-shadow: 0 0 0 3px #4ade80; }
.muhle-point--sel::after { box-shadow: 0 0 0 3px #facc15; }
.muhle-point--take::after { box-shadow: 0 0 0 3px #fb7185; }
.muhle-block--busy .muhle-point { cursor: wait; }
.muhle-result {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  color: #f8fafc;
  font: 700 16px/1.2 system-ui, sans-serif;
  pointer-events: none;
  white-space: nowrap;
}
.muhle-result[hidden] { display: none; }
.muhle-score {
  font-size: 15px;
  color: var(--strat-title, #e2e8f0);
}
.muhle-score [data-score="x"] { color: #f8fafc; }
.muhle-score [data-score="o"] { color: #cbd5e1; }
.muhle-score {
  font-size: 15px;
  color: var(--strat-title, #e2e8f0);
}
.muhle-score [data-score="x"] { color: #f8fafc; }
.muhle-score [data-score="o"] { color: #cbd5e1; }
.muhle-block--fullscreen .muhle-board,
.muhle-block:fullscreen .muhle-board,
.muhle-block:-webkit-full-screen .muhle-board { width: min(92vw, 72vh); }

/* --- Backgammon --- */
.backgammon-block {
  --strat-bg: var(--panel, #1e1e2e);
  --strat-border: var(--line, #3b3b52);
  --strat-title: var(--text, #e2e8f0);
  --strat-meta: var(--muted, #94a3b8);
  --strat-accent: #fb7185;
  --backgammon-accent: var(--strat-accent);
  --backgammon-bg: var(--strat-bg);
  --backgammon-meta: var(--strat-meta);
  border: 1px solid var(--strat-border);
  border-left: 4px solid var(--strat-accent);
  background: var(--strat-bg);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 16px 0;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
}
.backgammon-block--info { --strat-accent: #38bdf8; }
.backgammon-block--success { --strat-accent: #4ade80; }
.backgammon-block--warning { --strat-accent: #fbbf24; }
.backgammon-block--danger { --strat-accent: #f87171; }
.backgammon-block--note { --strat-accent: #94a3b8; }
.backgammon-block--custom { background: var(--strat-bg); }
.backgammon-block--error { color: #f87171; padding: 12px 14px; }
.backgammon-block:focus {
  outline: 2px solid var(--strat-accent);
  outline-offset: 2px;
}
.backgammon-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.backgammon-block-title { font-weight: 700; color: var(--strat-title); }
.backgammon-block-meta {
  font-size: 12px;
  color: var(--strat-meta);
  text-transform: capitalize;
}
.backgammon-play-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.backgammon-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: min(100%, 520px);
}
.backgammon-toolbar-gap { width: 8px; }
.backgammon-chip {
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.65);
  color: #cbd5e1;
  border-radius: 999px;
  width: auto;
  min-width: max-content;
  height: auto;
  min-height: 32px;
  padding: 6px 14px;
  font: 600 12px/1.2 system-ui, sans-serif;
  white-space: nowrap;
  cursor: pointer;
}
.backgammon-chip.is-active {
  background: rgba(251, 113, 133, 0.22);
  border-color: rgba(251, 113, 133, 0.7);
  color: #ffe4e6;
}
.backgammon-score {
  display: flex;
  gap: 14px;
  font: 600 13px/1.2 system-ui, sans-serif;
  color: var(--strat-meta);
}
.backgammon-actions { display: flex; gap: 8px; }
.backgammon-status {
  min-height: 1.25rem;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--strat-meta);
}
.backgammon-status--success { color: #4ade80; }
.backgammon-status--warn { color: #fbbf24; }
.backgammon-status--info { color: var(--strat-meta); }
.backgammon-block--busy .bg-point,
.backgammon-block--busy .bg-bar,
.backgammon-block--busy .bg-off { cursor: wait; }

.bg-board {
  display: flex;
  align-items: stretch;
  width: min(100%, 760px);
  background: linear-gradient(180deg, #5b3a1e, #3f2612);
  border: 6px solid #2a1608;
  border-radius: 12px;
  padding: 8px;
  gap: 6px;
  box-shadow: inset 0 0 0 2px #c4a574;
}
.bg-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #14532d;
  border-radius: 6px;
  overflow: hidden;
}
.bg-row {
  display: flex;
  flex: 1;
  min-height: 168px;
}
.bg-quad {
  flex: 6;
  display: flex;
  min-width: 0;
}
.bg-point {
  position: relative;
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}
.bg-point__tri {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.bg-row--top .bg-point__tri { clip-path: polygon(6% 0, 94% 0, 50% 92%); }
.bg-row--bottom .bg-point__tri { clip-path: polygon(50% 8%, 6% 100%, 94% 100%); }
.bg-point--dark .bg-point__tri { background: linear-gradient(#9a3412, #7c2d12); }
.bg-point--light .bg-point__tri { background: linear-gradient(#f5e0c0, #e7c59a); }
.bg-point--sel .bg-point__tri { box-shadow: inset 0 0 0 3px #facc15; }
.bg-point--dest .bg-point__tri { filter: brightness(1.25); box-shadow: inset 0 0 0 3px #4ade80; }
.bg-point__stack {
  position: absolute;
  left: 50%;
  width: 72%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 1;
}
.bg-row--top .bg-point__stack { top: 6px; }
.bg-row--bottom .bg-point__stack { bottom: 6px; flex-direction: column-reverse; }
.bg-point__num {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  font: 600 10px/1 ui-sans-serif, system-ui, sans-serif;
  color: rgba(254, 243, 199, 0.72);
  pointer-events: none;
  z-index: 2;
}
.bg-row--top .bg-point__num { bottom: 2px; }
.bg-row--bottom .bg-point__num { top: 2px; }
.bg-checker {
  width: 100%;
  max-width: 28px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: block;
  flex: 0 0 auto;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.bg-checker--w { background: radial-gradient(circle at 32% 28%, #fff7ed, #e7d3ad 55%, #c4a574); }
.bg-checker--b { background: radial-gradient(circle at 32% 28%, #3f3f46, #18181b 55%, #09090b); }
.bg-checker-count {
  min-width: 1.3em;
  padding: 1px 4px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.82);
  color: #fde68a;
  font: 700 10px/1.2 ui-sans-serif, system-ui, sans-serif;
}
.bg-bar,
.bg-off {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: none;
  cursor: pointer;
  padding: 4px 3px;
}
.bg-bar {
  flex: 0 0 28px;
  background: repeating-linear-gradient(180deg, #92400e 0 8px, #78350f 8px 16px);
}
.bg-bar--sel,
.bg-off--dest { box-shadow: inset 0 0 0 3px #4ade80; }
.bg-off {
  flex: 0 0 42px;
  background: #1c1917;
  border-radius: 6px;
  color: #e7d3ad;
}
.bg-off-label,
.bg-off-count {
  font: 700 10px/1 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.bg-dice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 48px;
}
.bg-dice-faces { display: flex; gap: 8px; }
.bg-die {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 42px;
  height: 42px;
  padding: 5px;
  border-radius: 8px;
  background: #f8fafc;
  box-shadow: 0 2px 0 #cbd5e1, 0 3px 8px rgba(0, 0, 0, 0.28);
}
.bg-die.is-used { opacity: 0.32; }
.bg-die-cell { border-radius: 50%; }
.bg-die-cell.is-pip { background: #0f172a; }
.backgammon-block--fullscreen {
  background: #0f172a;
  min-height: min(90vh, 960px);
}
.backgammon-block--fullscreen .bg-board,
.backgammon-block:fullscreen .bg-board,
.backgammon-block:-webkit-full-screen .bg-board {
  width: min(96vw, 1100px);
}

/* --- Tetris --- */
.tetris-block {
  --tetris-bg: var(--panel, #1e1e2e);
  --tetris-border: var(--line, #3b3b52);
  --tetris-title: var(--text, #e2e8f0);
  --tetris-meta: var(--muted, #94a3b8);
  --tetris-accent: #22d3ee;
  border: 1px solid var(--tetris-border);
  border-left: 4px solid var(--tetris-accent);
  background: var(--tetris-bg);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 16px 0;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
}

.tetris-block--info { --tetris-accent: #38bdf8; }
.tetris-block--success { --tetris-accent: #4ade80; }
.tetris-block--warning { --tetris-accent: #fbbf24; }
.tetris-block--danger { --tetris-accent: #f87171; }
.tetris-block--note { --tetris-accent: #94a3b8; }

.tetris-block--custom {
  background: var(--tetris-bg-custom, var(--tetris-bg));
}

.tetris-block--error {
  color: #f87171;
  padding: 12px 14px;
}

.tetris-block:focus {
  outline: 2px solid var(--tetris-accent);
  outline-offset: 2px;
}

.tetris-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.tetris-block-title {
  font-weight: 700;
  color: var(--tetris-title);
}

.tetris-block-meta {
  font-size: 12px;
  color: var(--tetris-meta);
  text-transform: capitalize;
}

.tetris-block-hint {
  font-size: 0.82rem;
  color: var(--tetris-meta);
  margin: 0 0 8px;
}

.tetris-stage {
  width: min(100%, 420px);
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--tetris-border);
  background: #0b1020;
  display: flex;
  justify-content: center;
}

.tetris-canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #0b1020;
}

.tetris-pad {
  display: none;
  margin-top: 10px;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-areas:
    "hold rot drop"
    "left down right";
  gap: 8px;
  width: min(100%, 360px);
  user-select: none;
  -webkit-user-select: none;
}

.tetris-pad.is-visible {
  display: grid;
}

.tetris-pad__btn {
  touch-action: none;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.72);
  color: #e2e8f0;
  font: 600 14px/1 system-ui, sans-serif;
  border-radius: 14px;
  min-height: 52px;
}

.tetris-pad__btn--hold { grid-area: hold; }
.tetris-pad__btn--rot { grid-area: rot; }
.tetris-pad__btn--drop { grid-area: drop; }
.tetris-pad__btn--left { grid-area: left; }
.tetris-pad__btn--down { grid-area: down; }
.tetris-pad__btn--right { grid-area: right; }

.tetris-pad__btn:active,
.tetris-pad__btn.is-active {
  background: rgba(34, 211, 238, 0.28);
}

.tetris-status {
  min-height: 1.25rem;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--tetris-meta);
}

/* --- Sokoban --- */
.sokoban-block {
  --sokoban-bg: var(--panel, #1e1e2e);
  --sokoban-border: var(--line, #3b3b52);
  --sokoban-title: var(--text, #e2e8f0);
  --sokoban-meta: var(--muted, #94a3b8);
  --sokoban-accent: #fbbf24;
  border: 1px solid var(--sokoban-border);
  border-left: 4px solid var(--sokoban-accent);
  background: var(--sokoban-bg);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 16px 0;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
}

.sokoban-block--info { --sokoban-accent: #38bdf8; }
.sokoban-block--success { --sokoban-accent: #4ade80; }
.sokoban-block--warning { --sokoban-accent: #fbbf24; }
.sokoban-block--danger { --sokoban-accent: #f87171; }
.sokoban-block--note { --sokoban-accent: #94a3b8; }

.sokoban-block--custom { background: var(--sokoban-bg); }
.sokoban-block--error { color: #f87171; padding: 12px 14px; }

.sokoban-block:focus {
  outline: 2px solid var(--sokoban-accent);
  outline-offset: 2px;
}

.sokoban-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.sokoban-block-title { font-weight: 700; color: var(--sokoban-title); }
.sokoban-block-meta { font-size: 12px; color: var(--sokoban-meta); }
.sokoban-block-hint { font-size: 0.82rem; color: var(--sokoban-meta); margin: 0 0 8px; }

.sokoban-stage {
  position: relative;
  width: min(100%, 640px);
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--sokoban-border);
  background: #0f172a;
}

.sokoban-canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #0f172a;
}

.sokoban-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.sokoban-pad {
  display: none;
  margin-top: 10px;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-areas:
    ". up ."
    "left down right";
  gap: 8px;
  width: min(100%, 280px);
  user-select: none;
  -webkit-user-select: none;
}

.sokoban-pad.is-visible {
  display: grid;
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 3;
  margin: 0;
  width: min(46%, 168px);
}
.sokoban-pad__btn {
  touch-action: none;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.72);
  color: #e2e8f0;
  font: 600 16px/1 system-ui, sans-serif;
  border-radius: 14px;
  min-height: 52px;
}
.sokoban-pad__btn--up { grid-area: up; }
.sokoban-pad__btn--left { grid-area: left; }
.sokoban-pad__btn--down { grid-area: down; }
.sokoban-pad__btn--right { grid-area: right; }

.sokoban-status {
  min-height: 1.25rem;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--sokoban-meta);
}

.sokoban-tips-bar {
  position: absolute;
  top: 30px;
  left: 10px;
  right: 52px;
  z-index: 4;
  margin: 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.78);
  color: #fde68a;
  font-size: 0.78rem;
  line-height: 1.35;
  pointer-events: none;
}

.sokoban-tips-bar[hidden] {
  display: none !important;
}

.sokoban-tips {
  display: none;
  position: absolute;
  top: 10px;
  left: 10px;
  right: 52px;
  z-index: 5;
  max-height: min(64%, 280px);
  overflow: auto;
  padding: 8px 10px 10px;
  border-radius: 12px;
  border: 1px solid rgba(251, 191, 36, 0.4);
  background: rgba(15, 23, 42, 0.94);
  color: #e2e8f0;
  font-size: 0.82rem;
  line-height: 1.35;
}

.sokoban-tips.is-open {
  display: block;
}

.sokoban-tips__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  color: #fde68a;
}

.sokoban-tips__close {
  border: 0;
  background: transparent;
  color: #e2e8f0;
  font-size: 1.25rem;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
}

.sokoban-tips__how,
.sokoban-tips__controls {
  margin: 0 0 6px;
  color: #cbd5e1;
}

.sokoban-tips__level {
  margin: 0 0 8px;
  color: #fef3c7;
}

.sokoban-tips__controls--mobile {
  display: none;
}

body.mobile-layout .sokoban-tips__controls--desktop {
  display: none;
}

body.mobile-layout .sokoban-tips__controls--mobile {
  display: block;
}

@media (max-width: 768px) {
  .sokoban-tips__controls--desktop { display: none; }
  .sokoban-tips__controls--mobile { display: block; }
}

/* --- Space Invaders --- */
.invaders-block {
  --invaders-bg: var(--panel, #1e1e2e);
  --invaders-border: var(--line, #3b3b52);
  --invaders-title: var(--text, #e2e8f0);
  --invaders-meta: var(--muted, #94a3b8);
  --invaders-accent: #4ade80;
  border: 1px solid var(--invaders-border);
  border-left: 4px solid var(--invaders-accent);
  background: var(--invaders-bg);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 16px 0;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
}

.invaders-block--info { --invaders-accent: #38bdf8; }
.invaders-block--success { --invaders-accent: #4ade80; }
.invaders-block--warning { --invaders-accent: #fbbf24; }
.invaders-block--danger { --invaders-accent: #f87171; }
.invaders-block--note { --invaders-accent: #94a3b8; }
.invaders-block--custom { background: var(--invaders-bg); }
.invaders-block--error { color: #f87171; padding: 12px 14px; }
.invaders-block:focus {
  outline: 2px solid var(--invaders-accent);
  outline-offset: 2px;
}

.invaders-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.invaders-block-title { font-weight: 700; color: var(--invaders-title); }
.invaders-block-meta { font-size: 12px; color: var(--invaders-meta); }
.invaders-block-hint { font-size: 0.82rem; color: var(--invaders-meta); margin: 0 0 8px; }

.invaders-stage {
  width: min(100%, 480px);
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--invaders-border);
  background: #05060d;
  display: flex;
  justify-content: center;
}

.invaders-canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #05060d;
}

.invaders-pad {
  display: none;
  margin-top: 10px;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-areas: "left fire right";
  gap: 8px;
  width: min(100%, 360px);
  user-select: none;
  -webkit-user-select: none;
}
.invaders-pad.is-visible { display: grid; }
.invaders-pad__btn {
  touch-action: none;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.72);
  color: #e2e8f0;
  font: 600 14px/1 system-ui, sans-serif;
  border-radius: 14px;
  min-height: 52px;
}
.invaders-pad__btn--left { grid-area: left; }
.invaders-pad__btn--fire { grid-area: fire; }
.invaders-pad__btn--right { grid-area: right; }
.invaders-pad__btn:active,
.invaders-pad__btn.is-active {
  background: rgba(74, 222, 128, 0.28);
}

.invaders-status {
  min-height: 1.25rem;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--invaders-meta);
}

/* --- Drawing --- */
.draw-block {
  --draw-chrome: var(--panel, #1e1e2e);
  --draw-border: var(--line, #3b3b52);
  --draw-title: var(--text, #e2e8f0);
  --draw-meta: var(--muted, #94a3b8);
  --draw-accent: #f59e0b;
  position: relative;
  border: 1px solid var(--draw-border);
  border-left: 4px solid var(--draw-accent);
  background: var(--draw-chrome);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 16px 0;
  width: min(100%, 980px);
  max-width: 100%;
  box-sizing: border-box;
}
.draw-block--info { --draw-accent: #38bdf8; }
.draw-block--success { --draw-accent: #4ade80; }
.draw-block--warning { --draw-accent: #fbbf24; }
.draw-block--danger { --draw-accent: #f87171; }
.draw-block--note { --draw-accent: #94a3b8; }
.draw-block--custom { background: var(--draw-chrome); }
.draw-block:focus {
  outline: 2px solid var(--draw-accent);
  outline-offset: 2px;
}
.draw-block-header {
  display: flex;
  align-items: baseline;
  margin-bottom: 8px;
}
.draw-block-title { font-weight: 700; color: var(--draw-title); }
.draw-toolbar {
  position: relative;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.draw-height-label {
  font: 600 13px/1 system-ui, sans-serif;
  color: var(--draw-meta);
}
.draw-tools-pop {
  position: absolute;
  z-index: 6;
  top: calc(100% + 6px);
  left: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  width: min(100%, 560px);
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.96);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}
.draw-tools-pop[hidden] {
  display: none !important;
}
.draw-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--draw-meta);
  font: 600 13px/1 system-ui, sans-serif;
}
.draw-field input[type="color"] {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}
.draw-field select {
  height: 36px;
  min-height: 36px;
  padding: 0 8px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  font: 600 13px/1 system-ui, sans-serif;
}
.draw-field input[type="range"] {
  width: 7.5rem;
  height: 28px;
  margin: 0;
  accent-color: var(--draw-accent);
  cursor: pointer;
}
.draw-size-label {
  min-width: 1.4rem;
  font-variant-numeric: tabular-nums;
  color: var(--draw-title);
}
.draw-toolbar .btn.is-active {
  background: var(--draw-accent);
  border-color: var(--draw-accent);
  color: #111;
}
.draw-canvas--fill { cursor: crosshair; }
.draw-canvas--erase { cursor: cell; }
.draw-canvas--line { cursor: crosshair; }
.draw-canvas--rect { cursor: crosshair; }
.draw-canvas--rect-move { cursor: move; }
.draw-canvas--move { cursor: move; }
.draw-canvas--text { cursor: text; touch-action: manipulation; }
.draw-block--texting { z-index: 8; }
.draw-stage {
  position: relative;
  z-index: 1;
  width: 100%;
  border-radius: 12px;
  overflow: clip;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.18);
}
.draw-text-pop {
  position: absolute;
  z-index: 40;
  display: flex;
  align-items: stretch;
  box-sizing: border-box;
  width: 17rem;
  max-width: calc(100% - 8px);
  pointer-events: auto;
  filter: drop-shadow(0 10px 28px rgba(15, 23, 42, 0.35));
}
.draw-text-pop[hidden] {
  display: none !important;
}
.draw-text-move {
  flex: 0 0 32px;
  margin: 0;
  padding: 0;
  border: 2px solid currentColor;
  border-right: 0;
  border-radius: 8px 0 0 8px;
  background: #fffef8;
  color: inherit;
  font: 700 14px/1 system-ui, sans-serif;
  letter-spacing: -2px;
  cursor: grab;
  touch-action: none;
}
.draw-text-move:active {
  cursor: grabbing;
}
.draw-text-input {
  flex: 1 1 auto;
  min-width: 0;
  box-sizing: border-box;
  width: auto;
  margin: 0;
  padding: 6px 10px;
  border: 2px solid currentColor;
  border-radius: 0 8px 8px 0;
  background: #fffef8;
  color: #1e293b;
  font: 600 16px/1.2 system-ui, sans-serif;
}
.draw-canvas,
.draw-png {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 960 / var(--draw-sheet-h, 540);
}
.draw-canvas {
  touch-action: none;
  cursor: crosshair;
  user-select: none;
}
.draw-block--preview {
  padding-top: 0;
  padding-bottom: 0;
  background: transparent;
  border-color: transparent;
}
.draw-block--preview .draw-stage {
  box-shadow: none;
}
.draw-block--preview .game-fullscreen-btn { display: none; }
.draw-block--preview .draw-png { cursor: pointer; }
.draw-block--frozen .draw-canvas {
  cursor: default;
  pointer-events: none;
  box-shadow: inset 0 0 0 2px rgba(148, 163, 184, 0.7);
}
.draw-hint {
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: var(--draw-meta);
}
.draw-block--fullscreen {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 12px;
  border: none;
  border-radius: 0;
  border-left: none;
  min-height: 0;
  height: auto;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}
.draw-block:fullscreen,
.draw-block:-webkit-full-screen {
  width: 100%;
  height: 100%;
  min-height: 100%;
  max-width: none;
  margin: 0;
  padding: 12px;
  border: none;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
  background: var(--draw-chrome, #1e1e2e);
}
.draw-block:fullscreen .draw-stage,
.draw-block:-webkit-full-screen .draw-stage,
.draw-block--fullscreen .draw-stage {
  flex: 0 0 auto;
  min-height: 0;
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.draw-block:fullscreen .draw-canvas,
.draw-block:-webkit-full-screen .draw-canvas,
.draw-block--fullscreen .draw-canvas,
.draw-block:fullscreen .draw-png,
.draw-block:-webkit-full-screen .draw-png,
.draw-block--fullscreen .draw-png {
  flex: 0 0 auto;
  width: 100%;
  height: auto;
  min-height: 0;
  align-self: stretch;
  object-fit: contain;
}
.draw-block--preview.draw-block--fullscreen {
  padding: 0 12px;
}
.editor-wrap--preview-only .preview-content:has(> .draw-block--fullscreen:only-child),
.editor-wrap--split .preview-content:has(> .draw-block--fullscreen:only-child) {
  padding: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
}
.editor-wrap--preview-only .preview-content > .draw-block--fullscreen:only-child,
.editor-wrap--split .preview-content > .draw-block--fullscreen:only-child {
  flex: 0 0 auto;
  min-height: 100%;
  height: auto;
  max-height: none;
}
@media (pointer: coarse), (max-width: 900px) {
  .draw-block { width: 100%; }
  .draw-toolbar .btn { min-height: 44px; }
}

/* --- Draw.io --- */
.drawio-block {
  --drawio-chrome: var(--panel, #1e1e2e);
  --drawio-border: var(--line, #3b3b52);
  --drawio-title: var(--text, #e2e8f0);
  --drawio-meta: var(--muted, #94a3b8);
  --drawio-accent: #38bdf8;
  --drawio-h: 640px;
  position: relative;
  border: 1px solid var(--drawio-border);
  border-left: 4px solid var(--drawio-accent);
  background: var(--drawio-chrome);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 16px 0;
  width: min(100%, 1100px);
  max-width: 100%;
  box-sizing: border-box;
}
.drawio-block--info { --drawio-accent: #38bdf8; }
.drawio-block--success { --drawio-accent: #4ade80; }
.drawio-block--warning { --drawio-accent: #fbbf24; }
.drawio-block--danger { --drawio-accent: #f87171; }
.drawio-block--note { --drawio-accent: #94a3b8; }
.drawio-block--custom { background: var(--drawio-chrome); }
.drawio-block--error {
  color: var(--drawio-meta);
  padding: 16px;
}
.drawio-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 44px 8px 0;
  min-height: 1.4rem;
}
.drawio-title {
  font-weight: 700;
  color: var(--drawio-title);
}
.drawio-status {
  font-size: 0.82rem;
  color: var(--drawio-meta);
}
.drawio-stage {
  height: var(--drawio-h, 640px);
  min-height: 320px;
  border-radius: 10px;
  overflow: hidden;
  background: #0f172a;
}
.drawio-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #0f172a;
}
.drawio-store { display: none; }
.drawio-block--preview {
  position: relative;
  overflow: hidden;
  width: min(100%, 1100px);
  padding: 0;
  border: none;
  border-left: none;
  background: transparent;
}
.drawio-block--preview .game-fullscreen-btn { display: none; }
.drawio-block--preview .drawio-stage {
  position: relative;
  height: var(--drawio-h, 640px);
  min-height: 320px;
  background: transparent;
  overflow: hidden;
}
.drawio-block--preview .drawio-status {
  position: absolute;
  z-index: 1;
  margin: 0;
}
.drawio-block--preview .drawio-status:empty { display: none; }
.drawio-block--preview .drawio-png {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  cursor: pointer;
}
.drawio-block--preview .drawio-png:not([src]) { display: none; }
.drawio-block--preview .drawio-frame {
  position: absolute;
  width: 960px;
  height: 640px;
  left: -12000px;
  top: 0;
  opacity: 0;
  border: 0;
  pointer-events: none;
}
.drawio-block--fullscreen {
  width: 100%;
  max-width: none;
  margin: 0;
  border: none;
  border-radius: 0;
  border-left: none;
}
.drawio-block:fullscreen,
.drawio-block:-webkit-full-screen,
.drawio-block.game-block--monitor-fullscreen {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--drawio-chrome, #1e1e2e);
}
.drawio-block:fullscreen .drawio-stage,
.drawio-block:-webkit-full-screen .drawio-stage,
.drawio-block.game-block--monitor-fullscreen .drawio-stage {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
}
.editor-wrap--preview-only .preview-content:has(> .drawio-block--fullscreen:only-child),
.editor-wrap--split .preview-content:has(> .drawio-block--fullscreen:only-child) {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.editor-wrap--preview-only .preview-content > .drawio-block--fullscreen:only-child,
.editor-wrap--split .preview-content > .drawio-block--fullscreen:only-child {
  flex: 1 1 auto;
  min-height: var(--drawio-h, 640px);
  height: 100%;
  display: flex;
  flex-direction: column;
}
.editor-wrap--preview-only .preview-content > .drawio-block--fullscreen:only-child .drawio-stage,
.editor-wrap--split .preview-content > .drawio-block--fullscreen:only-child .drawio-stage {
  flex: 1 1 auto;
  height: auto;
  min-height: var(--drawio-h, 640px);
}
@media (pointer: coarse), (max-width: 900px) {
  .drawio-block { width: 100%; }
}

/* --- Carambole --- */
.carambole-block {
  --carambole-bg: var(--panel, #1e1e2e);
  --carambole-border: var(--line, #3b3b52);
  --carambole-title: var(--text, #e2e8f0);
  --carambole-meta: var(--muted, #94a3b8);
  --carambole-accent: #4ade80;
  position: relative;
  border: 1px solid var(--carambole-border);
  border-left: 4px solid var(--carambole-accent);
  background: var(--carambole-bg);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 16px 0;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
}
.carambole-block--info { --carambole-accent: #38bdf8; }
.carambole-block--success { --carambole-accent: #4ade80; }
.carambole-block--warning { --carambole-accent: #fbbf24; }
.carambole-block--danger { --carambole-accent: #f87171; }
.carambole-block--note { --carambole-accent: #94a3b8; }
.carambole-block--custom { background: var(--carambole-bg); }
.carambole-block--error { color: #f87171; padding: 12px 14px; }
.carambole-block:focus {
  outline: 2px solid var(--carambole-accent);
  outline-offset: 2px;
}
.carambole-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.carambole-block-title { font-weight: 700; color: var(--carambole-title); }
.carambole-block-meta {
  font-size: 12px;
  color: var(--carambole-meta);
  text-transform: capitalize;
}
.carambole-play-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.carambole-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: min(100%, 720px);
}
.carambole-toolbar-gap { width: 8px; }
.carambole-chip {
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.65);
  color: #cbd5e1;
  border-radius: 999px;
  min-height: 32px;
  padding: 6px 14px;
  font: 600 12px/1.2 system-ui, sans-serif;
  white-space: nowrap;
  cursor: pointer;
}
.carambole-chip.is-active {
  background: rgba(74, 222, 128, 0.2);
  border-color: rgba(74, 222, 128, 0.7);
  color: #dcfce7;
}
.carambole-score {
  display: flex;
  gap: 14px;
  font: 600 13px/1.2 system-ui, sans-serif;
  color: var(--carambole-meta);
}
.carambole-stage {
  width: min(100%, 760px);
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid #3f2412;
  background: #14532d;
}
.carambole-canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  cursor: crosshair;
}
.carambole-hint {
  margin: 0;
  font-size: 0.82rem;
  color: var(--carambole-meta);
}
.carambole-actions { display: flex; gap: 8px; }
.carambole-status {
  min-height: 1.25rem;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--carambole-meta);
}
.carambole-status--success { color: #4ade80; }
.carambole-status--warn { color: #fbbf24; }
.carambole-status--info { color: var(--carambole-meta); }
.carambole-block--fullscreen {
  background: #052e16;
  min-height: min(90vh, 960px);
}
.carambole-block:fullscreen,
.carambole-block:-webkit-full-screen {
  width: 100%;
  height: 100%;
  min-height: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  background: #052e16;
}
.carambole-block:fullscreen .carambole-play-area,
.carambole-block:-webkit-full-screen .carambole-play-area,
.carambole-block--fullscreen .carambole-play-area {
  flex: 1;
  justify-content: center;
  padding: 12px;
}
.carambole-block:fullscreen .carambole-stage,
.carambole-block:-webkit-full-screen .carambole-stage,
.carambole-block--fullscreen .carambole-stage {
  width: min(96vw, 1100px);
}
@media (pointer: coarse), (max-width: 900px) {
  .carambole-block { width: 100%; max-width: 100%; }
  .carambole-stage { width: 100%; }
  .carambole-chip,
  .carambole-block .btn { min-height: 44px; }
}

/* --- Carrom --- */
.carrom-block {
  --carrom-bg: var(--panel, #1e1e2e);
  --carrom-border: var(--line, #3b3b52);
  --carrom-title: var(--text, #e2e8f0);
  --carrom-meta: var(--muted, #94a3b8);
  --carrom-accent: #f59e0b;
  position: relative;
  border: 1px solid var(--carrom-border);
  border-left: 4px solid var(--carrom-accent);
  background: var(--carrom-bg);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 16px 0;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
}
.carrom-block--info { --carrom-accent: #38bdf8; }
.carrom-block--success { --carrom-accent: #4ade80; }
.carrom-block--warning { --carrom-accent: #fbbf24; }
.carrom-block--danger { --carrom-accent: #f87171; }
.carrom-block--note { --carrom-accent: #94a3b8; }
.carrom-block--custom { background: var(--carrom-bg); }
.carrom-block--error { color: #f87171; padding: 12px 14px; }
.carrom-block:focus {
  outline: 2px solid var(--carrom-accent);
  outline-offset: 2px;
}
.carrom-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.carrom-block-title { font-weight: 700; color: var(--carrom-title); }
.carrom-block-meta {
  font-size: 12px;
  color: var(--carrom-meta);
  text-transform: capitalize;
}
.carrom-play-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: var(--carrom-size, 560px);
  max-width: 100%;
}
.carrom-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: min(100%, 640px);
}
.carrom-toolbar-gap { width: 8px; }
.carrom-chip {
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.65);
  color: #cbd5e1;
  border-radius: 999px;
  min-height: 32px;
  padding: 6px 14px;
  font: 600 12px/1.2 system-ui, sans-serif;
  white-space: nowrap;
  cursor: pointer;
}
.carrom-chip.is-active {
  background: rgba(245, 158, 11, 0.22);
  border-color: rgba(245, 158, 11, 0.75);
  color: #fde68a;
}
.carrom-score {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  font: 600 13px/1.2 system-ui, sans-serif;
  color: var(--carrom-meta);
}
.carrom-stage {
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid #3f2412;
  background: #3b1d0c;
}
.carrom-canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  cursor: crosshair;
}
.carrom-hint {
  margin: 0;
  font-size: 0.82rem;
  color: var(--carrom-meta);
}
.carrom-actions { display: flex; gap: 8px; }
.carrom-status {
  min-height: 1.25rem;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--carrom-meta);
}
.carrom-status--success { color: #4ade80; }
.carrom-status--warn { color: #fbbf24; }
.carrom-status--info { color: var(--carrom-meta); }
.carrom-block--fullscreen {
  background: #1c1008;
  min-height: min(90vh, 960px);
}
.carrom-block:fullscreen,
.carrom-block:-webkit-full-screen {
  width: 100%;
  height: 100%;
  min-height: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  background: #1c1008;
}
.carrom-block:fullscreen .carrom-play-area,
.carrom-block:-webkit-full-screen .carrom-play-area,
.carrom-block--fullscreen .carrom-play-area {
  flex: 1;
  justify-content: center;
  padding: 12px 0;
}
.carrom-block:fullscreen .carrom-stage,
.carrom-block:-webkit-full-screen .carrom-stage,
.carrom-block.game-block--monitor-fullscreen .carrom-stage {
  width: min(92vw, 92vh, 920px);
}
@media (pointer: coarse), (max-width: 900px) {
  .carrom-block { width: 100%; max-width: 100%; }
  .carrom-chip,
  .carrom-block .btn { min-height: 44px; }
}

/* --- Darts --- */
.dart-block {
  --dart-bg: var(--panel, #1e1e2e);
  --dart-border: var(--line, #3b3b52);
  --dart-title: var(--text, #e2e8f0);
  --dart-meta: var(--muted, #94a3b8);
  --dart-accent: #f97316;
  position: relative;
  border: 1px solid var(--dart-border);
  border-left: 4px solid var(--dart-accent);
  background: var(--dart-bg);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 16px 0;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
}
.dart-block--info { --dart-accent: #38bdf8; }
.dart-block--success { --dart-accent: #4ade80; }
.dart-block--warning { --dart-accent: #fbbf24; }
.dart-block--danger { --dart-accent: #f87171; }
.dart-block--note { --dart-accent: #94a3b8; }
.dart-block--custom { background: var(--dart-bg); }
.dart-block--error { color: #f87171; padding: 12px 14px; }
.dart-block:focus {
  outline: 2px solid var(--dart-accent);
  outline-offset: 2px;
}
.dart-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.dart-block-title { font-weight: 700; color: var(--dart-title); }
.dart-block-meta {
  font-size: 12px;
  color: var(--dart-meta);
  text-transform: capitalize;
}
.dart-play-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.dart-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: min(100%, 640px);
}
.dart-toolbar-gap { width: 8px; }
.dart-chip {
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.65);
  color: #cbd5e1;
  border-radius: 999px;
  min-height: 32px;
  padding: 6px 14px;
  font: 600 12px/1.2 system-ui, sans-serif;
  white-space: nowrap;
  cursor: pointer;
}
.dart-chip.is-active {
  background: rgba(249, 115, 22, 0.22);
  border-color: rgba(249, 115, 22, 0.75);
  color: #ffedd5;
}
.dart-score {
  display: flex;
  gap: 14px;
  font: 600 13px/1.2 system-ui, sans-serif;
  color: var(--dart-meta);
}
.dart-stage {
  width: min(100%, 640px);
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid #44403c;
  background: #0c0a09;
}
.dart-canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  cursor: crosshair;
}
.dart-hint {
  margin: 0;
  font-size: 0.82rem;
  color: var(--dart-meta);
  text-align: center;
}
.dart-actions { display: flex; gap: 8px; }
.dart-status {
  min-height: 1.25rem;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--dart-meta);
}
.dart-status--success { color: #4ade80; }
.dart-status--warn { color: #fbbf24; }
.dart-status--info { color: var(--dart-meta); }
.dart-block--fullscreen {
  background: #1c1917;
  min-height: min(90vh, 960px);
}
.dart-block:fullscreen,
.dart-block:-webkit-full-screen {
  width: 100%;
  height: 100%;
  min-height: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  background: #1c1917;
}
.dart-block:fullscreen .dart-play-area,
.dart-block:-webkit-full-screen .dart-play-area,
.dart-block--fullscreen .dart-play-area {
  flex: 1;
  justify-content: center;
  padding: 12px;
}
.dart-block:fullscreen .dart-stage,
.dart-block:-webkit-full-screen .dart-stage,
.dart-block--fullscreen .dart-stage {
  width: min(96vw, 720px);
}
@media (pointer: coarse), (max-width: 900px) {
  .dart-block { width: 100%; max-width: 100%; }
  .dart-stage { width: 100%; }
  .dart-chip,
  .dart-block .btn { min-height: 44px; }
}

/* --- Breakout --- */
.breakout-block {
  --breakout-bg: var(--panel, #1e1e2e);
  --breakout-border: var(--line, #3b3b52);
  --breakout-title: var(--text, #e2e8f0);
  --breakout-meta: var(--muted, #94a3b8);
  --breakout-accent: #38bdf8;
  border: 1px solid var(--breakout-border);
  border-left: 4px solid var(--breakout-accent);
  background: var(--breakout-bg);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 16px 0;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
}

.breakout-block--info { --breakout-accent: #38bdf8; }
.breakout-block--success { --breakout-accent: #4ade80; }
.breakout-block--warning { --breakout-accent: #fbbf24; }
.breakout-block--danger { --breakout-accent: #f87171; }
.breakout-block--note { --breakout-accent: #94a3b8; }
.breakout-block--custom { background: var(--breakout-bg); }
.breakout-block--error { color: #f87171; padding: 12px 14px; }
.breakout-block:focus {
  outline: 2px solid var(--breakout-accent);
  outline-offset: 2px;
}

.breakout-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.breakout-block-title { font-weight: 700; color: var(--breakout-title); }
.breakout-block-meta { font-size: 12px; color: var(--breakout-meta); }
.breakout-block-hint { font-size: 0.82rem; color: var(--breakout-meta); margin: 0 0 8px; }

.breakout-stage {
  width: min(100%, 480px);
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--breakout-border);
  background: #071018;
  display: flex;
  justify-content: center;
}

.breakout-canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #071018;
}

.breakout-pad {
  display: none;
  margin-top: 10px;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-areas: "left launch right";
  gap: 8px;
  width: min(100%, 360px);
  user-select: none;
  -webkit-user-select: none;
}
.breakout-pad.is-visible { display: grid; }
.breakout-pad__btn {
  touch-action: none;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.72);
  color: #e2e8f0;
  font: 600 14px/1 system-ui, sans-serif;
  border-radius: 14px;
  min-height: 52px;
}
.breakout-pad__btn--left { grid-area: left; }
.breakout-pad__btn--launch { grid-area: launch; }
.breakout-pad__btn--right { grid-area: right; }
.breakout-pad__btn:active,
.breakout-pad__btn.is-active {
  background: rgba(56, 189, 248, 0.28);
}

.breakout-status {
  min-height: 1.25rem;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--breakout-meta);
}

/* --- Snake --- */
.snake-block {
  --snake-bg: var(--panel, #1e1e2e);
  --snake-border: var(--line, #3b3b52);
  --snake-title: var(--text, #e2e8f0);
  --snake-meta: var(--muted, #94a3b8);
  --snake-accent: #4ade80;
  border: 1px solid var(--snake-border);
  border-left: 4px solid var(--snake-accent);
  background: var(--snake-bg);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 16px 0;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
}

.snake-block--info { --snake-accent: #38bdf8; }
.snake-block--success { --snake-accent: #4ade80; }
.snake-block--warning { --snake-accent: #fbbf24; }
.snake-block--danger { --snake-accent: #f87171; }
.snake-block--note { --snake-accent: #94a3b8; }
.snake-block--custom { background: var(--snake-bg); }
.snake-block--error { color: #f87171; padding: 12px 14px; }
.snake-block:focus {
  outline: 2px solid var(--snake-accent);
  outline-offset: 2px;
}

.snake-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.snake-block-title { font-weight: 700; color: var(--snake-title); }
.snake-block-meta { font-size: 12px; color: var(--snake-meta); }
.snake-block-hint { font-size: 0.82rem; color: var(--snake-meta); margin: 0 0 8px; }

.snake-stage {
  width: min(100%, 520px);
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--snake-border);
  background: #06140c;
  display: flex;
  justify-content: center;
}

.snake-canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #06140c;
  touch-action: none;
  cursor: crosshair;
}

.snake-pad {
  display: none;
  margin-top: 10px;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-areas:
    ". up ."
    "left down right";
  gap: 8px;
  width: min(100%, 280px);
  user-select: none;
  -webkit-user-select: none;
}
.snake-pad.is-visible { display: grid; }
.snake-pad__btn {
  touch-action: none;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.72);
  color: #e2e8f0;
  font: 600 16px/1 system-ui, sans-serif;
  border-radius: 14px;
  min-height: 52px;
}
.snake-pad__btn--up { grid-area: up; }
.snake-pad__btn--left { grid-area: left; }
.snake-pad__btn--down { grid-area: down; }
.snake-pad__btn--right { grid-area: right; }
.snake-pad__btn:active,
.snake-pad__btn.is-active {
  background: rgba(74, 222, 128, 0.28);
}

.snake-status {
  min-height: 1.25rem;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--snake-meta);
}

/* --- Marble blast --- */
.marbleblast-block {
  --marbleblast-bg: var(--panel, #1e1e2e);
  --marbleblast-border: var(--line, #3b3b52);
  --marbleblast-title: var(--text, #e2e8f0);
  --marbleblast-meta: var(--muted, #94a3b8);
  --marbleblast-accent: #38bdf8;
  border: 1px solid var(--marbleblast-border);
  border-left: 4px solid var(--marbleblast-accent);
  background: var(--marbleblast-bg);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 16px 0;
  max-width: 100%;
  box-sizing: border-box;
}

.marbleblast-block--info { --marbleblast-accent: #38bdf8; }
.marbleblast-block--success { --marbleblast-accent: #4ade80; }
.marbleblast-block--warning { --marbleblast-accent: #fbbf24; }
.marbleblast-block--danger { --marbleblast-accent: #f87171; }
.marbleblast-block--note { --marbleblast-accent: #94a3b8; }
.marbleblast-block--custom { background: var(--marbleblast-bg); }
.marbleblast-block--error { color: #f87171; padding: 12px 14px; }

.marbleblast-block:focus {
  outline: 2px solid var(--marbleblast-accent);
  outline-offset: 2px;
}

.marbleblast-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.marbleblast-block-title { font-weight: 700; color: var(--marbleblast-title); }
.marbleblast-block-meta { font-size: 12px; color: var(--marbleblast-meta); }
.marbleblast-block-hint { font-size: 0.82rem; color: var(--marbleblast-meta); margin: 0 0 8px; }

.marbleblast-stage {
  position: relative;
  width: 100%;
  min-height: min(52vh, 480px);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(56, 189, 248, 0.28);
  background: #7dd3fc;
}

.marbleblast-canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: inherit;
}

.marbleblast-hud {
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.58);
  color: #e0f2fe;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.marbleblast-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.marbleblast-pad {
  display: none;
  position: relative;
  margin-top: 10px;
  grid-template-columns: 56px 56px 56px 1fr;
  grid-template-areas:
    ". w . jump"
    "a s d jump";
  gap: 8px;
  width: min(100%, 320px);
}

.marbleblast-pad.is-visible { display: grid; }
.marbleblast-pad__btn {
  touch-action: none;
  border: 1px solid rgba(125, 211, 252, 0.45);
  background: rgba(15, 23, 42, 0.72);
  color: #e0f2fe;
  font: 600 14px/1 system-ui, sans-serif;
  border-radius: 14px;
  min-height: 48px;
}
.marbleblast-pad__btn--w { grid-area: w; }
.marbleblast-pad__btn--a { grid-area: a; }
.marbleblast-pad__btn--s { grid-area: s; }
.marbleblast-pad__btn--d { grid-area: d; }
.marbleblast-pad__btn--jump { grid-area: jump; }
.marbleblast-pad__btn.is-active { background: rgba(56, 189, 248, 0.35); }

.marbleblast-status {
  min-height: 1.25rem;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--marbleblast-meta);
}

/* Fullscreen game blocks */
.sudoku-block--fullscreen,
.puzzle-block--fullscreen,
.pinball-block--fullscreen,
.pacman-block--fullscreen,
.mario-block--fullscreen,
.lemmings-block--fullscreen,
.tictactoe-block--fullscreen,
.chess-block--fullscreen,
.connect4-block--fullscreen,
.reversi-block--fullscreen, .muhle-block--fullscreen, .backgammon-block--fullscreen,
.tetris-block--fullscreen,
.sokoban-block--fullscreen,
.invaders-block--fullscreen,
.breakout-block--fullscreen,
.carambole-block--fullscreen,
.dart-block--fullscreen,
.snake-block--fullscreen,
.marbleblast-block--fullscreen {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  border-left: none;
  min-height: min(85vh, 900px);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.sudoku-block--fullscreen {
  background: var(--sudoku-bg, var(--panel, #1e1e2e));
}

.puzzle-block--fullscreen {
  background: var(--puzzle-bg, var(--panel, #1e1e2e));
}

.pinball-block--fullscreen {
  background: #000;
  min-height: min(90vh, 960px);
}

.pacman-block--fullscreen {
  background: #000;
  min-height: min(90vh, 960px);
}

.mario-block--fullscreen {
  background: #5c94fc;
  min-height: min(90vh, 960px);
}

.lemmings-block--fullscreen {
  background: #1a1d28;
  min-height: min(90vh, 960px);
}

.tictactoe-block--fullscreen {
  background: var(--tictactoe-bg, var(--panel, #1e1e2e));
}

.tetris-block--fullscreen {
  background: #0b1020;
  min-height: min(90vh, 960px);
}

.sokoban-block--fullscreen {
  background: #0f172a;
  min-height: min(90vh, 960px);
}

.invaders-block--fullscreen {
  background: #05060d;
  min-height: min(90vh, 960px);
}

.breakout-block--fullscreen {
  background: #071018;
  min-height: min(90vh, 960px);
}

.snake-block--fullscreen {
  background: #06140c;
  min-height: min(90vh, 960px);
}

.marbleblast-block--fullscreen {
  background: #0c4a6e;
  min-height: min(90vh, 960px);
}

.sudoku-block--fullscreen .sudoku-play-area,
.puzzle-block--fullscreen .puzzle-play-area,
.tictactoe-block--fullscreen .tictactoe-play-area,
.chess-block--fullscreen .chess-play-area,
.connect4-block--fullscreen .connect4-play-area,
.reversi-block--fullscreen .reversi-play-area, .muhle-block--fullscreen .muhle-play-area, .backgammon-block--fullscreen .backgammon-play-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px;
  min-height: 0;
}

.puzzle-block--fullscreen .puzzle-jq-mount {
  width: 100%;
  max-width: 100%;
  display: flex;
  justify-content: center;
}

.puzzle-block--fullscreen .puzzle-paste-zone {
  width: min(100%, 520px);
  min-height: min(50vh, 420px);
}

.pinball-block--fullscreen .pinball-frame-wrap {
  flex: 1;
  width: 100%;
  max-width: none;
  max-height: none;
  aspect-ratio: unset;
  min-height: 0;
  border: none;
  border-radius: 0;
}

.pacman-block--fullscreen .pacman-stage {
  flex: 1;
  width: 100%;
  max-width: none;
  min-height: 0;
  border: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pacman-block--fullscreen .pacman-canvas {
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.mario-block--fullscreen .mario-stage {
  flex: 1;
  width: 100%;
  max-width: none;
  min-height: 0;
  border: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mario-block--fullscreen .mario-canvas {
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.lemmings-block--fullscreen .lemmings-stage {
  flex: 1;
  width: 100%;
  max-width: none;
  min-height: 0;
  border: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lemmings-block--fullscreen .lemmings-canvas {
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.lemmings-block--fullscreen .lemmings-skills {
  width: 100%;
  border-radius: 0;
  border-left: none;
  border-right: none;
}

.tetris-block--fullscreen .tetris-stage {
  flex: 1;
  width: 100%;
  max-width: none;
  min-height: 0;
  border: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tetris-block--fullscreen .tetris-canvas {
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.sokoban-block--fullscreen .sokoban-stage {
  flex: 1;
  width: 100%;
  max-width: none;
  min-height: min(42vh, 360px);
  border: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sokoban-block--fullscreen .sokoban-canvas {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.invaders-block--fullscreen .invaders-stage,
.breakout-block--fullscreen .breakout-stage,
.snake-block--fullscreen .snake-stage {
  flex: 1;
  width: 100%;
  max-width: none;
  min-height: 0;
  border: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.invaders-block--fullscreen .invaders-canvas,
.breakout-block--fullscreen .breakout-canvas,
.snake-block--fullscreen .snake-canvas {
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.marbleblast-block--fullscreen .marbleblast-stage {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: none;
  border-radius: 0;
}

.marbleblast-block--fullscreen .marbleblast-canvas {
  width: 100%;
  height: 100%;
}

.sudoku-block--fullscreen .sudoku-status,
.puzzle-block--fullscreen .puzzle-status,
.pinball-block--fullscreen .pinball-status,
.pacman-block--fullscreen .pacman-status,
.mario-block--fullscreen .mario-status,
.lemmings-block--fullscreen .lemmings-status,
.tictactoe-block--fullscreen .tictactoe-status,
.chess-block--fullscreen .chess-status,
.connect4-block--fullscreen .connect4-status,
.reversi-block--fullscreen .reversi-status, .muhle-block--fullscreen .muhle-status, .backgammon-block--fullscreen .backgammon-status,
.tetris-block--fullscreen .tetris-status,
.sokoban-block--fullscreen .sokoban-status,
.invaders-block--fullscreen .invaders-status,
.breakout-block--fullscreen .breakout-status,
.carambole-block--fullscreen .carambole-status,
.carrom-block--fullscreen .carrom-status,
.dart-block--fullscreen .dart-status,
.snake-block--fullscreen .snake-status,
.marbleblast-block--fullscreen .marbleblast-status {
  min-height: 0;
  padding: 0 12px 8px;
  font-size: 0.8rem;
}

.editor-wrap--preview-only .preview-content:has(> .sudoku-block--fullscreen:only-child),
.editor-wrap--preview-only .preview-content:has(> .puzzle-block--fullscreen:only-child),
.editor-wrap--preview-only .preview-content:has(> .pinball-block--fullscreen:only-child),
.editor-wrap--preview-only .preview-content:has(> .pacman-block--fullscreen:only-child),
.editor-wrap--preview-only .preview-content:has(> .mario-block--fullscreen:only-child),
.editor-wrap--preview-only .preview-content:has(> .lemmings-block--fullscreen:only-child),
.editor-wrap--preview-only .preview-content:has(> .tictactoe-block--fullscreen:only-child),
.editor-wrap--preview-only .preview-content:has(> .chess-block--fullscreen:only-child),
.editor-wrap--preview-only .preview-content:has(> .connect4-block--fullscreen:only-child),
.editor-wrap--preview-only .preview-content:has(> .reversi-block--fullscreen:only-child, .muhle-block--fullscreen:only-child, .backgammon-block--fullscreen:only-child),
.editor-wrap--preview-only .preview-content:has(> .tetris-block--fullscreen:only-child),
.editor-wrap--preview-only .preview-content:has(> .sokoban-block--fullscreen:only-child),
.editor-wrap--preview-only .preview-content:has(> .invaders-block--fullscreen:only-child),
.editor-wrap--preview-only .preview-content:has(> .breakout-block--fullscreen:only-child),
.editor-wrap--preview-only .preview-content:has(> .carambole-block--fullscreen:only-child),
.editor-wrap--preview-only .preview-content:has(> .dart-block--fullscreen:only-child),
.editor-wrap--preview-only .preview-content:has(> .snake-block--fullscreen:only-child),
.editor-wrap--preview-only .preview-content:has(> .marbleblast-block--fullscreen:only-child) {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.editor-wrap--preview-only .preview-content > .sudoku-block--fullscreen:only-child,
.editor-wrap--preview-only .preview-content > .puzzle-block--fullscreen:only-child,
.editor-wrap--preview-only .preview-content > .pinball-block--fullscreen:only-child,
.editor-wrap--preview-only .preview-content > .pacman-block--fullscreen:only-child,
.editor-wrap--preview-only .preview-content > .mario-block--fullscreen:only-child,
.editor-wrap--preview-only .preview-content > .lemmings-block--fullscreen:only-child,
.editor-wrap--preview-only .preview-content > .tictactoe-block--fullscreen:only-child,
.editor-wrap--preview-only .preview-content > .chess-block--fullscreen:only-child,
.editor-wrap--preview-only .preview-content > .connect4-block--fullscreen:only-child,
.editor-wrap--preview-only .preview-content > .reversi-block--fullscreen:only-child, .muhle-block--fullscreen:only-child, .backgammon-block--fullscreen:only-child,
.editor-wrap--preview-only .preview-content > .tetris-block--fullscreen:only-child,
.editor-wrap--preview-only .preview-content > .sokoban-block--fullscreen:only-child,
.editor-wrap--preview-only .preview-content > .invaders-block--fullscreen:only-child,
.editor-wrap--preview-only .preview-content > .breakout-block--fullscreen:only-child,
.editor-wrap--preview-only .preview-content > .carambole-block--fullscreen:only-child,
.editor-wrap--preview-only .preview-content > .dart-block--fullscreen:only-child,
.editor-wrap--preview-only .preview-content > .snake-block--fullscreen:only-child,
.editor-wrap--preview-only .preview-content > .marbleblast-block--fullscreen:only-child {
  flex: 1;
  min-height: 0;
  height: 100%;
}

.editor-wrap--preview-only .preview-content:has(> .jukebox-block--fullscreen:only-child) {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.editor-wrap--preview-only .preview-content > .jukebox-block--fullscreen:only-child {
  flex: 1;
  min-height: 0;
  height: 100%;
}

/* --- Photo gallery --- */
.gallery-block {
  --gallery-bg: var(--panel, #1e1e2e);
  --gallery-border: var(--line, #3b3b52);
  --gallery-title: var(--text, #e2e8f0);
  --gallery-meta: var(--muted, #94a3b8);
  --gallery-accent: #38bdf8;
  --gallery-cols: 3;
  border: 1px solid var(--gallery-border);
  border-left: 4px solid var(--gallery-accent);
  background: var(--gallery-bg);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 16px 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.gallery-block--info { --gallery-accent: #38bdf8; }
.gallery-block--success { --gallery-accent: #4ade80; }
.gallery-block--warning { --gallery-accent: #fbbf24; }
.gallery-block--danger { --gallery-accent: #f87171; }
.gallery-block--note { --gallery-accent: #94a3b8; }

.gallery-block--custom {
  background: var(--gallery-bg-custom, var(--gallery-bg));
}

.gallery-block--error {
  color: #f87171;
  padding: 12px 14px;
}

.gallery-block--fullscreen {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 12px;
  border: none;
  border-radius: 0;
  border-left: none;
  min-height: min(70vh, 720px);
}

.gallery-block--fullscreen.gallery-block--walk {
  min-height: min(78vh, 820px);
  padding: 8px;
}

.gallery-block--fullscreen .gallery-walk {
  flex: 1;
  min-height: 0;
}

.gallery-block--fullscreen .gallery-walk-viewport {
  min-height: min(68vh, 700px);
  border-radius: 8px;
}

.gallery-block:fullscreen,
.gallery-block:-webkit-full-screen {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  padding: 12px;
  background: #12121a;
  overflow: hidden;
}

.gallery-block:fullscreen .gallery-walk,
.gallery-block:-webkit-full-screen .gallery-walk {
  flex: 1;
  min-height: 0;
}

.gallery-block:fullscreen .gallery-walk-viewport,
.gallery-block:-webkit-full-screen .gallery-walk-viewport {
  flex: 1;
  min-height: 0;
  border-radius: 0;
}

.gallery-block--uploading,
.gallery-block--drop,
.gallery-block--paste-target {
  outline: 2px dashed var(--gallery-accent);
  outline-offset: 2px;
}

.gallery-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-right: 44px;
}

.gallery-block-title {
  font-weight: 700;
  color: var(--gallery-title);
}

.gallery-block-meta {
  font-size: 12px;
  color: var(--gallery-meta);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(var(--gallery-cols), minmax(0, 1fr));
  gap: 14px;
}

.gallery-thumb {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gallery-frame {
  display: block;
  aspect-ratio: 4 / 3;
  border-radius: 4px;
  overflow: hidden;
  background:
    linear-gradient(145deg, #f8fafc 0%, #e2e8f0 55%, #cbd5e1 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 10px 24px rgba(0, 0, 0, 0.28),
    0 2px 6px rgba(0, 0, 0, 0.18);
  padding: 10px 10px 18px;
  transform: perspective(900px) rotateY(-2deg) rotateX(1.5deg);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-thumb:hover .gallery-frame,
.gallery-thumb:focus-visible .gallery-frame {
  transform: perspective(900px) rotateY(0deg) rotateX(0deg) translateY(-2px) scale(1.02);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.4) inset,
    0 16px 32px rgba(0, 0, 0, 0.35),
    0 4px 10px rgba(0, 0, 0, 0.2);
}

.gallery-frame img,
.gallery-frame video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 2px;
  background: #0f172a;
}

.gallery-thumb--video .gallery-frame {
  position: relative;
}

.gallery-audio-plate {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 120px;
  font-size: 3rem;
  color: #fbbf24;
  background: linear-gradient(180deg, #1e1b4b, #0f172a);
}

.gallery-thumb-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.78);
  color: #f8fafc;
  font-size: 0.7rem;
  pointer-events: none;
}

.gallery-thumb-badge--yt {
  background: #dc2626;
}

.gallery-caption {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gallery-title);
  text-align: center;
  line-height: 1.25;
  padding: 2px 4px 0;
}

.gallery-thumb--add {
  align-items: center;
  justify-content: center;
  min-height: 140px;
  border: 2px dashed rgba(148, 163, 184, 0.45);
  border-radius: 10px;
  color: var(--gallery-meta);
  gap: 4px;
}

.gallery-thumb--add:hover,
.gallery-thumb--add:focus-visible {
  border-color: var(--gallery-accent);
  color: var(--gallery-title);
}

.gallery-add-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.gallery-add-label {
  font-size: 0.82rem;
}

.gallery-paste-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: min(40vh, 280px);
  border: 2px dashed rgba(148, 163, 184, 0.45);
  border-radius: 12px;
  color: var(--gallery-meta);
  cursor: pointer;
  padding: 24px;
  text-align: center;
}

.gallery-paste-zone:focus,
.gallery-paste-zone:hover {
  border-color: var(--gallery-accent);
  color: var(--gallery-title);
}

.gallery-paste-icon {
  font-size: 2rem;
}

.gallery-block--walk {
  min-height: min(72vh, 760px);
  display: flex;
  flex-direction: column;
}

.gallery-walk {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.gallery-walk-viewport {
  position: relative;
  flex: 1;
  min-height: min(58vh, 560px);
  border-radius: 12px;
  overflow: hidden;
  background: #12121a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: crosshair;
}

.gallery-walk-viewport--locked {
  cursor: none;
}

.gallery-walk-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.gallery-walk-css3d {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  perspective-origin: 50% 50%;
}

.gallery-walk-css3d-cam {
  position: absolute;
  top: 0;
  left: 0;
  transform-style: preserve-3d;
  pointer-events: none;
}

.gallery-walk-yt {
  position: absolute;
  top: 0;
  left: 0;
  margin: 0;
  border: 0;
  background: #000;
  pointer-events: none;
  transform-origin: 0 0;
}

.gallery-walk-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 14px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
  color: #e2e8f0;
  pointer-events: none;
}

.gallery-walk-hint {
  margin: 0;
  font-size: 0.78rem;
  color: #cbd5e1;
}

.gallery-walk-hint kbd {
  display: inline-block;
  padding: 0 5px;
  margin: 0 1px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  font-size: 0.72rem;
  background: rgba(15, 23, 42, 0.65);
}

.gallery-walk-caption {
  margin-top: 4px;
  font-size: 0.95rem;
  font-weight: 600;
  min-height: 1.2em;
}

.gallery-walk-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.photo-drive-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.photo-drive-url {
  flex: 1 1 180px;
  min-width: 140px;
  max-width: 320px;
  min-height: 31px;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.35);
  color: #ffffff;
  font: 400 0.8rem/1.2 Arial, sans-serif;
}

.photo-drive-url::placeholder {
  color: rgba(255, 255, 255, 0.65);
}

.gallery-walk-toolbar .btn.active {
  background: rgba(56, 189, 248, 0.22);
  border-color: rgba(56, 189, 248, 0.55);
  color: #e0f2fe;
}

.gallery-walk-hint--mobile {
  display: none;
}

.gallery-walk-pad {
  display: none;
  position: absolute;
  left: 10px;
  bottom: 12px;
  z-index: 3;
  grid-template-columns: 56px 56px 56px 56px;
  grid-template-areas:
    ". w . in"
    "a s d out";
  gap: 8px;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
}

.gallery-walk-pad.is-visible,
body.mobile-layout .gallery-walk-pad {
  display: grid;
}

.gallery-walk-pad__btn {
  touch-action: none;
  border: 1px solid rgba(253, 230, 138, 0.45);
  background: rgba(18, 12, 6, 0.78);
  color: #fde68a;
  font: 700 16px/1 system-ui, sans-serif;
  border-radius: 14px;
  min-height: 52px;
  min-width: 52px;
}

.gallery-walk-pad__btn--w { grid-area: w; }
.gallery-walk-pad__btn--a { grid-area: a; }
.gallery-walk-pad__btn--s { grid-area: s; }
.gallery-walk-pad__btn--d { grid-area: d; }
.gallery-walk-pad__btn--in { grid-area: in; }
.gallery-walk-pad__btn--out { grid-area: out; }

.gallery-walk-pad__btn:active,
.gallery-walk-pad__btn.is-active {
  background: rgba(234, 179, 8, 0.42);
  border-color: rgba(253, 230, 138, 0.95);
  color: #fff;
}

body.mobile-layout .gallery-walk-hint--desktop {
  display: none;
}

body.mobile-layout .gallery-walk-hint--mobile {
  display: block;
}

body.mobile-layout .gallery-walk-overlay {
  padding-left: 260px;
}

/* Phones: first tap enters. Keep Demo tour so the guided walk can be started or stopped. */
body.mobile-layout .gallery-walk-toolbar [data-action="walk-focus"] {
  display: none !important;
}

body.mobile-layout .gallery-walk-toolbar [data-action="walk-demo"] {
  min-height: 44px;
  padding: 0.45rem 0.9rem;
}

@media (max-width: 768px) {
  .gallery-walk-hint--desktop {
    display: none;
  }

  .gallery-walk-hint--mobile {
    display: block;
  }

  .gallery-walk-pad {
    display: grid;
  }

  .gallery-walk-overlay {
    padding-left: 260px;
  }

  .gallery-walk-toolbar [data-action="walk-focus"] {
    display: none !important;
  }

  .gallery-walk-toolbar [data-action="walk-demo"] {
    min-height: 44px;
    padding: 0.45rem 0.9rem;
  }
}

.gallery-grid--compact {
  margin-top: 4px;
}

.gallery-status {
  min-height: 1.1rem;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--gallery-meta);
}

.photoview-block {
  --photoview-accent: #38bdf8;
  --photoview-bg: #0f172a;
  --photoview-title: #f8fafc;
  --photoview-meta: #94a3b8;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: min(70vh, 720px);
  padding: 16px 16px 12px;
  border-radius: 16px;
  border-left: 4px solid var(--photoview-accent);
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(56, 189, 248, 0.12), transparent 55%),
    var(--photoview-bg);
  color: var(--photoview-title);
  overflow: hidden;
}

.photoview-block--info { --photoview-accent: #38bdf8; }
.photoview-block--success { --photoview-accent: #4ade80; }
.photoview-block--warning { --photoview-accent: #fbbf24; }
.photoview-block--danger { --photoview-accent: #f87171; }
.photoview-block--note { --photoview-accent: #94a3b8; }

.photoview-block--custom {
  background: var(--photoview-bg);
}

.photoview-block--fullscreen {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 8px 10px 10px;
  border: none;
  border-radius: 0;
  border-left: none;
  min-height: min(82vh, 900px);
  height: min(86vh, 980px);
}

.photoview-paste-catcher {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  opacity: 0;
}

.photoview-block--uploading,
.photoview-block--drop,
.photoview-block--paste-target,
.photoview-block--paste-armed {
  outline: 2px dashed var(--photoview-accent);
  outline-offset: -6px;
}

.photoview-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.photoview-title {
  font-weight: 700;
  font-size: 1.05rem;
}

.photoview-meta,
.photoview-status,
.photocube-hint,
.photobook-hint {
  color: var(--photoview-meta);
  font-size: 0.85rem;
  margin: 0;
  text-align: center;
}

.photoview-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
}

.photoview-block .gallery-paste-zone {
  color: var(--photoview-meta);
}

.photoview-block .gallery-paste-zone:focus,
.photoview-block .gallery-paste-zone:hover {
  border-color: var(--photoview-accent);
  color: var(--photoview-title);
}

.photoview-empty-face {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: #94a3b8;
  background: #1e293b;
  font-size: 0.85rem;
}

.photocube-stage,
.photobook-stage,
.carousel-stage {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  gap: 10px;
}

.photocube-scene {
  --photocube-size: min(70vmin, 68vh, 640px);
  flex: 1 1 auto;
  width: 100%;
  min-height: min(68vh, 760px);
  perspective: 1400px;
  transform-style: preserve-3d;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  cursor: grab;
  user-select: none;
  pointer-events: auto;
}

/* 3D faces fail hit-testing in edit/split preview; keep events on the 2D scene. */
.photocube-cube,
.photocube-face {
  pointer-events: none;
}

.photocube-scene:active {
  cursor: grabbing;
}

.photocube-cube {
  width: var(--photocube-size);
  height: var(--photocube-size);
  position: relative;
  transform-style: preserve-3d;
  transform: rotateX(-18deg) rotateY(28deg);
}

.photocube-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #0b1220;
  border: 10px solid #f1f5f9;
  box-shadow:
    inset 0 0 0 1px rgba(15, 23, 42, 0.35),
    0 8px 18px rgba(0, 0, 0, 0.35);
  backface-visibility: hidden;
}

.photocube-face img,
.photocube-face video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.photocube-face-label {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #e2e8f0;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.photocube-face--front { transform: rotateY(0deg) translateZ(calc(var(--photocube-size) / 2)); }
.photocube-face--back { transform: rotateY(180deg) translateZ(calc(var(--photocube-size) / 2)); }
.photocube-face--right { transform: rotateY(90deg) translateZ(calc(var(--photocube-size) / 2)); }
.photocube-face--left { transform: rotateY(-90deg) translateZ(calc(var(--photocube-size) / 2)); }
.photocube-face--top { transform: rotateX(90deg) translateZ(calc(var(--photocube-size) / 2)); }
.photocube-face--bottom { transform: rotateX(-90deg) translateZ(calc(var(--photocube-size) / 2)); }

.photobook-block.photoview-block--fullscreen {
  height: min(92dvh, 92vh);
  min-height: min(72vh, 640px);
  max-height: none;
}

.photobook-stage {
  align-items: stretch;
}

.photobook-viewport {
  flex: 1 1 auto;
  min-height: min(64vh, 680px);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photobook-block.photoview-block--fullscreen .photobook-viewport {
  min-height: 0;
}

.photobook-book {
  --photobook-w: min(96%, 1200px);
  --photobook-h: min(78vh, 860px);
  width: var(--photobook-w);
  height: var(--photobook-h);
  flex: 0 0 auto;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  position: relative;
  perspective: 1800px;
  transform-style: preserve-3d;
  outline: none;
}

.photobook-book.is-closed {
  width: var(--photobook-w);
  height: var(--photobook-h);
  aspect-ratio: auto;
  align-self: center;
}

.photobook-book.is-open {
  width: var(--photobook-w);
  height: var(--photobook-h);
  min-height: 0;
  aspect-ratio: auto;
  align-self: center;
}

.photobook-cover,
.photobook-open {
  position: absolute;
  inset: 0;
}

.photobook-book.is-closed .photobook-open {
  display: none;
}

.photobook-book.is-open .photobook-cover {
  display: none;
}

.photobook-cover-front {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 16px 20px;
  border-radius: 4px 14px 14px 4px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 28%),
    repeating-linear-gradient(90deg, #3f1d1d 0 2px, #4a2222 2px 4px);
  box-shadow:
    8px 12px 28px rgba(0, 0, 0, 0.45),
    inset 6px 0 10px rgba(0, 0, 0, 0.35),
    inset -2px 0 0 rgba(251, 191, 36, 0.35);
  cursor: pointer;
}

.photobook-cover-inset {
  flex: 1;
  min-height: 0;
  width: 78%;
  margin-top: 8px;
  border: 8px solid #f8fafc;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  background: #0f172a;
}

.photobook-cover-inset img,
.photobook-cover-inset video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photobook-cover-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fde68a;
  text-align: center;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
}

.photobook-cover-meta {
  font-size: 0.8rem;
  color: #f5d0a8;
}

.photobook-spread {
  display: grid;
  grid-template-columns: 1fr 14px 1fr;
  height: 100%;
  border-radius: 4px 12px 12px 4px;
  overflow: visible;
  background: #e7dcc8;
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.4),
    inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.photobook-gutter {
  background: linear-gradient(90deg, rgba(15, 23, 42, 0.28), rgba(15, 23, 42, 0.05) 40%, rgba(15, 23, 42, 0.28));
}

.photobook-page {
  position: relative;
  min-width: 0;
  height: 100%;
  background:
    linear-gradient(90deg, rgba(15, 23, 42, 0.06), transparent 18%),
    #f6efe2;
  cursor: pointer;
  transform-origin: left center;
  transform-style: preserve-3d;
}

.photobook-page--left {
  transform-origin: right center;
}

.photobook-page-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 14px 14px 28px;
  gap: 8px;
  box-sizing: border-box;
}

.photobook-page-media,
.photobook-page img,
.photobook-page video {
  display: block;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  object-fit: cover;
  border: 6px solid #fff;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.18);
  background: #0f172a;
}

.photobook-caption {
  font-family: Georgia, serif;
  font-size: 0.82rem;
  color: #334155;
  text-align: center;
}

.photobook-folio {
  position: absolute;
  bottom: 8px;
  font-size: 0.7rem;
  color: #64748b;
}

.photobook-page--left .photobook-folio { left: 12px; }
.photobook-page--right .photobook-folio { right: 12px; }

.photobook-page.is-flipping-forward {
  animation: photobook-flip-forward 0.5s ease-in forwards;
  z-index: 4;
}

.photobook-page.is-flipping-back {
  animation: photobook-flip-back 0.5s ease-in forwards;
  z-index: 4;
}

@keyframes photobook-flip-forward {
  from { transform: rotateY(0deg); }
  to { transform: rotateY(-180deg); }
}

@keyframes photobook-flip-back {
  from { transform: rotateY(0deg); }
  to { transform: rotateY(180deg); }
}

.photobook-progress {
  min-width: 4.5rem;
  text-align: center;
  color: #e2e8f0;
  font-size: 0.85rem;
}

.carousel-stage {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
}

.carousel-viewport {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  background: #020617;
  min-height: min(56vh, 520px);
  flex: 1 1 auto;
  width: 100%;
}

.carousel-scene {
  --carousel-card-w: 220px;
  --carousel-card-h: 158px;
  --carousel-radius: 320px;
  --carousel-step: 60deg;
  position: absolute;
  inset: 0;
  perspective: 1100px;
  perspective-origin: 50% 48%;
  transform-style: preserve-3d;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  outline: none;
  cursor: grab;
  user-select: none;
  pointer-events: auto;
}

.carousel-scene:active {
  cursor: grabbing;
}

.carousel-ring,
.carousel-card {
  pointer-events: none;
}

.carousel-ring {
  position: relative;
  width: var(--carousel-card-w);
  height: var(--carousel-card-h);
  transform-style: preserve-3d;
  transform: translateY(-6%) rotateX(-22deg) rotateY(0deg);
  will-change: transform;
}

.carousel-scene--h .carousel-ring::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--carousel-radius) * 2.15);
  height: calc(var(--carousel-radius) * 2.15);
  margin: calc(var(--carousel-radius) * -1.075) 0 0 calc(var(--carousel-radius) * -1.075);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(226, 232, 240, 0.16) 0%, rgba(15, 23, 42, 0.35) 42%, transparent 68%);
  border: 1px solid rgba(248, 250, 252, 0.12);
  transform: rotateX(90deg) translateZ(-6px);
  pointer-events: none;
}

.carousel-scene--v .carousel-ring {
  transform: rotateY(18deg) rotateX(0deg);
}

.carousel-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--carousel-card-w);
  height: var(--carousel-card-h);
  margin: calc(var(--carousel-card-h) / -2) 0 0 calc(var(--carousel-card-w) / -2);
  overflow: hidden;
  background: #0b1220;
  border: 8px solid #f1f5f9;
  border-radius: 4px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
  transform-origin: center center;
  transform: rotateY(calc(var(--carousel-i) * var(--carousel-step))) translateZ(var(--carousel-radius));
  backface-visibility: hidden;
}

.carousel-scene--v .carousel-card {
  transform: rotateX(calc(var(--carousel-i) * var(--carousel-step))) translateZ(var(--carousel-radius));
}

.carousel-card.is-front {
  border-color: #fff;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.carousel-card img,
.carousel-card video,
.carousel-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #020617;
  pointer-events: none;
}

.carousel-hud {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.carousel-nav,
.carousel-dots {
  pointer-events: auto;
}

.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(15, 23, 42, 0.68);
  color: #f8fafc;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.carousel-nav--prev { left: 10px; }
.carousel-nav--next { right: 10px; }

.carousel-nav:hover,
.carousel-nav:active {
  background: rgba(15, 23, 42, 0.9);
}

.carousel-caption {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 36px;
  z-index: 2;
  text-align: center;
  font-weight: 600;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

.carousel-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 6px;
}

.carousel-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.38);
  cursor: pointer;
}

.carousel-dot.is-active {
  width: 18px;
  background: #fff;
}

.carousel-hint {
  color: var(--photoview-meta);
  font-size: 0.85rem;
  margin: 0;
  text-align: center;
}

.photoview-block--fullscreen .carousel-viewport,
.carousel-block.photoview-block--fullscreen .carousel-viewport {
  min-height: min(72vh, 760px);
}

.photoview-block:fullscreen,
.photoview-block:-webkit-full-screen,
.photocube-block:fullscreen,
.photobook-block:fullscreen,
.carousel-block:fullscreen,
.photocube-block:-webkit-full-screen,
.photobook-block:-webkit-full-screen,
.carousel-block:-webkit-full-screen {
  width: 100%;
  height: 100%;
  min-height: 100%;
  max-width: none;
  margin: 0;
  padding: 12px;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

.photoview-block:fullscreen .photocube-stage,
.photoview-block:fullscreen .photobook-stage,
.photoview-block:fullscreen .carousel-stage,
.photoview-block:-webkit-full-screen .photocube-stage,
.photoview-block:-webkit-full-screen .photobook-stage,
.photoview-block:-webkit-full-screen .carousel-stage,
.photocube-block:fullscreen .photocube-stage,
.photobook-block:fullscreen .photobook-stage,
.carousel-block:fullscreen .carousel-stage,
.photocube-block:-webkit-full-screen .photocube-stage,
.photobook-block:-webkit-full-screen .photobook-stage,
.carousel-block:-webkit-full-screen .carousel-stage {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

.photoview-block:fullscreen .photocube-scene,
.photoview-block:-webkit-full-screen .photocube-scene,
.photocube-block:fullscreen .photocube-scene,
.photocube-block:-webkit-full-screen .photocube-scene {
  min-height: 0;
  height: 100%;
}

.photoview-block:fullscreen .carousel-viewport,
.photoview-block:-webkit-full-screen .carousel-viewport,
.carousel-block:fullscreen .carousel-viewport,
.carousel-block:-webkit-full-screen .carousel-viewport {
  min-height: 0;
  height: 100%;
}

.photoview-block:fullscreen .photobook-viewport,
.photoview-block:-webkit-full-screen .photobook-viewport,
.photobook-block:fullscreen .photobook-viewport,
.photobook-block:-webkit-full-screen .photobook-viewport {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
}

.photoview-block:fullscreen .photobook-book,
.photoview-block:fullscreen .photobook-book.is-open,
.photoview-block:fullscreen .photobook-book.is-closed,
.photoview-block:-webkit-full-screen .photobook-book,
.photoview-block:-webkit-full-screen .photobook-book.is-open,
.photoview-block:-webkit-full-screen .photobook-book.is-closed,
.photobook-block:fullscreen .photobook-book,
.photobook-block:fullscreen .photobook-book.is-open,
.photobook-block:fullscreen .photobook-book.is-closed,
.photobook-block:-webkit-full-screen .photobook-book,
.photobook-block:-webkit-full-screen .photobook-book.is-open,
.photobook-block:-webkit-full-screen .photobook-book.is-closed {
  min-height: 0;
  width: var(--photobook-w);
  height: var(--photobook-h);
  max-width: 100%;
  max-height: 100%;
}

@media (max-width: 768px) {
  .photoview-block,
  .photoview-block--fullscreen,
  body.mobile-layout .photoview-block,
  body.mobile-layout .photoview-block--fullscreen {
    min-height: 0;
    height: auto;
    max-height: min(56dvh, calc(100dvh - 7.5rem));
    padding: 8px 8px 10px;
  }

  .photocube-block,
  .photocube-block.photoview-block--fullscreen,
  body.mobile-layout .photocube-block,
  body.mobile-layout .photocube-block.photoview-block--fullscreen {
    min-height: 0;
    height: auto;
    max-height: min(52dvh, calc(100dvh - 7.5rem));
  }

  .photocube-scene,
  body.mobile-layout .photocube-scene {
    --photocube-size: min(48vw, 28dvh, 168px);
    min-height: min(32dvh, 210px);
    max-height: min(36dvh, 240px);
    overflow: hidden;
    perspective: 700px;
  }

  .carousel-block,
  .carousel-block.photoview-block--fullscreen,
  body.mobile-layout .carousel-block,
  body.mobile-layout .carousel-block.photoview-block--fullscreen {
    min-height: 0;
    height: auto;
    max-height: min(52dvh, calc(100dvh - 7.5rem));
  }

  .carousel-viewport,
  body.mobile-layout .carousel-viewport {
    min-height: min(32dvh, 210px);
    max-height: min(36dvh, 240px);
  }

  .carousel-scene,
  body.mobile-layout .carousel-scene {
    perspective: 700px;
  }

  .carousel-card {
    border-width: 5px;
  }

  .photocube-face {
    border-width: 6px;
  }

  .photocube-face-label {
    font-size: 0.6rem;
    left: 4px;
    bottom: 4px;
    padding: 1px 6px;
  }

  .photobook-block,
  .photobook-block.photoview-block--fullscreen,
  body.mobile-layout .photobook-block,
  body.mobile-layout .photobook-block.photoview-block--fullscreen {
    height: auto;
    min-height: 0;
    max-height: min(56dvh, calc(100dvh - 7.5rem));
  }

  .photobook-block .photobook-viewport,
  body.mobile-layout .photobook-block .photobook-viewport {
    min-height: min(36dvh, 240px);
    max-height: min(42dvh, 300px);
  }

  .photobook-book,
  .photobook-book.is-closed,
  .photobook-book.is-open,
  body.mobile-layout .photobook-book,
  body.mobile-layout .photobook-book.is-closed,
  body.mobile-layout .photobook-book.is-open {
    --photobook-w: min(86vw, 260px);
    --photobook-h: min(40dvh, 280px);
    width: var(--photobook-w);
    height: var(--photobook-h);
    min-height: 0;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: auto;
  }

  .photobook-spread {
    grid-template-columns: 1fr 8px 1fr;
  }

  .photobook-cover-front {
    padding: 10px 10px 12px;
    gap: 6px;
  }

  .photobook-cover-title {
    font-size: 0.95rem;
  }

  .photobook-page-inner {
    padding: 6px 6px 20px;
    gap: 4px;
  }

  .photobook-page-media,
  .photobook-page img,
  .photobook-page video {
    border-width: 3px;
  }

  .photobook-caption,
  .photobook-folio {
    font-size: 0.65rem;
  }

  .photocube-hint,
  .photobook-hint,
  .carousel-hint {
    font-size: 0.75rem;
  }

  .photoview-toolbar .btn {
    min-height: 36px;
    font-size: 12px;
    padding: 6px 10px;
  }

  .photocube-block .photoview-toolbar,
  .carousel-block .photoview-toolbar {
    flex-shrink: 0;
    position: relative;
    z-index: 5;
  }

  .photocube-block .photoview-toolbar [data-action="add-photo"],
  .carousel-block .photoview-toolbar [data-action="add-photo"] {
    min-height: 44px;
  }
}

body.mobile-layout .photoview-block,
body.mobile-layout .photoview-block--fullscreen {
  min-height: 0;
  height: auto;
  max-height: min(56dvh, calc(100dvh - 7.5rem));
  padding: 8px 8px 10px;
}

body.mobile-layout .photocube-block,
body.mobile-layout .photocube-block.photoview-block--fullscreen {
  min-height: 0;
  height: auto;
  max-height: min(52dvh, calc(100dvh - 7.5rem));
}

body.mobile-layout .photocube-block .photoview-toolbar,
body.mobile-layout .carousel-block .photoview-toolbar {
  flex-shrink: 0;
  position: relative;
  z-index: 5;
}

body.mobile-layout .photocube-block .photoview-toolbar [data-action="add-photo"],
body.mobile-layout .carousel-block .photoview-toolbar [data-action="add-photo"] {
  min-height: 44px;
}

body.mobile-layout .photobook-block,
body.mobile-layout .photobook-block.photoview-block--fullscreen {
  height: auto;
  min-height: 0;
  max-height: min(56dvh, calc(100dvh - 7.5rem));
}

body.mobile-layout .photobook-block .photobook-viewport {
  min-height: min(36dvh, 240px);
  max-height: min(42dvh, 300px);
}

body.mobile-layout .photobook-book,
body.mobile-layout .photobook-book.is-closed,
body.mobile-layout .photobook-book.is-open {
  --photobook-w: min(86vw, 260px);
  --photobook-h: min(40dvh, 280px);
  width: var(--photobook-w);
  height: var(--photobook-h);
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
}

body.mobile-layout .photocube-block:fullscreen,
body.mobile-layout .photocube-block:-webkit-full-screen,
body.mobile-layout .photobook-block:fullscreen,
body.mobile-layout .photobook-block:-webkit-full-screen {
  height: 100%;
  min-height: 100%;
  max-height: none;
}

body.mobile-layout .photocube-block:fullscreen .photocube-scene,
body.mobile-layout .photocube-block:-webkit-full-screen .photocube-scene {
  min-height: 0;
  max-height: none;
  height: 100%;
}

body.mobile-layout .photobook-block:fullscreen .photobook-viewport,
body.mobile-layout .photobook-block:-webkit-full-screen .photobook-viewport {
  min-height: 0;
  max-height: none;
}

body.gallery-lightbox-open {
  overflow: hidden;
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
}

.gallery-lightbox[hidden] {
  display: none !important;
}

.gallery-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.88);
  backdrop-filter: blur(4px);
}

.gallery-lightbox-stage {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-items: center;
  justify-items: center;
  padding: 24px;
  pointer-events: none;
}

.gallery-lightbox-stage > * {
  pointer-events: auto;
}

.gallery-lightbox-figure {
  grid-column: 2;
  grid-row: 2;
  margin: 0;
  max-width: min(92vw, 1100px);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.gallery-lightbox-frame {
  background:
    linear-gradient(145deg, #f8fafc 0%, #e2e8f0 55%, #cbd5e1 100%);
  padding: 14px 14px 28px;
  border-radius: 4px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.4) inset,
    0 24px 60px rgba(0, 0, 0, 0.55);
  max-width: 100%;
  max-height: calc(82vh - 48px);
}

.gallery-lightbox-img,
.gallery-lightbox-video,
.gallery-lightbox-yt {
  display: block;
  max-width: min(88vw, 1040px);
  max-height: calc(82vh - 90px);
  object-fit: contain;
  border-radius: 2px;
  background: #0f172a;
}

.gallery-lightbox-yt {
  width: min(88vw, 1040px);
  height: min(49.5vw, 585px);
  border: 0;
}

.gallery-lightbox-video[hidden],
.gallery-lightbox-img[hidden],
.gallery-lightbox-yt[hidden] {
  display: none !important;
}

.gallery-lightbox-caption {
  color: #e2e8f0;
  font-size: 0.95rem;
  text-align: center;
  min-height: 1.2em;
}

.gallery-lightbox-counter {
  grid-column: 2;
  grid-row: 3;
  color: #94a3b8;
  font-size: 0.85rem;
  margin-top: 8px;
}

.gallery-lightbox-close,
.gallery-lightbox-nav {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(15, 23, 42, 0.75);
  color: #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
}

.gallery-lightbox-close {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  width: 42px;
  height: 42px;
  font-size: 1.5rem;
  line-height: 1;
}

.gallery-lightbox-prev,
.gallery-lightbox-next {
  grid-row: 2;
  width: 48px;
  height: 48px;
  font-size: 1.8rem;
  line-height: 1;
}

.gallery-lightbox-prev { grid-column: 1; }
.gallery-lightbox-next { grid-column: 3; }

.gallery-lightbox-close:hover,
.gallery-lightbox-nav:hover {
  background: rgba(30, 41, 59, 0.95);
}

@media (max-width: 720px) {
  .gallery-grid {
    grid-template-columns: repeat(min(2, var(--gallery-cols)), minmax(0, 1fr));
  }
  .gallery-lightbox-prev,
  .gallery-lightbox-next {
    width: 40px;
    height: 40px;
  }
}

/* Roller coaster */
.rollercoast-block {
  --rollercoast-accent: #4ade80;
  --rollercoast-bg: #0f1a14;
  --rollercoast-title: #ecfdf5;
  --rollercoast-meta: #94a3b8;
  position: relative;
  background: var(--rollercoast-bg);
  color: #e2e8f0;
  border-left: 4px solid var(--rollercoast-accent);
  border-radius: 12px;
  padding: 14px;
  margin: 1rem 0;
  min-height: min(62vh, 640px);
  display: flex;
  flex-direction: column;
}

.rollercoast-block--info { --rollercoast-accent: #38bdf8; }
.rollercoast-block--success { --rollercoast-accent: #4ade80; }
.rollercoast-block--warning { --rollercoast-accent: #fbbf24; }
.rollercoast-block--danger { --rollercoast-accent: #f87171; }
.rollercoast-block--note { --rollercoast-accent: #94a3b8; }

.rollercoast-block--jungle { --rollercoast-bg: #0f1a14; --rollercoast-accent: #4ade80; }
.rollercoast-block--dune { --rollercoast-bg: #2a2118; --rollercoast-accent: #f0c27a; }
.rollercoast-block--snow { --rollercoast-bg: #15202b; --rollercoast-accent: #93c5fd; }
.rollercoast-block--alps { --rollercoast-bg: #1a2430; --rollercoast-accent: #a5c8e8; }

.rollercoast-block--custom {
  background: var(--rollercoast-bg-custom, var(--rollercoast-bg));
}

.rollercoast-block--error {
  color: #f87171;
  padding: 12px 14px;
}

.rollercoast-block--fullscreen {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 8px;
  border: none;
  border-radius: 0;
  border-left: none;
  min-height: min(78vh, 820px);
}

.rollercoast-block--uploading,
.rollercoast-block--drop {
  outline: 2px dashed var(--rollercoast-accent);
  outline-offset: 2px;
}

.rollercoast-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding-right: 44px;
}

.rollercoast-block-title {
  font-weight: 700;
  color: var(--rollercoast-title);
}

.rollercoast-block-meta {
  font-size: 12px;
  color: var(--rollercoast-meta);
  text-transform: capitalize;
}

.rollercoast-ride {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.rollercoast-viewport {
  position: relative;
  flex: 1;
  min-height: min(52vh, 520px);
  border-radius: 12px;
  overflow: hidden;
  background: #0b1220;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.rollercoast-block--fullscreen .rollercoast-viewport {
  min-height: min(68vh, 700px);
  border-radius: 8px;
}

.rollercoast-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.rollercoast-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 14px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
  color: #e2e8f0;
  pointer-events: none;
}

.rollercoast-hint {
  margin: 0;
  font-size: 0.78rem;
  color: #cbd5e1;
}

.rollercoast-caption {
  margin-top: 4px;
  font-size: 0.95rem;
  font-weight: 600;
  min-height: 1.2em;
}

.rollercoast-warn {
  margin-top: 4px;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fecaca;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}

.rollercoast-warn[hidden] {
  display: none !important;
}

.rollercoast-block--obstacle .rollercoast-viewport {
  box-shadow: inset 0 0 0 2px rgba(248, 113, 113, 0.55);
}

.rollercoast-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rollercoast-toolbar .btn.active {
  background: rgba(74, 222, 128, 0.22);
  border-color: rgba(74, 222, 128, 0.55);
  color: #dcfce7;
}

.rollercoast-status {
  min-height: 1.1rem;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--rollercoast-meta);
}

.rollercoast-block:fullscreen,
.rollercoast-block:-webkit-full-screen {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  padding: 12px;
  background: #0b1220;
  overflow: hidden;
}

.rollercoast-block:fullscreen .rollercoast-ride,
.rollercoast-block:-webkit-full-screen .rollercoast-ride {
  flex: 1;
  min-height: 0;
}

.rollercoast-block:fullscreen .rollercoast-viewport,
.rollercoast-block:-webkit-full-screen .rollercoast-viewport {
  flex: 1;
  min-height: 0;
  border-radius: 0;
}

/* Auto scooter */
.scooter-block {
  --scooter-accent: #fb923c;
  --scooter-bg: #152033;
  --scooter-title: #fff7ed;
  --scooter-meta: #94a3b8;
  position: relative;
  background: var(--scooter-bg);
  color: #e2e8f0;
  border-left: 4px solid var(--scooter-accent);
  border-radius: 12px;
  padding: 14px;
  margin: 1rem 0;
  min-height: min(62vh, 640px);
  display: flex;
  flex-direction: column;
}

.scooter-block--info { --scooter-accent: #38bdf8; }
.scooter-block--success { --scooter-accent: #4ade80; }
.scooter-block--warning { --scooter-accent: #fb923c; }
.scooter-block--danger { --scooter-accent: #f87171; }
.scooter-block--note { --scooter-accent: #94a3b8; }

.scooter-block--custom {
  background: var(--scooter-bg-custom, var(--scooter-bg));
}

.scooter-block--error {
  color: #f87171;
  padding: 12px 14px;
}

.scooter-block--fullscreen {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 8px;
  border: none;
  border-radius: 0;
  border-left: none;
  min-height: min(78vh, 820px);
}

.scooter-block--uploading,
.scooter-block--drop {
  outline: 2px dashed var(--scooter-accent);
  outline-offset: 2px;
}

.scooter-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding-right: 44px;
}

.scooter-block-title {
  font-weight: 700;
  color: var(--scooter-title);
}

.scooter-block-meta {
  font-size: 12px;
  color: var(--scooter-meta);
}

.scooter-ride {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.scooter-viewport {
  position: relative;
  flex: 1;
  min-height: min(52vh, 520px);
  border-radius: 12px;
  overflow: hidden;
  background: #0b1220;
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: crosshair;
}

.scooter-block--fullscreen .scooter-viewport {
  min-height: min(68vh, 700px);
  border-radius: 8px;
}

.scooter-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.scooter-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 14px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
  color: #e2e8f0;
  pointer-events: none;
}

.scooter-hint {
  margin: 0;
  font-size: 0.78rem;
  color: #cbd5e1;
}

.scooter-caption {
  margin-top: 4px;
  font-size: 0.95rem;
  font-weight: 600;
  min-height: 1.2em;
}

.scooter-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.scooter-status {
  min-height: 1.1rem;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--scooter-meta);
}

.scooter-block:fullscreen,
.scooter-block:-webkit-full-screen {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  padding: 12px;
  background: #0b1220;
  overflow: hidden;
}

.scooter-block:fullscreen .scooter-ride,
.scooter-block:-webkit-full-screen .scooter-ride {
  flex: 1;
  min-height: 0;
}

.scooter-block:fullscreen .scooter-viewport,
.scooter-block:-webkit-full-screen .scooter-viewport {
  flex: 1;
  min-height: 0;
  border-radius: 0;
}

/* Ghost train */
.ghosttrain-block {
  --ghosttrain-accent: #a78bfa;
  --ghosttrain-bg: #120a1f;
  --ghosttrain-title: #ede9fe;
  --ghosttrain-meta: #94a3b8;
  position: relative;
  background: var(--ghosttrain-bg);
  color: #e2e8f0;
  border-left: 4px solid var(--ghosttrain-accent);
  border-radius: 12px;
  padding: 14px;
  margin: 1rem 0;
  min-height: min(62vh, 640px);
  display: flex;
  flex-direction: column;
}

.ghosttrain-block--info { --ghosttrain-accent: #38bdf8; }
.ghosttrain-block--success { --ghosttrain-accent: #4ade80; }
.ghosttrain-block--warning { --ghosttrain-accent: #fbbf24; }
.ghosttrain-block--danger { --ghosttrain-accent: #f87171; }
.ghosttrain-block--note { --ghosttrain-accent: #a78bfa; }

.ghosttrain-block--custom {
  background: var(--ghosttrain-bg-custom, var(--ghosttrain-bg));
}

.ghosttrain-block--error {
  color: #f87171;
  padding: 12px 14px;
}

.ghosttrain-block--fullscreen {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 8px;
  border: none;
  border-radius: 0;
  border-left: none;
  min-height: min(78vh, 820px);
}

.ghosttrain-block--uploading,
.ghosttrain-block--drop {
  outline: 2px dashed var(--ghosttrain-accent);
  outline-offset: 2px;
}

.ghosttrain-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding-right: 44px;
}

.ghosttrain-block-title {
  font-weight: 700;
  color: var(--ghosttrain-title);
}

.ghosttrain-block-meta {
  font-size: 12px;
  color: var(--ghosttrain-meta);
}

.ghosttrain-ride {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.ghosttrain-viewport {
  position: relative;
  flex: 1;
  min-height: min(52vh, 520px);
  border-radius: 12px;
  overflow: hidden;
  background: #0b1020;
  border: 1px solid rgba(167, 139, 250, 0.18);
  cursor: crosshair;
}

.ghosttrain-block--fullscreen .ghosttrain-viewport {
  min-height: min(68vh, 700px);
  border-radius: 8px;
}

.ghosttrain-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.ghosttrain-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 14px;
  background: linear-gradient(transparent, rgba(18, 10, 31, 0.82));
  color: #e2e8f0;
  pointer-events: none;
}

.ghosttrain-hint {
  margin: 0;
  font-size: 0.78rem;
  color: #c4b5fd;
}

.ghosttrain-caption {
  margin-top: 4px;
  font-size: 0.95rem;
  font-weight: 600;
  min-height: 1.2em;
}

.ghosttrain-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ghosttrain-status {
  min-height: 1.1rem;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--ghosttrain-meta);
}

.ghosttrain-block:fullscreen,
.ghosttrain-block:-webkit-full-screen {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  padding: 12px;
  background: #0b1020;
  overflow: hidden;
}

.ghosttrain-block:fullscreen .ghosttrain-ride,
.ghosttrain-block:-webkit-full-screen .ghosttrain-ride {
  flex: 1;
  min-height: 0;
}

.ghosttrain-block:fullscreen .ghosttrain-viewport,
.ghosttrain-block:-webkit-full-screen .ghosttrain-viewport {
  flex: 1;
  min-height: 0;
  border-radius: 0;
}

/* Photo labyrinth */
.labyrinth-block {
  --labyrinth-accent: #eab308;
  --labyrinth-bg: #1a140c;
  --labyrinth-title: #fde68a;
  --labyrinth-meta: #94a3b8;
  position: relative;
  background: var(--labyrinth-bg);
  color: #e2e8f0;
  border-left: 4px solid var(--labyrinth-accent);
  border-radius: 12px;
  padding: 14px;
  margin: 1rem 0;
  min-height: min(62vh, 640px);
  display: flex;
  flex-direction: column;
}

.labyrinth-block--info { --labyrinth-accent: #38bdf8; }
.labyrinth-block--success { --labyrinth-accent: #4ade80; }
.labyrinth-block--warning { --labyrinth-accent: #eab308; }
.labyrinth-block--danger { --labyrinth-accent: #f87171; }
.labyrinth-block--note { --labyrinth-accent: #94a3b8; }

.labyrinth-block--custom {
  background: var(--labyrinth-bg-custom, var(--labyrinth-bg));
}

.labyrinth-block--error {
  color: #f87171;
  padding: 12px 14px;
}

.labyrinth-block--fullscreen {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 8px;
  border: none;
  border-radius: 0;
  border-left: none;
  min-height: min(78vh, 820px);
}

.labyrinth-block--uploading,
.labyrinth-block--drop {
  outline: 2px dashed var(--labyrinth-accent);
  outline-offset: 2px;
}

.labyrinth-block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding-right: 44px;
}

.labyrinth-block-title {
  font-weight: 700;
  color: var(--labyrinth-title);
}

.labyrinth-block-meta {
  font-size: 12px;
  color: var(--labyrinth-meta);
}

.labyrinth-walk {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.labyrinth-viewport {
  position: relative;
  flex: 1;
  min-height: min(58vh, 560px);
  border-radius: 12px;
  overflow: hidden;
  background: #120e0a;
  border: 1px solid rgba(234, 179, 8, 0.22);
  cursor: crosshair;
}

.labyrinth-viewport--locked {
  cursor: none;
}

.labyrinth-block--fullscreen .labyrinth-viewport {
  min-height: min(68vh, 700px);
  border-radius: 8px;
}

.labyrinth-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.labyrinth-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 14px;
  background: linear-gradient(transparent, rgba(18, 12, 6, 0.82));
  color: #e2e8f0;
  pointer-events: none;
}

.labyrinth-hud {
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.62);
  color: #fde68a;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.labyrinth-hud__best {
  color: #bbf7d0;
}

.labyrinth-finish {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(6, 12, 8, 0.55);
  color: #ecfdf5;
  text-align: center;
  pointer-events: none;
}

.labyrinth-finish[hidden] {
  display: none !important;
}

.labyrinth-finish__kicker {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #bbf7d0;
}

.labyrinth-finish__time {
  margin: 0;
  font-size: 2.4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fef3c7;
}

.labyrinth-finish__hint {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: #94a3b8;
}

.labyrinth-hint {
  margin: 0;
  font-size: 0.78rem;
  color: #fde68a;
}

.labyrinth-hint kbd {
  display: inline-block;
  margin: 0 1px;
  padding: 0 4px;
  border: 1px solid rgba(253, 230, 138, 0.35);
  border-radius: 4px;
  font-size: 0.72rem;
}

.labyrinth-hint--mobile {
  display: none;
}

body.mobile-layout .labyrinth-hint--desktop {
  display: none;
}

body.mobile-layout .labyrinth-hint--mobile {
  display: block;
}

.labyrinth-pad {
  display: none;
  position: absolute;
  left: 10px;
  bottom: 56px;
  z-index: 3;
  grid-template-columns: 56px 56px 56px;
  grid-template-areas:
    ". w ."
    "a s d";
  gap: 8px;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
}

.labyrinth-pad.is-visible,
body.mobile-layout .labyrinth-pad {
  display: grid;
}

@media (max-width: 768px) {
  .labyrinth-pad {
    display: grid;
  }

  .labyrinth-overlay {
    padding-left: 196px;
  }
}

.labyrinth-pad__btn {
  touch-action: none;
  border: 1px solid rgba(253, 230, 138, 0.45);
  background: rgba(18, 12, 6, 0.78);
  color: #fde68a;
  font: 700 16px/1 system-ui, sans-serif;
  border-radius: 14px;
  min-height: 52px;
  min-width: 52px;
}

.labyrinth-pad__btn--w { grid-area: w; }
.labyrinth-pad__btn--a { grid-area: a; }
.labyrinth-pad__btn--s { grid-area: s; }
.labyrinth-pad__btn--d { grid-area: d; }

.labyrinth-pad__btn:active,
.labyrinth-pad__btn.is-active {
  background: rgba(234, 179, 8, 0.42);
  border-color: rgba(253, 230, 138, 0.95);
  color: #fff;
}

.labyrinth-caption {
  margin-top: 4px;
  font-size: 0.95rem;
  font-weight: 600;
  min-height: 1.2em;
}

.labyrinth-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.labyrinth-drive-url {
  flex: 1 1 180px;
  min-width: 140px;
  max-width: 320px;
  min-height: 31px;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.35);
  color: #ffffff;
  font: 400 0.8rem/1.2 Arial, sans-serif;
}

.labyrinth-drive-url::placeholder {
  color: rgba(255, 255, 255, 0.65);
}

.labyrinth-toolbar .btn.active {
  background: rgba(234, 179, 8, 0.22);
  border-color: rgba(234, 179, 8, 0.55);
  color: #fef3c7;
}

.labyrinth-block--mobile .labyrinth-overlay {
  padding-left: 196px;
}

.labyrinth-status {
  min-height: 1.1rem;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--labyrinth-meta);
}

body.mobile-layout .labyrinth-toolbar [data-action="walk-focus"] {
  display: none !important;
}

body.mobile-layout .labyrinth-toolbar [data-action="walk-demo"] {
  min-height: 44px;
  padding: 0.45rem 0.9rem;
}

@media (max-width: 768px) {
  .labyrinth-hint--desktop {
    display: none;
  }

  .labyrinth-hint--mobile {
    display: block;
  }

  .labyrinth-toolbar [data-action="walk-focus"] {
    display: none !important;
  }

  .labyrinth-toolbar [data-action="walk-demo"] {
    min-height: 44px;
    padding: 0.45rem 0.9rem;
  }
}

.labyrinth-block:fullscreen,
.labyrinth-block:-webkit-full-screen {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  padding: 12px;
  background: #120e0a;
  overflow: hidden;
}

.labyrinth-block:fullscreen .labyrinth-walk,
.labyrinth-block:-webkit-full-screen .labyrinth-walk {
  flex: 1;
  min-height: 0;
}

.labyrinth-block:fullscreen .labyrinth-viewport,
.labyrinth-block:-webkit-full-screen .labyrinth-viewport {
  flex: 1;
  min-height: 0;
  border-radius: 0;
}

/* Monitor fullscreen button + native :fullscreen layout */
.sudoku-block,
.puzzle-block,
.pinball-block,
.pacman-block,
.mario-block,
.lemmings-block,
.tictactoe-block,
.chess-block,
.connect4-block,
.reversi-block, .muhle-block, .backgammon-block,
.tetris-block,
.sokoban-block,
.invaders-block,
.breakout-block,
.snake-block,
.marbleblast-block,
.gallery-block,
.photocube-block,
.photobook-block,
.carousel-block,
.rollercoast-block,
.scooter-block,
.ghosttrain-block,
.labyrinth-block {
  position: relative;
}

.game-fullscreen-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.72);
  color: #e2e8f0;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.game-fullscreen-btn:hover {
  background: rgba(30, 41, 59, 0.92);
  border-color: rgba(255, 255, 255, 0.35);
}

.game-fullscreen-btn:active {
  transform: scale(0.96);
}

.game-fullscreen-btn__icon {
  font-size: 15px;
  line-height: 1;
  pointer-events: none;
}

.game-fullscreen-btn__icon--exit {
  display: none;
}

.game-block--monitor-fullscreen .game-fullscreen-btn__icon--enter,
.sudoku-block:fullscreen .game-fullscreen-btn__icon--enter,
.puzzle-block:fullscreen .game-fullscreen-btn__icon--enter,
.pinball-block:fullscreen .game-fullscreen-btn__icon--enter,
.pacman-block:fullscreen .game-fullscreen-btn__icon--enter,
.mario-block:fullscreen .game-fullscreen-btn__icon--enter,
.lemmings-block:fullscreen .game-fullscreen-btn__icon--enter,
.tictactoe-block:fullscreen .game-fullscreen-btn__icon--enter,
.chess-block:fullscreen .game-fullscreen-btn__icon--enter,
.connect4-block:fullscreen .game-fullscreen-btn__icon--enter,
.reversi-block:fullscreen .game-fullscreen-btn__icon--enter, .muhle-block:fullscreen .game-fullscreen-btn__icon--enter, .backgammon-block:fullscreen .game-fullscreen-btn__icon--enter,
.tetris-block:fullscreen .game-fullscreen-btn__icon--enter,
.sokoban-block:fullscreen .game-fullscreen-btn__icon--enter,
.invaders-block:fullscreen .game-fullscreen-btn__icon--enter,
.breakout-block:fullscreen .game-fullscreen-btn__icon--enter,
.snake-block:fullscreen .game-fullscreen-btn__icon--enter,
.marbleblast-block:fullscreen .game-fullscreen-btn__icon--enter,
.gallery-block:fullscreen .game-fullscreen-btn__icon--enter,
.training-block:fullscreen .game-fullscreen-btn__icon--enter,
.photocube-block:fullscreen .game-fullscreen-btn__icon--enter,
.photobook-block:fullscreen .game-fullscreen-btn__icon--enter,
.carousel-block:fullscreen .game-fullscreen-btn__icon--enter,
.rollercoast-block:fullscreen .game-fullscreen-btn__icon--enter,
.scooter-block:fullscreen .game-fullscreen-btn__icon--enter,
.ghosttrain-block:fullscreen .game-fullscreen-btn__icon--enter,
.labyrinth-block:fullscreen .game-fullscreen-btn__icon--enter,
.sudoku-block:-webkit-full-screen .game-fullscreen-btn__icon--enter,
.puzzle-block:-webkit-full-screen .game-fullscreen-btn__icon--enter,
.pinball-block:-webkit-full-screen .game-fullscreen-btn__icon--enter,
.pacman-block:-webkit-full-screen .game-fullscreen-btn__icon--enter,
.mario-block:-webkit-full-screen .game-fullscreen-btn__icon--enter,
.lemmings-block:-webkit-full-screen .game-fullscreen-btn__icon--enter,
.tictactoe-block:-webkit-full-screen .game-fullscreen-btn__icon--enter,
.chess-block:-webkit-full-screen .game-fullscreen-btn__icon--enter,
.connect4-block:-webkit-full-screen .game-fullscreen-btn__icon--enter,
.reversi-block:-webkit-full-screen .game-fullscreen-btn__icon--enter, .muhle-block:-webkit-full-screen .game-fullscreen-btn__icon--enter, .backgammon-block:-webkit-full-screen .game-fullscreen-btn__icon--enter,
.tetris-block:-webkit-full-screen .game-fullscreen-btn__icon--enter,
.sokoban-block:-webkit-full-screen .game-fullscreen-btn__icon--enter,
.invaders-block:-webkit-full-screen .game-fullscreen-btn__icon--enter,
.breakout-block:-webkit-full-screen .game-fullscreen-btn__icon--enter,
.snake-block:-webkit-full-screen .game-fullscreen-btn__icon--enter,
.marbleblast-block:-webkit-full-screen .game-fullscreen-btn__icon--enter,
.gallery-block:-webkit-full-screen .game-fullscreen-btn__icon--enter,
.training-block:-webkit-full-screen .game-fullscreen-btn__icon--enter,
.photocube-block:-webkit-full-screen .game-fullscreen-btn__icon--enter,
.photobook-block:-webkit-full-screen .game-fullscreen-btn__icon--enter,
.rollercoast-block:-webkit-full-screen .game-fullscreen-btn__icon--enter,
.scooter-block:-webkit-full-screen .game-fullscreen-btn__icon--enter,
.ghosttrain-block:-webkit-full-screen .game-fullscreen-btn__icon--enter,
.labyrinth-block:-webkit-full-screen .game-fullscreen-btn__icon--enter {
  display: none;
}

.game-block--monitor-fullscreen .game-fullscreen-btn__icon--exit,
.sudoku-block:fullscreen .game-fullscreen-btn__icon--exit,
.puzzle-block:fullscreen .game-fullscreen-btn__icon--exit,
.pinball-block:fullscreen .game-fullscreen-btn__icon--exit,
.pacman-block:fullscreen .game-fullscreen-btn__icon--exit,
.mario-block:fullscreen .game-fullscreen-btn__icon--exit,
.lemmings-block:fullscreen .game-fullscreen-btn__icon--exit,
.tictactoe-block:fullscreen .game-fullscreen-btn__icon--exit,
.chess-block:fullscreen .game-fullscreen-btn__icon--exit,
.connect4-block:fullscreen .game-fullscreen-btn__icon--exit,
.reversi-block:fullscreen .game-fullscreen-btn__icon--exit, .muhle-block:fullscreen .game-fullscreen-btn__icon--exit, .backgammon-block:fullscreen .game-fullscreen-btn__icon--exit,
.tetris-block:fullscreen .game-fullscreen-btn__icon--exit,
.sokoban-block:fullscreen .game-fullscreen-btn__icon--exit,
.invaders-block:fullscreen .game-fullscreen-btn__icon--exit,
.breakout-block:fullscreen .game-fullscreen-btn__icon--exit,
.snake-block:fullscreen .game-fullscreen-btn__icon--exit,
.marbleblast-block:fullscreen .game-fullscreen-btn__icon--exit,
.gallery-block:fullscreen .game-fullscreen-btn__icon--exit,
.training-block:fullscreen .game-fullscreen-btn__icon--exit,
.photocube-block:fullscreen .game-fullscreen-btn__icon--exit,
.photobook-block:fullscreen .game-fullscreen-btn__icon--exit,
.carousel-block:fullscreen .game-fullscreen-btn__icon--exit,
.rollercoast-block:fullscreen .game-fullscreen-btn__icon--exit,
.scooter-block:fullscreen .game-fullscreen-btn__icon--exit,
.ghosttrain-block:fullscreen .game-fullscreen-btn__icon--exit,
.labyrinth-block:fullscreen .game-fullscreen-btn__icon--exit,
.sudoku-block:-webkit-full-screen .game-fullscreen-btn__icon--exit,
.puzzle-block:-webkit-full-screen .game-fullscreen-btn__icon--exit,
.pinball-block:-webkit-full-screen .game-fullscreen-btn__icon--exit,
.pacman-block:-webkit-full-screen .game-fullscreen-btn__icon--exit,
.mario-block:-webkit-full-screen .game-fullscreen-btn__icon--exit,
.lemmings-block:-webkit-full-screen .game-fullscreen-btn__icon--exit,
.tictactoe-block:-webkit-full-screen .game-fullscreen-btn__icon--exit,
.chess-block:-webkit-full-screen .game-fullscreen-btn__icon--exit,
.connect4-block:-webkit-full-screen .game-fullscreen-btn__icon--exit,
.reversi-block:-webkit-full-screen .game-fullscreen-btn__icon--exit, .muhle-block:-webkit-full-screen .game-fullscreen-btn__icon--exit, .backgammon-block:-webkit-full-screen .game-fullscreen-btn__icon--exit,
.tetris-block:-webkit-full-screen .game-fullscreen-btn__icon--exit,
.sokoban-block:-webkit-full-screen .game-fullscreen-btn__icon--exit,
.invaders-block:-webkit-full-screen .game-fullscreen-btn__icon--exit,
.breakout-block:-webkit-full-screen .game-fullscreen-btn__icon--exit,
.snake-block:-webkit-full-screen .game-fullscreen-btn__icon--exit,
.marbleblast-block:-webkit-full-screen .game-fullscreen-btn__icon--exit,
.gallery-block:-webkit-full-screen .game-fullscreen-btn__icon--exit,
.training-block:-webkit-full-screen .game-fullscreen-btn__icon--exit,
.photocube-block:-webkit-full-screen .game-fullscreen-btn__icon--exit,
.photobook-block:-webkit-full-screen .game-fullscreen-btn__icon--exit,
.rollercoast-block:-webkit-full-screen .game-fullscreen-btn__icon--exit,
.scooter-block:-webkit-full-screen .game-fullscreen-btn__icon--exit,
.ghosttrain-block:-webkit-full-screen .game-fullscreen-btn__icon--exit,
.labyrinth-block:-webkit-full-screen .game-fullscreen-btn__icon--exit {
  display: inline;
}

.sudoku-block:fullscreen,
.puzzle-block:fullscreen,
.pinball-block:fullscreen,
.pacman-block:fullscreen,
.mario-block:fullscreen,
.lemmings-block:fullscreen,
.tictactoe-block:fullscreen,
.chess-block:fullscreen,
.connect4-block:fullscreen,
.reversi-block:fullscreen, .muhle-block:fullscreen, .backgammon-block:fullscreen,
.tetris-block:fullscreen,
.sokoban-block:fullscreen,
.invaders-block:fullscreen,
.breakout-block:fullscreen,
.snake-block:fullscreen,
.marbleblast-block:fullscreen,
.sudoku-block:-webkit-full-screen,
.puzzle-block:-webkit-full-screen,
.pinball-block:-webkit-full-screen,
.pacman-block:-webkit-full-screen,
.mario-block:-webkit-full-screen,
.lemmings-block:-webkit-full-screen,
.tictactoe-block:-webkit-full-screen,
.chess-block:-webkit-full-screen,
.connect4-block:-webkit-full-screen,
.reversi-block:-webkit-full-screen, .muhle-block:-webkit-full-screen, .backgammon-block:-webkit-full-screen,
.tetris-block:-webkit-full-screen,
.sokoban-block:-webkit-full-screen,
.invaders-block:-webkit-full-screen,
.breakout-block:-webkit-full-screen,
.snake-block:-webkit-full-screen,
.marbleblast-block:-webkit-full-screen {
  width: 100%;
  height: 100%;
  min-height: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  border-left: none;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.sudoku-block:fullscreen .sudoku-play-area,
.puzzle-block:fullscreen .puzzle-play-area,
.pinball-block:fullscreen .pinball-frame-wrap,
.pacman-block:fullscreen .pacman-stage,
.mario-block:fullscreen .mario-stage,
.tictactoe-block:fullscreen .tictactoe-play-area,
.chess-block:fullscreen .chess-play-area,
.connect4-block:fullscreen .connect4-play-area,
.reversi-block:fullscreen .reversi-play-area, .muhle-block:fullscreen .muhle-play-area, .backgammon-block:fullscreen .backgammon-play-area,
.tetris-block:fullscreen .tetris-stage,
.sokoban-block:fullscreen .sokoban-stage,
.invaders-block:fullscreen .invaders-stage,
.breakout-block:fullscreen .breakout-stage,
.snake-block:fullscreen .snake-stage,
.marbleblast-block:fullscreen .marbleblast-stage,
.sudoku-block:-webkit-full-screen .sudoku-play-area,
.puzzle-block:-webkit-full-screen .puzzle-play-area,
.pinball-block:-webkit-full-screen .pinball-frame-wrap,
.pacman-block:-webkit-full-screen .pacman-stage,
.tictactoe-block:-webkit-full-screen .tictactoe-play-area,
.chess-block:-webkit-full-screen .chess-play-area,
.connect4-block:-webkit-full-screen .connect4-play-area,
.reversi-block:-webkit-full-screen .reversi-play-area, .muhle-block:-webkit-full-screen .muhle-play-area, .backgammon-block:-webkit-full-screen .backgammon-play-area,
.tetris-block:-webkit-full-screen .tetris-stage,
.sokoban-block:-webkit-full-screen .sokoban-stage,
.invaders-block:-webkit-full-screen .invaders-stage,
.breakout-block:-webkit-full-screen .breakout-stage,
.snake-block:-webkit-full-screen .snake-stage,
.marbleblast-block:-webkit-full-screen .marbleblast-stage {
  flex: 1;
  min-height: 0;
}

.pinball-block:fullscreen .pinball-frame-wrap,
.pinball-block:-webkit-full-screen .pinball-frame-wrap {
  width: 100%;
  max-width: none;
  max-height: none;
  aspect-ratio: unset;
  border: none;
  border-radius: 0;
}

.pinball-block:fullscreen .pinball-frame,
.pinball-block:-webkit-full-screen .pinball-frame {
  width: 100%;
  height: 100%;
}

.pacman-block:fullscreen .pacman-stage,
.pacman-block:-webkit-full-screen .pacman-stage {
  width: 100%;
  max-width: none;
  border: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pacman-block:fullscreen .pacman-canvas,
.pacman-block:-webkit-full-screen .pacman-canvas {
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.mario-block:fullscreen .mario-stage,
.mario-block:-webkit-full-screen .mario-stage {
  width: 100%;
  max-width: none;
  border: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mario-block:fullscreen .mario-canvas,
.mario-block:-webkit-full-screen .mario-canvas {
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.lemmings-block:fullscreen .lemmings-stage,
.lemmings-block:-webkit-full-screen .lemmings-stage {
  width: 100%;
  max-width: none;
  border: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lemmings-block:fullscreen .lemmings-canvas,
.lemmings-block:-webkit-full-screen .lemmings-canvas {
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.lemmings-block:fullscreen .lemmings-skills,
.lemmings-block:-webkit-full-screen .lemmings-skills {
  width: 100%;
  border-radius: 0;
}

.tetris-block:fullscreen .tetris-stage,
.tetris-block:-webkit-full-screen .tetris-stage,
.sokoban-block:fullscreen .sokoban-stage,
.sokoban-block:-webkit-full-screen .sokoban-stage,
.invaders-block:fullscreen .invaders-stage,
.invaders-block:-webkit-full-screen .invaders-stage,
.breakout-block:fullscreen .breakout-stage,
.breakout-block:-webkit-full-screen .breakout-stage,
.snake-block:fullscreen .snake-stage,
.snake-block:-webkit-full-screen .snake-stage {
  width: 100%;
  max-width: none;
  border: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tetris-block:fullscreen .tetris-canvas,
.tetris-block:-webkit-full-screen .tetris-canvas,
.sokoban-block:fullscreen .sokoban-canvas,
.sokoban-block:-webkit-full-screen .sokoban-canvas,
.invaders-block:fullscreen .invaders-canvas,
.invaders-block:-webkit-full-screen .invaders-canvas,
.breakout-block:fullscreen .breakout-canvas,
.breakout-block:-webkit-full-screen .breakout-canvas,
.snake-block:fullscreen .snake-canvas,
.snake-block:-webkit-full-screen .snake-canvas {
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.marbleblast-block:fullscreen .marbleblast-stage,
.marbleblast-block:-webkit-full-screen .marbleblast-stage {
  width: 100%;
  max-width: none;
  border: none;
  border-radius: 0;
}

.marbleblast-block:fullscreen .marbleblast-canvas,
.marbleblast-block:-webkit-full-screen .marbleblast-canvas {
  width: 100%;
  height: 100%;
}

.puzzle-block:fullscreen .puzzle-jq-mount,
.puzzle-block:-webkit-full-screen .puzzle-jq-mount {
  width: 100%;
  max-width: none;
}

/* --- Google Keep-style quick notes --- */
.keep-wrap {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 20px 32px;
  background: #f1f3f4;
  color: #202124;
}

.main-pane--keep .editor-wrap {
  display: none !important;
}

.main-pane--keep #page-title {
  display: none !important;
}

.keep-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  max-width: 1200px;
  margin: 0 auto 16px;
}

.keep-search {
  flex: 1 1 220px;
  max-width: 420px;
  border-radius: 8px;
}

.keep-archived-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #5f6368;
  margin: 0;
  user-select: none;
}

.keep-composer {
  max-width: 600px;
  margin: 0 auto 24px;
  cursor: text;
}

.keep-composer-collapsed {
  padding: 12px 16px;
}

.keep-composer-placeholder {
  color: #5f6368;
  font-size: 15px;
}

.keep-composer-expanded {
  padding: 12px 16px 10px;
}

.keep-composer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
}

.keep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto;
  align-items: start;
}

.keep-card {
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.15), 0 1px 3px rgba(60, 64, 67, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.15s ease;
  position: relative;
}

.keep-card--draggable {
  cursor: default;
}

.keep-note-drag {
  cursor: grab;
  touch-action: none;
}

.keep-card--dragging,
.keep-card--dragging .keep-note-drag {
  opacity: 0.45;
  cursor: grabbing;
}

.keep-card--drop-before::before,
.keep-card--drop-after::after {
  content: '';
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: 3px;
  border-radius: 2px;
  background: #1a73e8;
  z-index: 2;
  pointer-events: none;
}

.keep-card--drop-before::before {
  left: -10px;
}

.keep-card--drop-after::after {
  right: -10px;
}

.keep-card:hover {
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.2), 0 4px 8px rgba(60, 64, 67, 0.12);
}

.keep-card--default { background: #fff; }
.keep-card--coral { background: #faafa8; }
.keep-card--peach { background: #f39f76; }
.keep-card--sand { background: #fff8b8; }
.keep-card--mint { background: #e2f6d3; }
.keep-card--sage { background: #b4eee3; }
.keep-card--fog { background: #d4e4ed; }
.keep-card--storm { background: #aeccdc; }
.keep-card--dark { background: #494646; color: #f8f9fa; }

.keep-card--dark .keep-input,
.keep-card--dark .keep-card-body,
.keep-card--dark .keep-card-title,
.keep-card--dark .keep-checklist-item label,
.keep-card--dark .keep-checklist-item span,
.keep-card--dark .keep-checklist-item input[type="text"] {
  color: #f8f9fa;
}

.keep-card--dark .keep-icon-btn {
  color: #e8eaed;
}

.keep-card:not(.keep-card--expanded) .keep-note-colors,
#keep-composer:not(.keep-composer--editing) #keep-composer-colors {
  display: none;
}

.keep-card-inner {
  padding: 12px 14px 8px;
  min-height: 0;
}

.keep-card-view {
  max-height: 280px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.keep-card--expanded .keep-card-inner {
  max-height: min(60vh, 480px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.keep-input {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  resize: none;
  font-family: inherit;
  line-height: 1.45;
  color: #202124;
}

.keep-input::placeholder {
  color: #5f6368;
}

.keep-input-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.keep-input-body {
  font-size: 14px;
  min-height: 48px;
  max-height: none;
}

.keep-card-body {
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
  color: #202124;
}

.keep-card-body:not(.keep-md) {
  white-space: pre-wrap;
}

.keep-md {
  white-space: normal;
}

.keep-md > :first-child {
  margin-top: 0;
}

.keep-md > :last-child {
  margin-bottom: 0;
}

.keep-md p,
.keep-md ul,
.keep-md ol,
.keep-md pre,
.keep-md blockquote,
.keep-md table {
  margin: 0 0 0.55em;
}

.keep-md h1,
.keep-md h2,
.keep-md h3,
.keep-md h4 {
  margin: 0 0 0.4em;
  line-height: 1.25;
  font-weight: 600;
}

.keep-md h1 { font-size: 1.2em; }
.keep-md h2 { font-size: 1.1em; }
.keep-md h3,
.keep-md h4 { font-size: 1em; }

.keep-md ul,
.keep-md ol {
  padding-left: 1.25em;
}

.keep-md code {
  font-family: "Courier New", Courier, monospace;
  font-size: 0.92em;
  background: #f1f3f4;
  border: 1px solid #dadce0;
  border-radius: 4px;
  padding: 0.05em 0.3em;
}

.keep-md pre {
  overflow-x: auto;
  background: transparent;
  border-radius: 0;
  padding: 0;
  border: none;
}

.keep-md pre.code,
.keep-md .md-code-block__pre {
  background: transparent;
}

.keep-md pre code {
  background: transparent;
  border: none;
  padding: 0;
}

.keep-md .md-code-block {
  margin: 8px 0;
}

.keep-md blockquote {
  border-left: 3px solid rgba(0, 0, 0, 0.2);
  padding-left: 0.75em;
  color: #3c4043;
}

.keep-md a {
  color: #1a73e8;
  word-break: break-word;
}

.keep-md a.keep-external-link,
.keep-checklist-item a.keep-external-link {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.keep-md img.md-image,
.keep-md img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  display: block;
  margin: 6px 0;
}

.keep-md img.md-image--inline,
.keep-md a.md-image-link--inline img {
  display: inline-block;
  width: 48px;
  height: 48px;
  max-width: 48px;
  object-fit: cover;
  vertical-align: middle;
  margin: 0;
  border-radius: 4px;
}

.keep-md a.md-image-link--inline {
  display: inline-block;
  width: auto;
  max-width: none;
  line-height: 0;
  vertical-align: middle;
  margin: 0 8px 0 0;
}

.keep-md .md-image-wrap--full,
.keep-md a.md-image-link--full,
.keep-md img.md-image--full {
  width: 100%;
  max-width: 100%;
}

.keep-md table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92em;
}

.keep-md th,
.keep-md td {
  border: 1px solid rgba(0, 0, 0, 0.12);
  padding: 4px 6px;
}

.keep-md hr {
  border: 0;
  border-top: 1px solid rgba(0, 0, 0, 0.15);
  margin: 0.6em 0;
}

.keep-card--dark .keep-md,
.keep-card--dark .keep-md blockquote {
  color: #f8f9fa;
}

.keep-card--dark .keep-md a {
  color: #8ab4f8;
}

.keep-card--dark .keep-md code.md-inline-code,
.keep-card--dark .keep-md code:not(.md-code-block__code) {
  background: rgba(255, 255, 255, 0.1);
  border-color: #5f6368;
  color: #e8eaed;
}

.keep-card--dark .keep-md blockquote {
  border-left-color: rgba(255, 255, 255, 0.35);
}

.keep-card--dark .keep-md th,
.keep-card--dark .keep-md td {
  border-color: rgba(255, 255, 255, 0.2);
}

.keep-card--dark .keep-md hr {
  border-top-color: rgba(255, 255, 255, 0.25);
}

.keep-card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #202124;
}

.keep-card-footer {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px 8px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.keep-card:hover .keep-card-footer,
.keep-card--expanded .keep-card-footer,
.keep-card:focus-within .keep-card-footer {
  opacity: 1;
}

.keep-icon-btn {
  border: none;
  background: transparent;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #5f6368;
  cursor: pointer;
}

.keep-icon-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

.keep-icon-btn.active {
  color: #1a73e8;
}

.keep-color-picker {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.keep-color-dot {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  max-height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.12);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  line-height: 1;
  box-sizing: border-box;
  appearance: none;
}

.keep-color-dot.selected {
  box-shadow: 0 0 0 2px #1a73e8;
}

.keep-checklist {
  margin-top: 8px;
}

.keep-checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  min-height: 24px;
}

.keep-cl-drag {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  color: #5f6368;
  cursor: grab;
  user-select: none;
  font-size: 14px;
  line-height: 1;
}

.keep-cl-drag:hover {
  color: #202124;
}

.keep-cl-drag:active,
.keep-checklist-item--dragging .keep-cl-drag {
  cursor: grabbing;
}

.keep-checklist-item--dragging {
  opacity: 0.45;
}

.keep-checklist-item--drop-before {
  box-shadow: inset 0 2px 0 #1a73e8;
}

.keep-checklist-item--drop-after {
  box-shadow: inset 0 -2px 0 #1a73e8;
}

.keep-card--dark .keep-cl-drag {
  color: #9aa0a6;
}

.keep-card--dark .keep-cl-drag:hover {
  color: #e8eaed;
}

.keep-checklist-item input[type="checkbox"] {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  accent-color: #1a73e8;
  cursor: pointer;
}

.keep-checklist-item input[type="checkbox"]:disabled {
  cursor: default;
}

.keep-checklist-item input[type="text"],
.keep-checklist-item span {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  outline: none;
  margin: 0;
  padding: 0;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  color: #202124;
}

.keep-checklist-item.is-checked input[type="text"],
.keep-checklist-item.is-checked span {
  text-decoration: line-through;
  opacity: 0.65;
}

.keep-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: #5f6368;
  padding: 48px 16px;
  font-size: 14px;
}

@media (max-width: 768px) {
  .keep-wrap {
    padding: 12px 10px 24px;
  }

  .keep-grid {
    grid-template-columns: 1fr;
  }

  .keep-card-view {
    max-height: 220px;
  }

  .keep-card--expanded .keep-card-inner {
    max-height: min(55vh, 420px);
  }

  .keep-card-footer {
    opacity: 1;
  }
}

.scooter-pad {
  display: none;
  margin-top: 10px;
  grid-template-columns: 72px 72px 72px;
  grid-template-areas:
    ". w ."
    "a s d";
  justify-content: center;
  gap: 8px;
  user-select: none;
  -webkit-user-select: none;
}

.scooter-pad__btn {
  touch-action: none;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.72);
  color: #e2e8f0;
  font: 600 18px/1 system-ui, sans-serif;
  border-radius: 14px;
  min-height: 52px;
}

.scooter-pad__btn--w { grid-area: w; }
.scooter-pad__btn--a { grid-area: a; }
.scooter-pad__btn--s { grid-area: s; }
.scooter-pad__btn--d { grid-area: d; }

.scooter-pad__btn.is-active,
.scooter-pad__btn:active {
  background: rgba(56, 189, 248, 0.35);
}

@media (pointer: coarse), (max-width: 900px) {
  .pacman-pad,
  .mario-pad,
  .tetris-pad,
  .sokoban-pad,
  .invaders-pad,
  .breakout-pad,
  .snake-pad,
  .marbleblast-pad,
  .labyrinth-pad,
  .scooter-pad,
  body.mobile-layout .pacman-pad,
  body.mobile-layout .mario-pad,
  body.mobile-layout .tetris-pad,
  body.mobile-layout .sokoban-pad,
  body.mobile-layout .invaders-pad,
  body.mobile-layout .breakout-pad,
  body.mobile-layout .snake-pad,
  body.mobile-layout .marbleblast-pad,
  body.mobile-layout .labyrinth-pad,
  body.mobile-layout .scooter-pad {
    display: grid;
  }

  .pacman-block,
  .mario-block,
  .lemmings-block,
  .tictactoe-block,
  .chess-block,
  .connect4-block,
  .reversi-block,
  .muhle-block,
  .backgammon-block,
  .tetris-block,
  .sokoban-block,
  .invaders-block,
  .breakout-block,
  .snake-block,
  .marbleblast-block,
  .sudoku-block,
  .puzzle-block,
  .pinball-block,
  .scooter-block,
  .rollercoast-block,
  .ghosttrain-block,
  .labyrinth-block {
    width: 100%;
    max-width: 100%;
    touch-action: manipulation;
  }

  .chess-grid,
  .connect4-grid,
  .reversi-grid,
  .tictactoe-grid,
  .sudoku-grid,
  .muhle-board,
  .bg-board {
    width: 100%;
    max-width: 100%;
  }

  .chess-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
    grid-template-rows: none;
  }

  .chess-sq {
    aspect-ratio: 1;
    height: auto;
    min-height: 0;
    font-size: clamp(1rem, 5.2vw, 1.6rem);
  }

  .connect4-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-template-rows: none;
  }

  .connect4-cell,
  .reversi-cell,
  .tictactoe-cell {
    aspect-ratio: 1;
    min-height: 0;
    height: auto;
  }

  .reversi-grid,
  .tictactoe-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
    grid-template-rows: none;
  }

  .tictactoe-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pacman-block--fullscreen,
  .mario-block--fullscreen,
  .tetris-block--fullscreen,
  .sokoban-block--fullscreen,
  .invaders-block--fullscreen,
  .breakout-block--fullscreen,
.carambole-block--fullscreen,
.dart-block--fullscreen,
  .snake-block--fullscreen,
  .lemmings-block--fullscreen,
  .pinball-block--fullscreen,
  .sudoku-block--fullscreen,
  .puzzle-block--fullscreen,
  .marbleblast-block--fullscreen,
  .scooter-block--fullscreen,
  .rollercoast-block--fullscreen,
  .ghosttrain-block--fullscreen,
  .labyrinth-block--fullscreen,
  .chess-block--fullscreen,
  .connect4-block--fullscreen,
  .reversi-block--fullscreen,
  .muhle-block--fullscreen,
  .backgammon-block--fullscreen,
  .tictactoe-block--fullscreen {
    min-height: 0;
    height: auto;
  }

  .pacman-block--fullscreen .pacman-canvas,
  .mario-block--fullscreen .mario-canvas,
  .tetris-block--fullscreen .tetris-canvas,
  .sokoban-block--fullscreen .sokoban-canvas,
  .invaders-block--fullscreen .invaders-canvas,
  .breakout-block--fullscreen .breakout-canvas,
  .snake-block--fullscreen .snake-canvas,
  .lemmings-block--fullscreen .lemmings-canvas,
  .pacman-canvas,
  .mario-canvas,
  .tetris-canvas,
  .sokoban-canvas,
  .invaders-canvas,
  .breakout-canvas,
  .snake-canvas,
  .lemmings-canvas {
    max-height: 58vh;
    width: 100%;
    height: auto;
  }

  .scooter-block--fullscreen .scooter-viewport,
  .rollercoast-block--fullscreen .rollercoast-viewport,
  .ghosttrain-block--fullscreen .ghosttrain-viewport,
  .marbleblast-block--fullscreen .marbleblast-stage,
  .labyrinth-block--fullscreen .labyrinth-viewport,
  .pinball-block--fullscreen .pinball-frame-wrap,
  .scooter-viewport,
  .rollercoast-viewport,
  .ghosttrain-viewport,
  .marbleblast-stage,
  .labyrinth-viewport,
  .pinball-frame-wrap {
    min-height: 42vh;
    max-height: 58vh;
  }

  .puzzle-block .piece {
    touch-action: none;
  }

  .pacman-block:fullscreen .pacman-stage,
  .pacman-block:-webkit-full-screen .pacman-stage,
  .mario-block:fullscreen .mario-stage,
  .mario-block:-webkit-full-screen .mario-stage,
  .tetris-block:fullscreen .tetris-stage,
  .tetris-block:-webkit-full-screen .tetris-stage,
  .sokoban-block:fullscreen .sokoban-stage,
  .sokoban-block:-webkit-full-screen .sokoban-stage,
  .invaders-block:fullscreen .invaders-stage,
  .invaders-block:-webkit-full-screen .invaders-stage,
  .breakout-block:fullscreen .breakout-stage,
  .breakout-block:-webkit-full-screen .breakout-stage,
  .snake-block:fullscreen .snake-stage,
  .snake-block:-webkit-full-screen .snake-stage,
  .lemmings-block:fullscreen .lemmings-stage,
  .lemmings-block:-webkit-full-screen .lemmings-stage {
    min-height: 0;
    flex: 1 1 auto;
  }

  .pacman-block:fullscreen .pacman-canvas,
  .pacman-block:-webkit-full-screen .pacman-canvas,
  .mario-block:fullscreen .mario-canvas,
  .mario-block:-webkit-full-screen .mario-canvas,
  .tetris-block:fullscreen .tetris-canvas,
  .tetris-block:-webkit-full-screen .tetris-canvas,
  .sokoban-block:fullscreen .sokoban-canvas,
  .sokoban-block:-webkit-full-screen .sokoban-canvas,
  .invaders-block:fullscreen .invaders-canvas,
  .invaders-block:-webkit-full-screen .invaders-canvas,
  .breakout-block:fullscreen .breakout-canvas,
  .breakout-block:-webkit-full-screen .breakout-canvas,
  .snake-block:fullscreen .snake-canvas,
  .snake-block:-webkit-full-screen .snake-canvas,
  .lemmings-block:fullscreen .lemmings-canvas,
  .lemmings-block:-webkit-full-screen .lemmings-canvas {
    width: 100%;
    height: auto;
    max-height: 58vh;
  }

  .sudoku-num {
    min-width: 44px;
    height: 44px;
  }

  .pacman-block .btn,
  .mario-block .btn,
  .tetris-block .btn,
  .sokoban-block .btn,
  .invaders-block .btn,
  .breakout-block .btn,
  .snake-block .btn,
  .lemmings-block .btn,
  .marbleblast-block .btn,
  .scooter-block .btn,
  .rollercoast-block .btn,
  .ghosttrain-block .btn,
  .labyrinth-block .btn,
  .pinball-block .btn,
  .sudoku-block .btn,
  .puzzle-block .btn,
  .chess-block .btn,
  .connect4-block .btn,
  .reversi-block .btn,
  .muhle-block .btn,
  .backgammon-block .btn,
  .tictactoe-block .btn {
    min-height: 44px;
  }

  .muhle-toolbar,
  .backgammon-toolbar {
    width: 100%;
  }

  .muhle-chip,
  .backgammon-chip {
    min-height: 44px;
  }

  .muhle-lines {
    pointer-events: none;
  }

  .muhle-point {
    width: 13.5%;
    height: 13.5%;
    touch-action: manipulation;
  }

  .muhle-point--empty::after {
    width: 48%;
    height: 48%;
    margin: 26%;
  }

  .muhle-board,
  .muhle-block--fullscreen .muhle-board,
  .muhle-block:fullscreen .muhle-board,
  .muhle-block:-webkit-full-screen .muhle-board {
    width: min(100%, max(240px, calc(100dvh - 210px)));
    max-width: 100%;
    border-width: 5px;
  }
}

/* --- Yoga interval clock --- */
.training-block {
  --training-bg: var(--panel, #1e1e2e);
  --training-border: var(--line, #3b3b52);
  --training-accent: #f59e0b;
  border: 1px solid var(--training-border);
  border-left: 4px solid var(--training-accent);
  background: var(--training-bg);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 16px 0;
  width: 100%;
  box-sizing: border-box;
  color: var(--text, #e2e8f0);
}

.training-block--info { --training-accent: #38bdf8; }
.training-block--success { --training-accent: #4ade80; }
.training-block--warning { --training-accent: #fbbf24; }
.training-block--danger { --training-accent: #f87171; }
.training-block--note { --training-accent: #94a3b8; }

.training-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.training-title {
  font-weight: 700;
  font-size: 1.05rem;
}

.training-meta {
  color: var(--muted, #94a3b8);
  font-size: 0.85rem;
}

.training-stage {
  position: relative;
  min-height: 280px;
  border-radius: 12px;
  overflow: hidden;
  background: #111318;
  display: flex;
  align-items: center;
  justify-content: center;
}

.training-photo {
  position: relative;
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: min(72vh, 720px);
  object-fit: contain;
  object-position: center;
}

.training-clock {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 1;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.45);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: clamp(1.5rem, 4vw, 2.6rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1;
  color: #fff;
  pointer-events: none;
}

.training-clock.is-end {
  letter-spacing: 0.04em;
  text-transform: lowercase;
}

.training-caption {
  margin-top: 10px;
  font-size: 1.15rem;
  font-weight: 650;
}

.training-bar {
  height: 8px;
  margin-top: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.training-bar > span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--training-accent);
}

.training-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.training-controls button {
  border: 1px solid var(--training-border);
  background: transparent;
  color: inherit;
  border-radius: 8px;
  padding: 6px 12px;
}

.training-controls [data-action="toggle"] {
  background: var(--training-accent);
  color: #111;
  border-color: transparent;
  font-weight: 700;
}

.training-steps {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-top: 12px;
  padding-bottom: 4px;
}

.training-step {
  flex: 0 0 148px;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px 8px;
  align-items: center;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.training-step.is-current {
  border-color: var(--training-accent);
}

.training-step img,
.training-step-empty {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 6px;
  grid-row: 1 / span 2;
  background: #2a2a38;
}

.training-step-label {
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.training-step-time {
  width: 4.6rem;
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid var(--training-border);
  border-radius: 6px;
  padding: 2px 6px;
}

.training-step-remove {
  grid-row: 1 / span 2;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 2px;
}

.training-add {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.training-add .gallery-paste-zone {
  flex: 1 1 220px;
  min-height: 72px;
  padding: 12px;
}

.training-add-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.training-add-time {
  width: 5.2rem;
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid var(--training-border);
  border-radius: 6px;
  padding: 6px 8px;
}

.training-block--drop,
.training-block--paste-target,
.training-block--uploading {
  outline: 2px dashed var(--training-accent);
  outline-offset: 2px;
}

.training-block:fullscreen,
.training-block:-webkit-full-screen {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  margin: 0;
  background: #12121a;
  overflow: auto;
}

.training-block:fullscreen .training-stage,
.training-block:-webkit-full-screen .training-stage {
  flex: 1;
  min-height: 0;
}

.training-block:fullscreen .training-photo,
.training-block:-webkit-full-screen .training-photo {
  max-width: 100%;
  max-height: 100%;
}

/* --- Dance footstep charts --- */
.dance-block {
  --dance-accent: #38bdf8;
  border: 1px solid var(--line, #3b3b52);
  border-left: 4px solid var(--dance-accent);
  background: var(--panel, #1e1e2e);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 16px 0;
  width: 100%;
  box-sizing: border-box;
  color: var(--text, #e2e8f0);
}

.dance-block--info { --dance-accent: #38bdf8; }
.dance-block--success { --dance-accent: #4ade80; }
.dance-block--warning { --dance-accent: #fbbf24; }
.dance-block--danger { --dance-accent: #f87171; }
.dance-block--note { --dance-accent: #94a3b8; }

.dance-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.dance-title {
  font-weight: 700;
  font-size: 1.05rem;
}

.dance-tabs,
.dance-figures {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.dance-figures[hidden] {
  display: none;
}

.dance-tab,
.dance-figure,
.dance-controls button,
.dance-tools button {
  border: 1px solid var(--line, #3b3b52);
  background: transparent;
  color: inherit;
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  touch-action: manipulation;
}

.dance-tab.is-on,
.dance-figure.is-on,
.dance-loop.is-on {
  background: var(--dance-accent);
  color: #0f172a;
  border-color: transparent;
  font-weight: 700;
}

.dance-stage {
  background: #14141c;
  border-radius: 16px;
  padding: 12px;
  touch-action: pan-y;
  user-select: none;
}

.dance-boards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}

.dance-board {
  margin: 0;
  min-width: 0;
}

.dance-board figcaption {
  text-align: center;
  font-weight: 700;
  margin-bottom: 6px;
}

.dance-floor {
  width: 100%;
  height: auto;
  display: block;
}

.dance-caption {
  margin-top: 10px;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 650;
  display: grid;
  gap: 2px;
}

.dance-next {
  font-size: 0.92rem;
  font-weight: 650;
  color: #e7a090;
}

.dance-swipe-hint {
  display: none;
  margin: 8px 0 0;
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.75;
}

.dance-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 14px;
  margin-top: 12px;
}

.dance-bpm {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dance-bpm input[type="range"] {
  width: 7.5rem;
  height: 36px;
  accent-color: var(--dance-accent);
}

.dance-bpm-value {
  min-width: 6.2rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.dance-loop-range {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.92rem;
}

.dance-loop-range select {
  color: inherit;
  background: #14141c;
  border: 1px solid var(--line, #3b3b52);
  border-radius: 8px;
  padding: 6px 8px;
  max-width: 12rem;
}

@media (max-width: 720px) {
  .dance-boards {
    grid-template-columns: 1fr;
  }

  .dance-swipe-hint {
    display: block;
  }

  .dance-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  .dance-tab,
  .dance-figure,
  .dance-controls button,
  .dance-tools button,
  .dance-loop-range select {
    min-height: 44px;
  }

  .dance-controls button {
    flex: 1;
  }

  .dance-tools,
  .dance-bpm {
    width: 100%;
  }

  .dance-bpm input[type="range"] {
    flex: 1;
    width: auto;
  }
}

@media (max-height: 520px) {
  .dance-boards {
    grid-template-columns: 1fr 1fr;
  }

  .dance-floor {
    width: min(100%, calc(36dvh * 280 / 340));
    max-height: 36dvh;
    margin-inline: auto;
  }

  .dance-swipe-hint {
    display: block;
  }

  .dance-controls {
    position: sticky;
    bottom: 0;
    z-index: 2;
    margin-top: 8px;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    background: var(--panel, #1e1e2e);
  }
}

.dance-controls {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.dance-block:fullscreen,
.dance-block:-webkit-full-screen {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  margin: 0;
  background: #12121a;
  overflow: auto;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

.dance-block:fullscreen .dance-stage,
.dance-block:-webkit-full-screen .dance-stage {
  flex: 1;
  min-height: 0;
  align-items: center;
}

.dance-block:fullscreen .dance-floor,
.dance-block:-webkit-full-screen .dance-floor {
  width: 100%;
  height: auto;
  max-height: 70vh;
}

/* iPhone Safari has no element fullscreen API. This class covers the screen instead. */
html.notespro-pseudo-fullscreen,
html.notespro-pseudo-fullscreen body {
  overflow: hidden;
  height: 100%;
}

html.notespro-pseudo-fullscreen body {
  position: fixed;
  width: 100%;
}

html.notespro-pseudo-fullscreen .game-block--monitor-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1300;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: auto;
  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    env(safe-area-inset-bottom)
    env(safe-area-inset-left);
  -webkit-overflow-scrolling: touch;
}

html.notespro-pseudo-fullscreen .game-block--monitor-fullscreen .game-fullscreen-btn {
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  width: 44px;
  height: 44px;
}

html.notespro-pseudo-fullscreen .game-block--monitor-fullscreen [class*="-play-area"],
html.notespro-pseudo-fullscreen .game-block--monitor-fullscreen [class*="-stage"] {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: none;
}

@media (pointer: coarse) {
  .game-fullscreen-btn {
    width: 44px;
    height: 44px;
  }
}

/* --- World clock, alarm, countdown timer --- */
.worldclock-block,
.alarm-block,
.countdowntimer-block {
  --wc-bg: var(--panel, #111827);
  --wc-border: var(--line, #334155);
  --wc-accent: #f5c16c;
  border: 1px solid var(--wc-border);
  border-left: 4px solid var(--wc-accent);
  background: var(--wc-bg);
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin: 16px 0;
  width: 100%;
  box-sizing: border-box;
  color: var(--text, #e5e7eb);
}

.worldclock-block--info,
.alarm-block--info,
.countdowntimer-block--info { --wc-accent: #38bdf8; }
.worldclock-block--success,
.alarm-block--success,
.countdowntimer-block--success { --wc-accent: #4ade80; }
.worldclock-block--warning,
.alarm-block--warning,
.countdowntimer-block--warning { --wc-accent: #fbbf24; }
.worldclock-block--danger,
.alarm-block--danger,
.countdowntimer-block--danger { --wc-accent: #f87171; }
.worldclock-block--note,
.alarm-block--note,
.countdowntimer-block--note { --wc-accent: #94a3b8; }

.wc-head {
  display: block;
  margin-bottom: 8px;
}

.wc-title {
  font-weight: 700;
  font-size: 1.05rem;
}

.wc-meta,
.wc-section-title,
.wc-date,
.wc-offset,
.wc-cd-status {
  color: var(--muted, #94a3b8);
}

.wc-meta {
  margin-top: 2px;
  font-size: 0.8rem;
}

.wc-section + .wc-section {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--wc-border);
}

.wc-section-title {
  margin: 0 0 10px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wc-clocks,
.wc-cds,
.wc-alarms {
  display: grid;
  gap: 12px;
}

.wc-clocks,
.wc-alarms {
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
}

.wc-cds {
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}

.wc-clock,
.wc-cd,
.wc-alarm,
.wc-stopwatch {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--wc-border);
  border-radius: 12px;
}

.wc-clock,
.wc-cd,
.wc-alarm {
  padding: 12px 10px 14px;
  text-align: center;
}

.wc-clock-name,
.wc-cd-name {
  font-weight: 700;
  margin-bottom: 8px;
}

.wc-face {
  width: 148px;
  height: 148px;
  display: block;
  margin: 0 auto 8px;
}

.wc-cd .wc-face {
  width: 132px;
  height: 132px;
}

.wc-face-bg {
  fill: #0c1322;
  stroke: rgba(255, 255, 255, 0.16);
  stroke-width: 1.4;
}

.wc-tick {
  stroke: #e5e7eb;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.wc-tick-minor {
  stroke: #64748b;
  stroke-width: 1;
}

.wc-num {
  fill: #e5e7eb;
  font-size: 8px;
  font-family: Inter, system-ui, sans-serif;
}

.wc-hand-hour,
.wc-hand-minute,
.wc-hand-second {
  stroke-linecap: round;
}

.wc-hand-hour {
  stroke: #f8fafc;
  stroke-width: 3.2;
}

.wc-hand-minute {
  stroke: #e2e8f0;
  stroke-width: 2.1;
}

.wc-hand-second {
  stroke: var(--wc-accent);
  stroke-width: 1.15;
}

.wc-cap {
  fill: var(--wc-accent);
}

.wc-ring-track,
.wc-ring-value {
  fill: none;
  stroke-width: 3.4;
}

.wc-ring-track {
  stroke: rgba(255, 255, 255, 0.12);
}

.wc-ring-value {
  stroke: var(--wc-accent);
  stroke-linecap: round;
}

.wc-hms,
.wc-sw-digital,
.wc-cd-digital {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.wc-clock--analog .wc-hms {
  font-size: 0.95rem;
}

.wc-clock--digital .wc-hms,
.wc-clock--both .wc-hms,
.wc-cd-digital {
  font-size: 1.65rem;
}

.wc-clock--digital .wc-hms {
  margin-top: 18px;
  margin-bottom: 8px;
}

.wc-date,
.wc-offset,
.wc-cd-status {
  font-size: 0.78rem;
  margin-top: 3px;
}

.wc-clock.is-invalid .wc-hms {
  color: var(--wc-accent);
}

.wc-stopwatch {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 12px;
}

.wc-sw-digital {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.wc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 10px;
}

.wc-sw-body .wc-actions {
  justify-content: flex-start;
}

.wc-btn {
  border: 1px solid var(--wc-border);
  background: transparent;
  color: inherit;
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
}

.wc-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.wc-btn--primary {
  background: var(--wc-accent);
  color: #111;
  border-color: transparent;
  font-weight: 700;
}

.wc-face-switch {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 8px;
}

.wc-face-switch .wc-btn {
  padding: 3px 8px;
  font-size: 0.75rem;
}

.wc-alarm .wc-btn.is-active {
  background: var(--wc-accent);
  color: #111;
  border-color: transparent;
  font-weight: 700;
}

.wc-alarm--digital .wc-face {
  display: none;
}

.wc-alarm--digital .wc-hms {
  font-size: 1.65rem;
  margin: 12px 0 8px;
}

.wc-alarm-status {
  font-size: 0.78rem;
  margin-top: 3px;
  min-height: 1.1em;
}

.wc-alarm.is-ringing {
  border-color: var(--wc-accent);
  box-shadow: 0 0 0 1px var(--wc-accent);
}

.wc-laps {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  max-height: 148px;
  overflow: auto;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
}

.wc-laps li {
  display: grid;
  grid-template-columns: 4.5rem 1fr 1fr;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid var(--wc-border);
}

.wc-cd-set {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}

.wc-unit {
  display: grid;
  gap: 2px;
  font-size: 0.72rem;
  color: var(--muted, #94a3b8);
}

.wc-unit input {
  width: 3.2rem;
  background: #0b1220;
  color: inherit;
  border: 1px solid var(--wc-border);
  border-radius: 8px;
  padding: 6px 4px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.wc-cd.is-done {
  border-color: var(--wc-accent);
}

.wc-cd.is-done .wc-cd-digital,
.wc-cd.is-done .wc-cd-status {
  color: var(--wc-accent);
}

@media (prefers-reduced-motion: no-preference) {
  .wc-cd.is-done .wc-cd-digital {
    animation: wc-pulse 1s ease-in-out infinite;
  }
}

@keyframes wc-pulse {
  50% { opacity: 0.45; }
}

@media (max-width: 640px) {
  .wc-stopwatch {
    display: block;
  }

  .wc-stopwatch .wc-face {
    margin-bottom: 12px;
  }

  .wc-meta {
    margin-top: 4px;
  }
}

/* --- HP-15C --- */
.hp15c-block {
  --hp-ink: #f4eadc;
  container-type: inline-size;
  max-width: 880px;
  margin: 16px auto;
  padding: 14px 14px 16px;
  border-radius: 22px;
  background:
    radial-gradient(120% 80% at 50% 0%, #6b5344 0%, #3d2e26 42%, #2a211c 100%);
  color: var(--hp-ink);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.35);
  outline: none;
}

.hp15c-block:focus-visible {
  box-shadow: 0 0 0 2px #e6c15a, 0 14px 32px rgba(0, 0, 0, 0.35);
}

.hp-bezel {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 6px 8px;
}

.hp-badge {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 1.45rem;
}

.hp-tag {
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}

.hp-lcd {
  background: linear-gradient(180deg, #d5e0c6, #b7c7a4);
  color: #1a2416;
  border-radius: 10px;
  min-height: 132px;
  padding: 8px 12px 10px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45), inset 0 -8px 14px rgba(40, 50, 30, 0.18);
}

.hp-lcd.is-off {
  background: #8d9784;
  color: transparent;
}

.hp-lcd.is-off .hp-ann span,
.hp-lcd.is-off .hp-stack,
.hp-lcd.is-off .hp-imag {
  visibility: hidden;
}

.hp-ann {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 18px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.hp-ann span {
  opacity: 0.22;
}

.hp-ann span.is-on,
.hp-ann .hp-pend {
  opacity: 1;
}

.hp-pend {
  flex: 1;
  text-align: center;
  letter-spacing: 0.04em;
}

.hp-lcd-body {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-end;
  margin-top: 4px;
}

.hp-stack {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 14px;
  line-height: 1.35;
  opacity: 0.72;
  min-width: 7.5rem;
}

.hp-readout {
  flex: 1;
  text-align: right;
  min-width: 0;
}

.hp-value {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: clamp(2rem, 4.6vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  word-break: break-all;
}

.hp-exp {
  font-size: 0.72em;
  margin-left: 0.35em;
}

.hp-imag {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 1.1rem;
  min-height: 1.1em;
  opacity: 0.8;
}

.hp-lcd.is-prgm .hp-value {
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  letter-spacing: 0;
}

.hp-lcd.is-blink .hp-value {
  animation: hp-blink 1s steps(1, end) infinite;
}

@keyframes hp-blink {
  50% { opacity: 0.15; }
}

.hp-keys {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 5px 4px;
  margin-top: 12px;
}

.hp-slot {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 74px;
}

.hp-f,
.hp-g {
  font-size: 11px;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  letter-spacing: -0.03em;
}

.hp-f {
  color: #f0d48a;
  min-height: 14px;
}

.hp-g {
  color: #9ec0ff;
}

.hp-key {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  margin: 0;
  padding: 2px 1px 3px;
  border: 0;
  border-radius: 7px;
  background: linear-gradient(180deg, #4a3b32, #241c18);
  color: #f6efe6;
  box-shadow: 0 2px 0 #120e0c, inset 0 1px 0 rgba(255, 255, 255, 0.16);
  cursor: pointer;
  touch-action: manipulation;
}

.hp-key:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #120e0c;
}

.hp-face {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.1;
}

.hp-key--num {
  background: linear-gradient(180deg, #f4efe4, #d9d0c2);
  color: #1c140f;
}

.hp-key--num .hp-g {
  color: #2450a8;
}

.hp-key--op {
  background: linear-gradient(180deg, #6d5648, #3a2c24);
}

.hp-key--enter {
  background: linear-gradient(180deg, #5c4638, #2e241e);
}

.hp-key--enter .hp-face {
  letter-spacing: 0.08em;
  font-size: 15px;
}

.hp-key--f {
  background: linear-gradient(180deg, #f0d48a, #c4962e);
  color: #2a2118;
}

.hp-key--g {
  background: linear-gradient(180deg, #7ea2e8, #2f5cb5);
  color: #f7fbff;
}

.hp-key--on {
  background: linear-gradient(180deg, #2a2420, #14110f);
}

@media (max-width: 520px) {
  .hp-slot { min-height: 62px; }
  .hp-face { font-size: 13px; }
  .hp-key--enter .hp-face { font-size: 12px; }
  .hp-f, .hp-g { font-size: 9px; }
  .hp-value { font-size: 1.85rem; }
  .hp-stack { display: none; }
}

@container (max-width: 460px) {
  .hp-slot { min-height: 62px; }
  .hp-face { font-size: 13px; }
  .hp-key--enter .hp-face { font-size: 12px; }
  .hp-f, .hp-g { font-size: 9px; }
  .hp-value { font-size: 1.85rem; }
}
