:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f1ea;
  color: #1e1f22;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(38, 162, 105, 0.12), transparent 35%),
    linear-gradient(315deg, rgba(198, 70, 45, 0.12), transparent 30%),
    #f4f1ea;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: #1e1f22;
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  min-height: 44px;
  padding: 0 18px;
}

button:hover {
  filter: brightness(1.08);
}

.shell {
  width: min(1040px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 28px 0;
}

.login-panel {
  display: grid;
  gap: 28px;
  width: min(420px, 100%);
  margin: 12vh auto 0;
  padding: 28px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(30, 31, 34, 0.12);
  border-radius: 8px;
  box-shadow: 0 22px 60px rgba(30, 31, 34, 0.12);
}

.eyebrow {
  margin: 0 0 8px;
  color: #69645d;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.05;
}

h1 {
  font-size: clamp(2rem, 8vw, 4.5rem);
}

h2 {
  font-size: 1.2rem;
}

.login-form,
.mood-picker {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #4d4b47;
  font-size: 0.92rem;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(30, 31, 34, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: #1e1f22;
  padding: 12px 13px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: #1e1f22;
  box-shadow: 0 0 0 3px rgba(30, 31, 34, 0.1);
}

.error,
.status {
  min-height: 1.4em;
  margin: 0;
  color: #9a3412;
  font-weight: 700;
}

.status {
  color: #286a49;
}

.app-view {
  display: grid;
  gap: 22px;
}

.topbar,
.mood-picker,
.calendar-section,
.year-section {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(30, 31, 34, 0.1);
  border-radius: 8px;
  box-shadow: 0 16px 50px rgba(30, 31, 34, 0.08);
}

.topbar {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.ghost,
.icon-button {
  background: rgba(30, 31, 34, 0.08);
  color: #1e1f22;
}

.tiny-danger {
  justify-self: start;
  min-height: 30px;
  padding: 0 10px;
  background: transparent;
  color: #9a3412;
  font-size: 0.78rem;
  font-weight: 800;
}

.tiny-danger:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.mood-picker,
.calendar-section,
.year-section {
  padding: 20px;
}

.mood-buttons {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
}

.mood-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 62px;
  background: #fff;
  border: 2px solid transparent;
  color: #1e1f22;
  box-shadow: inset 0 0 0 1px rgba(30, 31, 34, 0.1);
}

.mood-button span {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border-radius: 50%;
  background: var(--mood-color);
}

.mood-button.selected {
  border-color: var(--mood-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--mood-color) 22%, transparent);
}

.calendar-head {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  text-align: center;
}

.year-head {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  text-align: center;
}

.year-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.year-month {
  min-width: 0;
}

.year-month h3 {
  margin: 0 0 8px;
  color: #4d4b47;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.year-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.year-day {
  width: 100%;
  aspect-ratio: 1;
  min-height: 0;
  padding: 0;
  border: 1px solid rgba(30, 31, 34, 0.1);
  border-radius: 4px;
  background: rgba(30, 31, 34, 0.08);
}

.year-day.today-dot {
  outline: 2px solid rgba(30, 31, 34, 0.35);
  outline-offset: 1px;
}

.year-day.selected-dot {
  box-shadow: inset 0 0 0 2px #1e1f22;
}

.icon-button {
  width: 44px;
  min-height: 44px;
  padding: 0;
  font-size: 1.5rem;
}

.weekday-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.calendar-wrap {
  position: relative;
}

.weekday-row {
  margin-bottom: 8px;
  color: #69645d;
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}

.day {
  aspect-ratio: 1;
  min-height: 42px;
  padding: 0;
  border: 1px solid rgba(30, 31, 34, 0.1);
  background: rgba(255, 255, 255, 0.82);
  color: #1e1f22;
}

.day.today {
  outline: 3px solid rgba(30, 31, 34, 0.25);
  outline-offset: 2px;
}

.day.selected-day {
  box-shadow: inset 0 0 0 3px #1e1f22;
}

.day.spacer {
  visibility: hidden;
}

.quick-picker {
  position: absolute;
  z-index: 10;
  width: min(236px, 100%);
  padding: 12px;
  border: 1px solid rgba(30, 31, 34, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 42px rgba(30, 31, 34, 0.18);
}

.quick-picker p {
  margin: 0 0 10px;
  color: #4d4b47;
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
}

.quick-picker-buttons {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.quick-color {
  aspect-ratio: 1;
  min-height: 0;
  padding: 0;
  border: 2px solid rgba(30, 31, 34, 0.14);
  border-radius: 50%;
  background: var(--mood-color);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.45);
}

.quick-color:hover {
  border-color: #1e1f22;
  filter: brightness(1.04);
}

@media (max-width: 760px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .topbar-actions button {
    flex: 1 1 180px;
  }

  .mood-buttons {
    grid-template-columns: 1fr;
  }

  .year-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  h1 {
    font-size: 2.4rem;
  }

  .shell {
    width: min(100vw - 18px, 1040px);
    padding: 12px 0;
  }

  .weekday-row,
  .calendar-grid {
    gap: 5px;
  }

  .day {
    min-height: 38px;
  }
}

@media (max-width: 430px) {
  .year-grid {
    grid-template-columns: 1fr;
  }
}
