/* Pen Anatomy Simulation Styles (p5.js version) */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #fafafa;
  color: #333;
}

#pen-container {
  padding: 16px 20px;
  max-width: 680px;
  margin: 0 auto;
}

/* ── p5 Sketch Container ─────────────────────────────────────────────── */

#sketch-container {
  display: block;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: #fafafa;
}

#sketch-container canvas {
  display: block;
  width: 100% !important;
  height: auto !important;
}

#sketch-container.writing-active canvas {
  cursor: none !important;
}

/* ── Info Panel ──────────────────────────────────────────────────────── */

#info-panel {
  margin-top: 14px;
  padding: 12px 16px;
  background: #fff;
  border-left: 4px solid #4a90d9;
  border-radius: 0 4px 4px 0;
  min-height: 52px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
}

#info-title {
  font-size: 13px;
  font-weight: 700;
  color: #4a90d9;
  margin: 0 0 4px;
}

#info-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #444;
}

/* ── Progress tracker ────────────────────────────────────────────────── */

#parts-progress {
  margin-top: 10px;
  font-size: 12px;
  color: #888;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.progress-pip {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e0e0e0;
  border: 1px solid #ccc;
  transition: background 0.25s;
}

.progress-pip.explored {
  background: #4caf50;
  border-color: #388e3c;
}

/* ── Observation area ────────────────────────────────────────────────── */

#observation-area {
  margin-top: 18px;
  padding: 14px 16px;
  background: #fffde7;
  border: 1px solid #ffe082;
  border-radius: 6px;
}

#observation-area.hidden {
  display: none;
}

#observation-area label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
}

#obs-input {
  width: 100%;
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid #ffca28;
  border-radius: 4px;
  resize: none;
  background: #fff;
  color: #333;
  transition: border-color 0.2s;
}

#obs-input:focus {
  outline: none;
  border-color: #f9a825;
  box-shadow: 0 0 0 2px rgba(249, 168, 37, 0.2);
}

#obs-submit {
  margin-top: 8px;
  padding: 7px 18px;
  background: #f9a825;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.2s;
}

#obs-submit:hover {
  background: #f57f17;
}

#obs-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Observation log ─────────────────────────────────────────────────── */

#obs-log {
  margin-top: 10px;
  max-height: 120px;
  overflow-y: auto;
  padding: 0;
  list-style: none;
}

#obs-log li {
  font-size: 12px;
  color: #555;
  padding: 4px 0;
  border-bottom: 1px solid #fff9c4;
  display: flex;
  gap: 6px;
  align-items: baseline;
}

#obs-log li::before {
  content: "✓";
  color: #f9a825;
  font-weight: bold;
  flex-shrink: 0;
}

/* ── Hint: how many parts left ───────────────────────────────────────── */

#explore-hint {
  margin-top: 8px;
  font-size: 12px;
  color: #999;
  font-style: italic;
}

/* ── Writing toolbar ─────────────────────────────────────────────────── */

#writing-toolbar {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#write-mode-btn {
  padding: 7px 16px;
  background: #5c6bc0;
  color: #fff;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition:
    background 0.2s,
    box-shadow 0.2s;
  white-space: nowrap;
}

#write-mode-btn:hover {
  background: #3949ab;
}

#write-mode-btn.active {
  background: #283593;
  box-shadow: 0 0 0 3px rgba(92, 107, 192, 0.35);
}

#force-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#force-controls.hidden {
  display: none;
}

.force-label-text {
  font-size: 12px;
  color: #666;
  font-weight: 600;
  white-space: nowrap;
}

#force-btn-group {
  display: flex;
  gap: 3px;
}

.force-btn {
  padding: 5px 12px;
  border: 1.5px solid #9fa8da;
  background: #fff;
  color: #3949ab;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s;
  white-space: nowrap;
}

.force-btn:hover {
  background: #e8eaf6;
}

.force-btn.active-force {
  background: #3949ab;
  color: #fff;
  border-color: #3949ab;
}

.force-btn[data-force="2"].active-force {
  background: #ef6c00;
  border-color: #ef6c00;
}

.force-btn[data-force="3"].active-force {
  background: #c62828;
  border-color: #c62828;
}

#clear-paper-btn {
  padding: 5px 12px;
  background: #fafafa;
  border: 1.5px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  color: #666;
  transition: background 0.15s;
  white-space: nowrap;
}

#clear-paper-btn:hover {
  background: #f0f0f0;
  border-color: #bbb;
}

/* ── Nib damage status bar ───────────────────────────────────────────── */

#damage-status {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

#damage-status.hidden {
  display: none;
}

.damage-status-label {
  color: #666;
  font-weight: 600;
  white-space: nowrap;
}

#damage-bar-wrap {
  flex: 1;
  max-width: 130px;
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
}

#damage-fill {
  height: 100%;
  width: 100%;
  background: #4caf50;
  border-radius: 4px;
  transition:
    width 0.3s ease,
    background-color 0.4s ease;
}

#damage-label {
  font-size: 12px;
  font-weight: 700;
  color: #4caf50;
  min-width: 110px;
  transition: color 0.3s ease;
}
