:root {
  --board-bg: #080c16;
  --board-panel: rgba(12, 18, 32, 0.94);
  --board-ink: 142, 186, 214;
  --board-ink-hot: 226, 196, 132;
  --board-line: rgba(226, 196, 132, 0.22);
  --board-text: #f4efe4;
  --board-muted: #a9b5c7;
  --board-accent: #e2c484;
  --board-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

html[data-theme="light"] {
  --board-bg: #f8f7f3;
  --board-panel: rgba(255, 255, 255, 0.96);
  --board-ink: 70, 120, 130;
  --board-ink-hot: 35, 75, 82;
  --board-line: rgba(35, 75, 82, 0.18);
  --board-text: #203238;
  --board-muted: #57676b;
  --board-accent: #234b52;
  --board-shadow: 0 24px 60px rgba(32, 50, 56, 0.16);
}

.board-page {
  margin: 0;
  min-height: 100vh;
  background: var(--board-bg);
  color: var(--board-text);
  overflow: hidden;
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.board-shell {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
}

.board-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
  background: transparent;
}

.board-canvas.is-erasing {
  cursor: cell;
}

.board-toolbar {
  position: absolute;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--board-line);
  border-radius: 999px;
  background: var(--board-panel);
  backdrop-filter: blur(14px);
  box-shadow: var(--board-shadow);
  color: var(--board-text);
}

.board-page .board-toolbar {
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
}

.board-tool,
.board-icon-btn {
  appearance: none;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--board-muted);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.board-tool:hover,
.board-icon-btn:hover {
  color: var(--board-accent);
  background: color-mix(in srgb, var(--board-accent) 10%, transparent);
  transform: translateY(-1px);
}

.board-tool.is-active {
  color: var(--board-accent);
  border-color: color-mix(in srgb, var(--board-accent) 45%, transparent);
  background: color-mix(in srgb, var(--board-accent) 12%, transparent);
}

.board-tool:focus-visible,
.board-icon-btn:focus-visible,
.board-pop-btn:focus-visible {
  outline: 3px solid var(--board-accent);
  outline-offset: 3px;
}

.board-tool svg,
.board-icon-btn svg,
.board-pop-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.board-tool-label {
  padding: 0 10px 0 4px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--board-muted);
  white-space: nowrap;
}

