:root {
  --bg: #f3efe4;
  --panel: #fffaf0;
  --ink: #172033;
  --muted: #6b7280;
  --line: rgba(23, 32, 51, 0.12);
  --accent: #0f766e;
  --accent-strong: #0d9488;
  --danger: #b91c1c;
  --shadow: 0 18px 48px rgba(28, 25, 23, 0.16);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
.hidden { display: none !important; }
body {
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.16), transparent 35rem),
    linear-gradient(135deg, #f7f0df 0%, #ece7d9 100%);
}
.b-topbar {
  position: fixed;
  z-index: 50;
  bottom: 0;
  left: 0;
  right: 0;
  min-height: 74px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255, 250, 240, 0.94);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 28px rgba(28, 25, 23, 0.12);
  backdrop-filter: blur(10px);
  overflow: visible;
}
.b-brand {
  flex: 0 0 auto;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #134e4a;
  padding: 8px 10px;
  border: 2px solid #134e4a;
  border-radius: 14px;
}
.b-task-buttons { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; flex: 0 1 auto; }
.b-task-num {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(15, 118, 110, 0.28);
  background: #ffffff;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
}
.b-task-num--active { background: #0f766e; color: white; border-color: #0f766e; }
.b-divider { width: 1px; height: 36px; background: var(--line); flex: 0 0 auto; }
.b-btn, .b-tool {
  border: 1px solid rgba(23, 32, 51, 0.14);
  background: white;
  color: var(--ink);
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 12px;
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
}
.b-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.b-btn--primary, .b-tool--active { background: var(--accent); color: white; border-color: var(--accent); }
.b-btn--danger { color: var(--danger); border-color: rgba(185, 28, 28, 0.24); }
.b-btn--lucky {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: white;
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(239, 68, 68, 0.18);
}
.b-btn--icon {
  min-width: 38px;
  padding-left: 10px;
  padding-right: 10px;
  font-size: 18px;
}
.b-tool--active { box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16); }
.b-color-swatches {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(23, 32, 51, 0.10);
  border-radius: 14px;
}
.b-color-swatch {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(23, 32, 51, 0.18);
  border-radius: 9px;
  background: var(--swatch);
  cursor: pointer;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.36);
}
.b-color-swatch--active {
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.18), inset 0 0 0 2px rgba(255, 255, 255, 0.36);
}
.b-color, .b-range { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.b-color input { width: 38px; height: 36px; border: 0; padding: 0; background: transparent; }
.b-range input { width: 120px; accent-color: var(--accent); }
.b-zoom { min-width: 48px; text-align: center; font-weight: 800; color: #134e4a; }
.b-viewport { padding-bottom: var(--board-toolbar-offset, 88px); min-height: 100vh; overflow: auto; }
.b-board-shell {
  width: 100%;
  min-height: 100vh;
  padding: 24px 24px 48px;
  overflow: visible;
}
.b-board {
  position: relative;
  width: 75vw;
  min-height: 2600px;
  margin: 0 auto;
  --task-scale: 1;
  background: #fffdf7;
  border: 1px solid rgba(23, 32, 51, 0.10);
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
  touch-action: none;
}
.b-board-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  min-height: 2600px;
  transform-origin: top center;
  background:
    linear-gradient(rgba(15, 118, 110, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 118, 110, 0.08) 1px, transparent 1px),
    #fffdf7;
  background-size: 34px 34px;
  overflow: hidden;
  touch-action: none;
}
.b-task-layer { position: relative; z-index: 4; padding: 38px 58px 180px; pointer-events: none; }
.b-task-card {
  width: min(calc(1040px * var(--task-scale, 1)), 100%);
  margin: 0 auto 56px;
  padding: calc(22px * var(--task-scale, 1)) calc(26px * var(--task-scale, 1)) calc(34px * var(--task-scale, 1));
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(23, 32, 51, 0.10);
  border-radius: 22px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
  font-size: calc(16px * var(--task-scale, 1));
}
.b-task-card__meta { display: flex; gap: calc(10px * var(--task-scale, 1)); align-items: center; margin-bottom: calc(12px * var(--task-scale, 1)); color: #134e4a; font-weight: 900; }
.b-task-card__tag { border: 1px solid rgba(15, 118, 110, 0.24); padding: calc(4px * var(--task-scale, 1)) calc(9px * var(--task-scale, 1)); border-radius: 999px; background: #ecfdf5; }
.b-task-card__tag--action {
  color: #134e4a;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}
.b-task-card__tag--action:hover { background: #ccfbf1; border-color: rgba(15, 118, 110, 0.46); }
.b-task-card__tag--answer {
  color: #7c2d12;
  background: #fffbeb;
  border-color: rgba(245, 158, 11, 0.45);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}
.b-task-card__tag--answer:hover { background: #fde68a; border-color: rgba(217, 119, 6, 0.58); }
.b-task-card__remove {
  margin-left: auto;
  width: calc(32px * var(--task-scale, 1));
  height: calc(32px * var(--task-scale, 1));
  border: 1px solid rgba(185, 28, 28, 0.28);
  border-radius: 999px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: calc(24px * var(--task-scale, 1));
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}
.b-task-card__remove:hover { background: #fee2e2; border-color: rgba(185, 28, 28, 0.54); }
.b-task-card__answer-box {
  display: inline-block;
  margin: 0 0 calc(14px * var(--task-scale, 1));
  padding: calc(9px * var(--task-scale, 1)) calc(13px * var(--task-scale, 1));
  border-radius: 13px;
  background: #fffbeb;
  border: 1px solid rgba(245, 158, 11, 0.42);
  color: #7c2d12;
  font-size: calc(18px * var(--task-scale, 1));
  font-weight: 800;
  pointer-events: auto;
}
.b-task-card img { display: block; max-width: 100%; height: auto; background: white; border-radius: 10px; }
.b-empty { position: absolute; inset: 160px 40px auto; text-align: center; color: #6b7280; z-index: 0; pointer-events: none; }
.b-empty__title { font-size: 34px; font-weight: 900; color: #134e4a; }
.b-empty__text { margin-top: 12px; font-size: 18px; }
.b-ink-layer { position: absolute; inset: 0; z-index: 8; width: 100%; height: 100%; overflow: visible; touch-action: none; pointer-events: none; }
.b-board--select .b-ink-layer { pointer-events: none; }
.b-ink-layer path, .b-ink-layer line { pointer-events: none; }
.b-session-box {
  position: fixed;
  right: 12px;
  bottom: calc(var(--board-toolbar-offset, 88px) + 10px);
  z-index: 55;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  max-width: min(420px, calc(100vw - 24px));
  padding: 6px 8px;
  border: 1px solid rgba(19, 78, 74, 0.08);
  border-radius: 14px;
  background: rgba(255, 250, 240, 0.34);
  color: rgba(19, 78, 74, 0.64);
  font-size: 11px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
  backdrop-filter: blur(4px);
  opacity: 0.42;
  transition: opacity .16s ease, background .16s ease;
}
.b-session-box:focus-within,
.b-session-box:hover {
  opacity: 0.92;
  background: rgba(255, 250, 240, 0.88);
}
.b-session-box__field {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.b-session-box__field input {
  width: 54px;
  height: 26px;
  border: 1px solid rgba(19, 78, 74, 0.16);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.76);
  color: #134e4a;
  padding: 3px 7px;
  font-size: 12px;
  outline: none;
}
.b-session-box__field--group input { width: 116px; }
.b-session-box__field input:focus { border-color: rgba(15, 118, 110, 0.52); }
.b-session-box__ok {
  height: 26px;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 9px;
  background: rgba(236, 253, 245, 0.86);
  color: #134e4a;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}
.b-session-box__status {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(19, 78, 74, 0.72);
  line-height: 26px;
}
.b-modal.hidden { display: none; }
.b-modal { position: fixed; inset: 0; z-index: 80; }
.b-modal__backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.45); }
.b-modal__dialog {
  position: relative;
  width: min(1480px, calc(100vw - 28px));
  max-height: calc(100vh - 48px);
  margin: 24px auto;
  background: var(--panel);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 20px;
  overflow: auto;
}
.b-modal__head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.b-modal__title { font-size: 22px; font-weight: 900; color: #134e4a; }
.b-modal__hint { margin-top: 5px; color: var(--muted); }
.b-modal__actions { display: flex; gap: 8px; }
.b-modal__actions--end { justify-content: flex-end; margin-top: 18px; }
.b-modal__dialog--confirm {
  width: min(460px, calc(100vw - 32px));
  margin-top: 18vh;
}
.b-confirm-text {
  margin-top: 12px;
  color: #334155;
  font-size: 17px;
  line-height: 1.45;
}
.b-luck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
  gap: 9px;
  margin-top: 16px;
}
.b-luck-num {
  border: 2px solid rgba(15, 118, 110, 0.22);
  background: #ecfdf5;
  color: #134e4a;
  min-height: 46px;
  border-radius: 14px;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
}
.b-luck-num--excluded {
  color: #991b1b;
  background: #fef2f2;
  border-color: rgba(185, 28, 28, 0.42);
  opacity: 0.58;
  text-decoration: line-through;
}
.b-proto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}
.b-proto-card {
  border: 2px solid transparent;
  background: white;
  border-radius: 14px;
  padding: 8px;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}
.b-proto-card:hover {
  transform: scale(1.012);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.13);
}
.b-proto-card--excluded { opacity: 0.45; border-color: var(--danger); filter: grayscale(0.85); }
.b-proto-card__label { font-weight: 900; margin-bottom: 8px; color: #134e4a; }
.b-proto-card img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 360px;
  object-fit: contain;
  background: #fff;
  border: 1px solid rgba(23, 32, 51, 0.08);
  border-radius: 8px;
}
@media (max-width: 760px) {
  .b-topbar { align-items: flex-start; gap: 7px; padding: 8px; }
  .b-brand { padding: 7px 8px; font-size: 13px; }
  .b-task-num { width: 34px; height: 34px; border-radius: 10px; }
  .b-btn, .b-tool { min-height: 34px; padding: 7px 9px; border-radius: 10px; font-size: 13px; }
  .b-range input { width: 92px; }
  .b-divider { display: none; }
  .b-board-shell { padding-left: 10px; padding-right: 10px; }
  .b-proto-grid { grid-template-columns: 1fr; }
}

@media (min-width: 761px) and (max-width: 1320px) {
  .b-topbar { gap: 8px; padding: 8px 10px; }
  .b-brand { padding: 7px 9px; }
  .b-task-num { width: 34px; height: 34px; border-radius: 10px; }
  .b-btn, .b-tool { min-height: 34px; padding: 7px 10px; }
  .b-range input { width: 104px; }
}
