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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f0f0f;
  color: #e0e0e0;
  line-height: 1.6;
  min-height: 100vh;
}

#app {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

header {
  text-align: center;
  padding: 30px 0 20px;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, #ff6b6b, #ffd93d, #6bcb77);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.info-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #2a2a2a;
  border: 1px solid #444;
  color: #888;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: serif;
  font-style: italic;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s, color 0.2s;
}

.info-btn:hover {
  background: #3a3a3a;
  color: #ccc;
}

.info-btn:focus {
  outline: 2px solid #6bcb77;
  outline-offset: 2px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 14px;
  padding: 28px 30px;
  max-width: 480px;
  width: 100%;
  position: relative;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  color: #666;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.modal-close:hover {
  color: #ccc;
}

.modal-content h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #e0e0e0;
  margin-bottom: 16px;
}

.modal-content ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-content li {
  font-size: 0.9rem;
  line-height: 1.5;
  color: #b0b0b0;
  padding-left: 20px;
  position: relative;
}

.modal-content li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: #6bcb77;
  font-weight: 700;
}

.modal-content li strong {
  color: #e0e0e0;
}

.modal-content li em {
  color: #999;
  font-style: italic;
}

.modal-btn {
  margin-top: 20px;
  width: 100%;
  padding: 10px;
  background: #333;
  border: none;
  border-radius: 8px;
  color: #ccc;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.modal-btn:hover {
  background: #444;
  opacity: 1;
}

.subtitle {
  color: #888;
  font-size: 0.9rem;
  margin-top: 4px;
}

#chart-section {
  position: relative;
  background: #1a1a1a;
  border-radius: 12px;
  padding: 16px;
  margin: 20px 0;
  border: 1px solid #2a2a2a;
}

#chart-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  width: 100%;
}

#chart-scroll::-webkit-scrollbar {
  height: 6px;
}

#chart-scroll::-webkit-scrollbar-track {
  background: #1a1a1a;
}

#chart-scroll::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 3px;
}

#chart-canvas {
  display: block;
  border-radius: 8px;
  height: 360px;
}

.chart-empty {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #555;
  font-size: 1rem;
  pointer-events: none;
}

h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: #ccc;
}

.count {
  font-weight: 400;
  color: #666;
  font-size: 0.85rem;
}

#form-section {
  background: #1a1a1a;
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
  border: 1px solid #2a2a2a;
}

.form-row {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}

.form-row .form-group {
  flex: 1;
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  color: #999;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="date"],
input[type="text"],
textarea {
  width: 100%;
  padding: 10px 12px;
  background: #252525;
  border: 1px solid #333;
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: #6bcb77;
}

.score-input {
  display: flex;
  align-items: center;
  gap: 12px;
}

.score-input input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: linear-gradient(to right, #ff6b6b, #444, #6bcb77);
  border-radius: 3px;
  outline: none;
}

.score-input input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e0e0e0;
  cursor: pointer;
  border: 2px solid #555;
}

.score-input input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e0e0e0;
  cursor: pointer;
  border: 2px solid #555;
}

#score-value {
  min-width: 32px;
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
}

button {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #6bcb77, #4a9e54);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

button:hover {
  opacity: 0.9;
}

#events-section {
  background: #1a1a1a;
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
  border: 1px solid #2a2a2a;
}

#event-list {
  list-style: none;
}

.event-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid #252525;
}

.event-item:last-child {
  border-bottom: none;
}

.event-score-badge {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.event-body {
  flex: 1;
  min-width: 0;
}

.event-date {
  font-size: 0.8rem;
  color: #666;
}

.event-description {
  font-weight: 600;
  color: #e0e0e0;
  margin: 2px 0;
}

.event-feelings {
  font-size: 0.85rem;
  color: #999;
  font-style: italic;
}

.event-actions {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
}

.event-actions button {
  width: auto;
  padding: 6px 12px;
  font-size: 0.8rem;
  background: #333;
  border-radius: 6px;
}

.event-actions button.delete-btn {
  background: #5a1a1a;
  color: #ff6b6b;
}

.event-actions button.delete-btn:hover {
  background: #7a2222;
}

.toolbar {
  float: right;
  display: flex;
  gap: 6px;
}

.toolbar-btn {
  width: auto;
  padding: 4px 14px;
  font-size: 0.75rem;
  background: #333;
  color: #ccc;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.toolbar-btn:hover {
  background: #444;
  opacity: 1;
}

.empty-state {
  text-align: center;
  color: #555;
  padding: 30px 0;
  font-style: italic;
}

.chart-tooltip {
  display: none;
  position: absolute;
  z-index: 100;
  background: #1e1e1e;
  border: 1px solid #3a3a3a;
  border-radius: 10px;
  padding: 12px 14px;
  min-width: 180px;
  max-width: 260px;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.tooltip-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.tooltip-score {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: #fff;
}

.tooltip-date {
  font-size: 0.75rem;
  color: #999;
}

.tooltip-desc {
  font-size: 0.9rem;
  font-weight: 600;
  color: #e0e0e0;
}

.tooltip-feelings {
  font-size: 0.8rem;
  color: #999;
  font-style: italic;
  margin-top: 4px;
}

@media (max-width: 600px) {
  #app {
    padding: 12px;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  #chart-canvas {
    height: 260px;
  }

  .event-item {
    gap: 10px;
  }

  .event-score-badge {
    width: 40px;
    height: 40px;
    font-size: 0.8rem;
  }
}