.board-hint {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  margin: 0;
  padding: 10px 16px;
  border: 1px solid var(--board-line);
  border-radius: 999px;
  background: var(--board-panel);
  color: var(--board-muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  pointer-events: none;
  opacity: 0.92;
}

.board-hint[hidden] {
  display: none !important;
}

.board-nav-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.board-pop-btn {
  appearance: none;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin: 0;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--board-accent, #e2c484) 42%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--board-accent, #e2c484) 8%, transparent);
  color: var(--board-accent, #e2c484);
  cursor: pointer;
  transition: background 0.16s ease, transform 0.16s ease;
}

.home-links .board-pop-btn,
.site-nav .board-pop-btn {
  --board-accent: #e2c484;
}

html[data-theme="light"] .home-links .board-pop-btn,
html[data-theme="light"] .site-nav .board-pop-btn {
  --board-accent: #234b52;
}

.board-pop-btn:hover {
  background: color-mix(in srgb, var(--board-accent, #e2c484) 16%, transparent);
  transform: translateY(-1px);
}

.board-pop-btn svg {
  width: 15px;
  height: 15px;
}

.board-float {
  position: fixed;
  z-index: 40;
  display: none;
  flex-direction: column;
  width: min(420px, calc(100vw - 24px));
  height: min(340px, calc(100vh - 24px));
  border: 1px solid var(--board-line);
  border-radius: 22px;
  background: var(--board-panel);
  box-shadow: var(--board-shadow);
  overflow: hidden;
  backdrop-filter: blur(16px);
  color: var(--board-text);
}

.board-float.is-open {
  display: flex;
}

.board-float-header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 8px 10px 8px 14px;
  border-bottom: 1px solid var(--board-line);
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.board-float-header:active {
  cursor: grabbing;
}

.board-float-title {
  flex: 1;
  min-width: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.board-float-title small {
  display: block;
  margin-top: 2px;
  font: 600 10px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--board-muted);
}

.board-float-body {
  position: relative;
  flex: 1;
  min-height: 0;
  background:
    radial-gradient(circle at 20% 15%, color-mix(in srgb, var(--board-accent) 12%, transparent), transparent 42%),
    var(--board-bg);
}

.board-float .board-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  touch-action: none;
}

.board-float .board-toolbar {
  position: absolute;
  left: 50%;
  right: auto;
  bottom: 12px;
  top: auto;
  transform: translateX(-50%);
  justify-content: center;
  width: max-content;
  max-width: calc(100% - 24px);
  margin: 0;
  z-index: 2;
  pointer-events: none;
}

.board-float .board-toolbar .board-tool,
.board-float .board-toolbar .board-icon-btn {
  pointer-events: auto;
}

body.board-float-open .home-board-toolbar {
  opacity: 0.35;
  pointer-events: none;
}

.board-float .board-tool-label {
  display: none;
}

.board-fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 35;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 16px 0 14px;
  border: 1px solid var(--board-line);
  border-radius: 999px;
  background: var(--board-panel);
  color: var(--board-text);
  box-shadow: var(--board-shadow);
  cursor: pointer;
  font: 700 13px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.board-fab svg {
  width: 18px;
  height: 18px;
  color: var(--board-accent);
}

.board-fab[hidden],
.board-float[hidden] {
  display: none !important;
}

.board-page-nav {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 12px;
}

.board-page-nav a {
  color: var(--board-text);
  text-decoration: none;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 24px;
  font-weight: 600;
}

.board-page-nav .board-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--board-muted);
  font: 600 12px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
}

.board-page-nav .board-back:hover {
  color: var(--board-accent);
}

@media (max-width: 720px) {
  .board-page .board-toolbar {
    top: auto;
    bottom: 18px;
    left: 12px;
    right: 12px;
    transform: none;
    justify-content: center;
    flex-wrap: wrap;
  }

  .board-tool-label {
    display: none;
  }

  .board-hint {
    top: 78px;
    bottom: auto;
    max-width: calc(100% - 28px);
    text-align: center;
  }

  .board-page-nav {
    left: 12px;
    right: 12px;
    justify-content: space-between;
  }
}

@media (orientation: portrait) and (max-width: 900px) {
  .board-float {
    left: 12px !important;
    right: 12px !important;
    bottom: max(12px, env(safe-area-inset-bottom)) !important;
    top: auto !important;
    width: auto;
    height: 30vh;
    max-height: 30vh;
    border-radius: 18px;
  }

  .board-float-header {
    min-height: 44px;
    padding: 6px 8px 6px 12px;
  }

  .board-float-title {
    font-size: 17px;
  }

  .board-float .board-toolbar {
    bottom: 8px;
    left: 8px;
    right: 8px;
    padding: 6px;
    gap: 4px;
  }

  .board-float .board-tool,
  .board-float .board-icon-btn {
    width: 34px;
    height: 34px;
  }

  .board-fab {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    min-height: 44px;
    padding: 0 14px 0 12px;
  }
}

.home-board-toolbar {
  position: fixed;
  z-index: 6;
  left: 50%;
  bottom: clamp(18px, 4vh, 34px);
  transform: translateX(-50%);
  max-width: calc(100vw - 24px);
}

.home-bottom.is-board-shifted {
  bottom: clamp(86px, 12vh, 120px);
}

@media (max-width: 720px) {
  .home-board-toolbar {
    bottom: max(14px, env(safe-area-inset-bottom));
  }

  .home-bottom.is-board-shifted {
    bottom: calc(72px + env(safe-area-inset-bottom));
  }

  .home-board-toolbar .board-tool-label {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .board-tool,
  .board-icon-btn,
  .board-pop-btn {
    transition: none;
  }
}
