:root {
  --paper: #faf6f0;
  --ink: #2c1810;
  --muted: #8a7568;
  --accent: #2e86ab;
  --accent-warm: #c8553d;
  --border: #e0d5c8;
  --card-bg: rgba(255, 255, 255, 0.85);
  --shadow: rgba(44, 24, 16, 0.08);
  --radius: 12px;
}

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

body {
  font-family: 'Georgia', 'Times New Roman', serif;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.watercolor-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background:
    radial-gradient(ellipse at 15% 20%, rgba(46, 134, 171, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 10%, rgba(200, 85, 61, 0.06) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 80%, rgba(139, 69, 19, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 90% 70%, rgba(46, 134, 171, 0.06) 0%, transparent 40%),
    radial-gradient(ellipse at 10% 90%, rgba(200, 85, 61, 0.04) 0%, transparent 40%);
}

header {
  text-align: center;
  padding: 2.5rem 1rem 1rem;
}

header h1 {
  font-size: 2.4rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--ink);
}

header .subtitle {
  font-style: italic;
  color: var(--muted);
  margin-top: 0.3rem;
  font-size: 1.1rem;
}

nav {
  display: flex;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.5rem 1rem;
  margin: 0 auto 1.5rem;
  max-width: 700px;
  flex-wrap: wrap;
}

.tab {
  background: transparent;
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--muted);
  transition: all 0.2s;
}

.tab:hover {
  background: rgba(46, 134, 171, 0.06);
  color: var(--ink);
}

.tab.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.card {
  background: var(--card-bg);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px var(--shadow);
}

.card h2 {
  font-size: 1.4rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
  color: var(--ink);
}

.card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--ink);
}

/* Color Analyzer */
.color-input-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.color-input-row input[type="color"] {
  width: 50px;
  height: 50px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 2px;
}

.color-input-row input[type="text"] {
  flex: 1;
  min-width: 120px;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  font-size: 1rem;
  background: rgba(255,255,255,0.6);
}

.color-input-row button,
.btn-primary {
  padding: 0.6rem 1.2rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s;
}

.color-input-row button:hover,
.btn-primary:hover {
  background: #246a88;
}

.btn-secondary {
  padding: 0.5rem 1rem;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--accent);
  color: white;
}

.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.results-grid .wide {
  grid-column: 1 / -1;
}

.swatch-large {
  width: 100%;
  height: 80px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 0.5rem;
}

.color-values p {
  margin: 0.2rem 0;
  font-size: 0.9rem;
}

.color-values strong {
  color: var(--muted);
  font-weight: 600;
}

.hex-label {
  text-align: center;
  font-family: 'Courier New', monospace;
  color: var(--muted);
  font-size: 0.9rem;
}

.property-bars {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.prop-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.prop-row label {
  width: 80px;
  font-size: 0.85rem;
  color: var(--muted);
}

.bar-track {
  flex: 1;
  height: 12px;
  background: var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s ease;
}

.prop-row span {
  width: 45px;
  text-align: right;
  font-size: 0.85rem;
  font-family: 'Courier New', monospace;
}

.analogous-row {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.analogous-swatch {
  flex: 1;
  height: 60px;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 4px;
  font-size: 0.7rem;
  font-family: 'Courier New', monospace;
}

#colorWheel {
  display: block;
  margin: 0 auto;
  max-width: 100%;
}

/* Composition */
.comp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.comp-grid canvas {
  display: block;
  margin: 0 auto 0.8rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  max-width: 100%;
}

.tip-text p {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--muted);
  font-style: italic;
}

/* Techniques */
.technique-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}

.technique-card .technique-header {
  margin-bottom: 0.8rem;
}

.technique-card h3 {
  margin-bottom: 0.4rem;
}

.water-indicator {
  display: flex;
  gap: 4px;
  margin: 0.4rem 0;
}

.water-drop {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--accent);
}

.water-drop.full {
  background: var(--accent);
}

.water-drop.empty {
  background: transparent;
}

.water-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.technique-card ul {
  list-style: none;
  padding: 0;
}

.technique-card li {
  font-size: 0.88rem;
  line-height: 1.5;
  padding: 0.3rem 0;
  padding-left: 1rem;
  position: relative;
  color: #4a3b30;
}

.technique-card li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.65rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-warm);
  opacity: 0.6;
}

/* Pigments */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th {
  text-align: left;
  padding: 0.6rem 0.5rem;
  border-bottom: 2px solid var(--border);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

td {
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.pigment-swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: inline-block;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-transparent { background: #e8f5e9; color: #2e7d32; }
.badge-opaque { background: #fce4ec; color: #c62828; }
.badge-low { background: #e3f2fd; color: #1565c0; }
.badge-medium { background: #fff3e0; color: #e65100; }
.badge-high { background: #fce4ec; color: #c62828; }

/* Journal */
.prompt-box {
  margin-top: 0.8rem;
  padding: 1rem;
  background: rgba(46, 134, 171, 0.06);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--ink);
}

#journalTitle {
  width: 100%;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  margin-bottom: 0.5rem;
  background: rgba(255,255,255,0.6);
}

#journalBody {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
  margin-bottom: 0.5rem;
  background: rgba(255,255,255,0.6);
}

.journal-entry {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.journal-entry:last-child {
  border-bottom: none;
}

.journal-entry h4 {
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.journal-entry .entry-date {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.journal-entry .entry-body {
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.journal-entry .delete-entry {
  float: right;
  background: none;
  border: none;
  color: var(--accent-warm);
  cursor: pointer;
  font-size: 0.8rem;
  opacity: 0.6;
}

.journal-entry .delete-entry:hover {
  opacity: 1;
}

footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

footer a {
  color: var(--accent);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

@media (max-width: 700px) {
  header h1 { font-size: 1.8rem; }

  .results-grid,
  .comp-grid {
    grid-template-columns: 1fr;
  }

  .technique-grid {
    grid-template-columns: 1fr;
  }

  nav { gap: 0.2rem; }
  .tab { font-size: 0.8rem; padding: 0.4rem 0.7rem; }
}
