:root {
  color-scheme: light;
  --bg: #efe9dc;
  --panel: #fffaf2;
  --text: #2a241b;
  --muted: #6a6156;
  --accent: #2a6a5b;
  --accent-strong: #18453b;
  --accent-soft: #d3e7df;
  --danger: #b13e2f;
  --danger-soft: #f5d7cf;
  --warning: #c57b1f;
  --warning-soft: #fde7c6;
  --info: #2f6b8c;
  --info-soft: #d7e7f2;
  --border: #e0d6c6;
  --shadow: 0 18px 45px rgba(46, 40, 31, 0.12);
  --glow: 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
  font-family: "Noto Serif SC", "STSong", "SimSun", serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at 20% -10%, #f7f0de 0%, transparent 50%),
    radial-gradient(circle at 90% 0%, #e4eadf 0%, transparent 45%),
    linear-gradient(160deg, #efe8d9 0%, #e4dccc 50%, #f5efe3 100%);
  color: var(--text);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(0, 0, 0, 0.04) 1px, transparent 1px);
  background-size: 18px 18px;
  pointer-events: none;
  opacity: 0.35;
}

.site-header {
  padding: 24px 20px 12px;
  background: linear-gradient(120deg, #f9f1df, #e2d7c1);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 2;
  backdrop-filter: blur(6px);
}

.site-header::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 10% 0%, rgba(255, 255, 255, 0.7), transparent 55%);
  pointer-events: none;
}

.title-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

h1 {
  margin: 0;
  font-size: 1.8rem;
  letter-spacing: 0.02em;
}

.title-highlight {
  color: var(--accent);
  position: relative;
  display: inline-block;
  padding: 0 4px;
}

.title-highlight::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 2px;
  height: 6px;
  background: linear-gradient(90deg, #7fbf9b, #d6f1df);
  border-radius: 999px;
  z-index: -1;
}

.subtitle {
  margin: 0;
  color: var(--muted);
}

.tabs {
  margin-top: 16px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.tab-button {
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tab-button.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
  box-shadow: var(--glow);
  transform: translateY(-1px);
}

main {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.panel {
  background: var(--panel);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  animation: rise 0.6s ease both;
}

.panel:nth-of-type(1) {
  border-color: rgba(42, 106, 91, 0.3);
}

.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.6) 40%, transparent 70%);
  opacity: 0.25;
  pointer-events: none;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

h2 {
  margin: 0 0 12px;
  font-size: 1.2rem;
  position: relative;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

h2::after {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: linear-gradient(130deg, #e7f4ec, #f7e9c8);
  box-shadow: inset 0 0 0 1px rgba(46, 40, 31, 0.1);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.plant-card {
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 12px;
  background: #fdfcf9;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 180px;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.plant-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(55, 53, 47, 0.12);
}

.plant-card.overdue {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.plant-card.today {
  border-color: var(--warning);
  background: var(--warning-soft);
}

.plant-card.soon {
  border-color: var(--info);
  background: var(--info-soft);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.plant-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.plant-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: #1f3b32;
  background: radial-gradient(circle at 30% 25%, #f7fff9, #d4eadb 60%, #c2dfcf 100%);
  box-shadow: 0 6px 12px rgba(46, 40, 31, 0.18), inset 0 1px 2px rgba(255, 255, 255, 0.8);
  position: relative;
  overflow: hidden;
}

.plant-icon::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 18px;
  border-radius: 60% 40% 60% 40%;
  background: rgba(255, 255, 255, 0.35);
  transform: rotate(-18deg);
  top: 4px;
  right: 5px;
}

.plant-icon::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 6px;
  border-radius: 60% 60% 40% 40%;
  background: rgba(47, 91, 65, 0.25);
  bottom: 2px;
  left: 6px;
  transform: rotate(12deg);
}

.plant-icon.tone-flower {
  background: radial-gradient(circle at 30% 25%, #fff4f3, #f5c9c9 60%, #ebb8b1 100%);
  color: #7a3c33;
}

.plant-icon.tone-succulent {
  background: radial-gradient(circle at 30% 25%, #f4fffb, #cdebe3 60%, #b7dacd 100%);
  color: #216457;
}

.plant-icon.tone-orchid {
  background: radial-gradient(circle at 30% 25%, #f7f3ff, #d6ccf5 60%, #c1b2e8 100%);
  color: #3d2f7a;
}

.plant-icon.tone-grass {
  background: radial-gradient(circle at 30% 25%, #f4ffe8, #cfe7b8 60%, #bcd59a 100%);
  color: #2f5a2c;
}

.plant-icon.tone-leaf {
  background: radial-gradient(circle at 30% 25%, #f1fff4, #cce7cf 60%, #b9d7be 100%);
  color: #2d5c3a;
}

.plant-icon.tone-default {
  background: radial-gradient(circle at 30% 25%, #fff8ee, #eadcc6 60%, #d8c6ad 100%);
  color: #4a3a2a;
}

.plant-name {
  margin: 0;
  font-size: 1.05rem;
}

.badge {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  letter-spacing: 0.02em;
}

.meta,
.extra,
.notes,
.dates {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.notes {
  color: #4d4338;
}

.advice {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.4;
  color: #2b4a3a;
  background: #e6f0ea;
  padding: 6px 8px;
  border-radius: 8px;
}

.health {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.4;
  color: #2d4456;
  background: #e8f0f6;
  padding: 6px 8px;
  border-radius: 8px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

button {
  border: none;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button.primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-strong));
  color: #fff;
  box-shadow: 0 10px 18px rgba(42, 106, 91, 0.25);
}

button.ghost {
  background: transparent;
  border: 1px solid var(--border);
}

button.danger {
  background: var(--danger);
  color: #fff;
}

button:hover {
  transform: translateY(-1px);
}

.filter select,
.plant-form input,
.plant-form textarea,
.plant-form select,
.ai-settings input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
  background: #fff;
  font-family: inherit;
  box-shadow: var(--glow);
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.ai-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.ai-settings {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ai-settings.is-hidden {
  display: none;
}

.health-history {
  margin-top: 16px;
  border-top: 1px dashed var(--border);
  padding-top: 12px;
}

.health-history h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.health-history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

#aiStatus {
  min-height: 1.2em;
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fadeIn 0.5s ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 600px) {
  .site-header {
    padding: 20px 16px 10px;
  }

  main {
    padding: 16px;
  }

  .panel-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
