@font-face {
  font-family: 'LibertinusMath';
  src: url('../fonts/LibertinusMath-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

:root{
  --bg: #ffffff;
  --board: #ffffff;
  --line: rgba(0,0,0,0.08);
  --line-strong: rgba(0,0,0,0.14);
  --dot: rgba(0,0,0,0.20);
  --label: rgba(0,0,0,0.75);

  --bandPos: #2a6bff; /* positive */
  --bandNeg: #111111; /* negative */
  
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
}
html, body{
  margin:0;
  padding:0;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}
body{
  background: var(--bg);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  display:flex;
  flex-direction: column;
  padding: 0;
  height: 100vh;
  width: 100vw;
  box-sizing: border-box;
  overflow: hidden;
}
.title-bar{
  width: 100%;
  background-color: #444;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 12px 20px;
  color: white;
  font-weight: 600;
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
}
.title-name{
  font-size: 20px;
  line-height: 1;
}
.title-version{
  font-size: 12px;
  opacity: 0.7;
  font-weight: 400;
}
.wrap{ 
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 24px;
  align-items: stretch;
  overflow: hidden;
  padding: 24px;
  box-sizing: border-box;
}
.sidebar{
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: auto;
  flex-shrink: 0;
  overflow-y: auto;
  max-height: 100%;
  background-color: #f5f6f8;
  padding: 10px;
  border-radius: 8px;
}
.toolbar-section{
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #ffffff;
  padding: 12px;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0, 0, 0, 0.06);
}
.bands-toolbar-horizontal{
  flex-direction: row;
  gap: 8px;
}
.toolbar{
  display:flex;
  flex-direction: column;
  gap:8px;
}
.btn{
  border: none;
  background: #e8e8e8 !important;
  border-radius: 8px;
  padding: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: none;
  transition: all 0.2s ease;
  color: rgba(0,0,0,0.8);
  min-width: 0;
}
.btn:hover{
  box-shadow: none;
  transform: translateY(-1px);
}
.btn:active{ 
  transform: translateY(0);
  box-shadow: none;
}
.btn img{
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}
.btn-pos, .btn-neg, .btn-clear{
  background: transparent;
  padding: 10px;
  width: 84px;
  height: 64px;
}
.btn-band-small{
  width: 48px;
  height: 48px;
  padding: 8px;
  border-radius: 6px;
  background: #f8f9fa !important;
  border: 1px solid rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
}
.btn-band-small:hover{
  background: #e9ecef !important;
  border-color: rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.btn-band-small:active{
  transform: translateY(0);
  box-shadow: none;
}
.btn-band-small img{
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.btn-band-small .btn-icon{
  width: 20px;
  height: 20px;
  color: rgba(0, 0, 0, 0.6);
}
.btn-band-small:hover .btn-icon{
  color: rgba(0, 0, 0, 0.8);
}
.btn-pos:hover, .btn-neg:hover, .btn-clear:hover{
  background: rgba(255, 255, 255, 0.1);
}

.btn-clear .btn-icon{
  width: 24px;
  height: 24px;
}
.card{
  background:#fff;
  border-radius:20px;
  padding: 20px;
  box-shadow: var(--shadow-lg);
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
svg{
  width:100%;
  flex: 1;
  min-height: 0;
  display:block;
  touch-action:none;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}
svg text,
svg .label{
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  pointer-events: none;
}
.label{
  font-family: 'LibertinusMath', serif;
  font-size: 18px;
  fill: var(--label);
  font-weight: 500;
}
.band-handle{
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: all;
}
.band-handle-group.hover-active .band-handle,
.band-handle-group:hover .band-handle{
  opacity: 0.9;
}
.band-handle-highlight{
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}
.band-handle-group.hover-active .band-handle-highlight,
.band-handle-group:hover .band-handle-highlight{
  opacity: 0.65;
}

/* Band animation */
@keyframes bandFadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 0.95;
  }
}

@keyframes bandPulse {
  0%, 100% {
    stroke-width: 2;
  }
  50% {
    stroke-width: 4;
  }
}

.band-animate {
  animation: bandFadeIn 0.3s ease-out, bandPulse 0.6s ease-out 0.3s;
}

.band-handle-animate circle.band-handle {
  animation: bandFadeIn 0.4s ease-out 0.2s backwards;
}

.band-handle-animate circle.band-handle-highlight {
  animation: bandFadeIn 0.3s ease-out 0.3s backwards;
}

/* Tile Toolbar */
#tile-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #ffffff;
  padding: 12px;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0, 0, 0, 0.06);
}
.tile-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.tile-toggle {
  cursor: pointer;
}
.tile-toggle:hover {
  opacity: 0.8;
}
.tile-img {
  display: block;
  height: 50px;
  width: auto;
  pointer-events: all;
}
.tile-img[data-type="1"] {
  height: 50px;
  width: 50px;
}
.tile-img[data-type="x"] {
  height: 50px;
  width: 90px;
}
.tile-img[data-type="x2"] {
  height: 90px;
  width: 90px;
}
.tile-img[data-type="y2"] {
  height: 110px;
  width: 110px;
}
.tile-img[data-type="y"] {
  height: 50px;
  width: 120px;
}
.tile-img[data-type="xy"] {
  height: 90px;
  width: 110px;
}
.tile-label {
  font-family: 'LibertinusMath', serif;
  color: rgba(0, 0, 0, 0.7);
  font-size: 19.2px;
  margin-top: 4px;
  text-align: center;
  font-weight: 500;
}
.draggable {
  cursor: grab;
}
.draggable:active {
  cursor: grabbing;
}
#svg-trash-can .trash-bg {
  fill: #f8f8f8;
  stroke: #ddd;
  stroke-width: 2;
  transition: all 0.3s ease;
}
#svg-trash-can .trash-icon,
#svg-trash-can .trash-text {
  stroke: #aaa;
  fill: #aaa;
  transition: all 0.3s ease;
}
#svg-trash-can.can-drop .trash-bg {
  fill: rgba(255, 107, 107, 0.1);
  stroke: #ff6b6b;
}
#svg-trash-can.can-drop .trash-icon,
#svg-trash-can.can-drop .trash-text {
  stroke: #ff6b6b;
  fill: #ff6b6b;
}

.drag-preview {
  position: fixed;
  pointer-events: none;
  z-index: 10000;
  opacity: 0.8;
}
.canvas-tile {
  position: absolute;
  pointer-events: all;
  cursor: move;
}

