* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'SF Mono', 'Consolas', 'Courier New', monospace;
  background: #000000;
  color: #e0e0e0;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

/* 頂部列 */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: #0a0a0a;
  border-bottom: 1px solid #222;
  flex-shrink: 0;
  z-index: 10;
}

.logo {
  font-size: 1.3em;
  font-weight: bold;
  color: #00d4ff;
  letter-spacing: 2px;
}

.coverage-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9em;
  color: #888;
}

.coverage-value {
  font-size: 1.2em;
  font-weight: bold;
  color: #ef4444;
  min-width: 60px;
  text-align: right;
}

/* 主要區域 */
.main-area {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* 側邊面板 */
.side-panel {
  width: 260px;
  flex-shrink: 0;
  background: #0a0a0a;
  border-right: 1px solid #222;
  overflow-y: auto;
  padding: 12px;
  scrollbar-width: thin;
  scrollbar-color: #333 #0a0a0a;
}

.side-panel::-webkit-scrollbar {
  width: 4px;
}

.side-panel::-webkit-scrollbar-track {
  background: #0a0a0a;
}

.side-panel::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 2px;
}

.panel-section {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #1a1a1a;
}

.panel-section:last-child {
  border-bottom: none;
}

.panel-title {
  font-size: 0.85em;
  color: #00d4ff;
  margin-bottom: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.field {
  margin-bottom: 10px;
}

.field label {
  display: block;
  font-size: 0.75em;
  color: #888;
  margin-bottom: 4px;
}

.field input[type="number"],
.field select {
  width: 100%;
  padding: 8px 10px;
  background: #111;
  border: 1px solid #333;
  border-radius: 6px;
  color: #fff;
  font-size: 1em;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.field input[type="number"]:focus,
.field select:focus {
  border-color: #00d4ff;
}

.field select {
  cursor: pointer;
}

/* 坡口類型按鈕 */
.btn-group {
  display: flex;
  gap: 6px;
}

.btn-opt {
  flex: 1;
  padding: 8px;
  background: #111;
  border: 1px solid #333;
  border-radius: 6px;
  color: #888;
  font-size: 0.9em;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-opt.active {
  background: #00d4ff22;
  border-color: #00d4ff;
  color: #00d4ff;
}

.btn-opt:hover {
  border-color: #555;
}

/* 開關 */
.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  cursor: pointer;
  font-size: 0.85em;
  color: #ccc;
}

.toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #00d4ff;
  cursor: pointer;
}

/* 重置按鈕 */
.btn-reset {
  width: 100%;
  padding: 10px;
  background: #1a0000;
  border: 1px solid #441111;
  border-radius: 8px;
  color: #ff6666;
  font-size: 0.9em;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-reset:hover {
  background: #2a0000;
  border-color: #ff4444;
}

.btn-clear {
  width: 100%;
  padding: 8px;
  background: #1a1a00;
  border: 1px solid #444411;
  border-radius: 6px;
  color: #ffcc00;
  font-size: 0.85em;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-clear:hover {
  background: #2a2a00;
  border-color: #ffcc00;
}

/* Canvas 容器 */
.canvas-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #000;
  min-height: 500px;
}

.canvas-container canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* 合格章 */
.stamp {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 5;
  animation: stampIn 0.4s ease-out;
}

@keyframes stampIn {
  0% { transform: scale(2) rotate(-15deg); opacity: 0; }
  60% { transform: scale(0.9) rotate(3deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.stamp-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 20px;
  border: 3px solid #22c55e;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.8);
}

.stamp-icon {
  font-size: 2em;
  color: #22c55e;
  line-height: 1;
}

.stamp-text {
  font-size: 0.9em;
  font-weight: bold;
  color: #22c55e;
  letter-spacing: 2px;
  margin-top: 4px;
}

.stamp-sub {
  font-size: 0.75em;
  color: #86efac;
  margin-top: 2px;
}

/* 底部列 */
.bottom-bar {
  padding: 6px 16px;
  background: #0a0a0a;
  border-top: 1px solid #222;
  text-align: center;
  font-size: 0.7em;
  color: #555;
  flex-shrink: 0;
}

/* 手機適配 */
@media (max-width: 768px) {
  .main-area {
    flex-direction: column;
  }

  .side-panel {
    width: 100%;
    height: auto;
    max-height: 35vh;
    border-right: none;
    border-bottom: 1px solid #222;
  }

  .canvas-container {
    min-height: 50vh;
  }

  .logo {
    font-size: 1em;
  }
}
