:root {
  color-scheme: light;
  --bg: #f7f5f2;
  --card: rgba(255, 255, 255, 0.72);
  --text: #1f1f1f;
  --muted: #7a7a7a;
  --accent: #aebfd1;
  --accent-strong: #7892ae;
  --line: rgba(31, 31, 31, 0.08);
  --danger: #b55c59;
  --shadow: 0 18px 42px rgba(48, 43, 37, 0.08);
  font-family: "SF Pro Display", "PingFang SC", system-ui, sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111315;
  --card: rgba(27, 29, 33, 0.78);
  --text: #eaeaea;
  --muted: #8a8a8a;
  --accent: #8fa8c5;
  --accent-strong: #b4c7dc;
  --line: rgba(234, 234, 234, 0.1);
  --danger: #d27a75;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

body [hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 50% -10%, rgba(174, 191, 209, 0.28), transparent 36rem),
    var(--bg);
  color: var(--text);
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.splash {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  background: var(--bg);
  transition: opacity 480ms ease, filter 480ms ease, visibility 480ms ease;
}

.splash.is-hidden {
  opacity: 0;
  filter: blur(14px);
  visibility: hidden;
}

.splash__icon,
.brand__icon {
  width: 74px;
  height: 74px;
  filter: drop-shadow(0 12px 20px rgba(72, 87, 105, 0.14));
}

.splash h1,
.brand h1,
.topbar h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.05;
  font-weight: 680;
}

.splash p,
.quote-line,
.date-line,
.eyebrow {
  margin: 0;
  color: var(--muted);
}

.app {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom));
}

.login-view,
.home-view {
  min-height: calc(100vh - 48px);
  animation: riseIn 520ms ease both;
}

.login-view {
  display: grid;
  align-content: center;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.eyebrow {
  margin-bottom: 8px;
  font-size: 13px;
}

.glass-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
}

.login-card {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.login-card label {
  display: grid;
  gap: 9px;
  color: var(--muted);
  font-size: 14px;
}

.login-card input,
.editor-card input,
.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.login-card input:not([type="checkbox"]),
.editor-card input {
  min-height: 46px;
  padding: 0 2px;
  border-bottom: 1px solid var(--line);
  font-size: 18px;
}

.remember-line {
  display: flex !important;
  grid-template-columns: auto 1fr;
  align-items: center;
}

.remember-line input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-strong);
}

.primary-action {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  cursor: pointer;
}

.home-view {
  display: grid;
  align-content: start;
  gap: 18px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-top: 10px;
}

.topbar > div:first-child {
  flex: 1 1 auto;
}

.date-line {
  margin-bottom: 8px;
  font-size: 14px;
}

.quote-line {
  margin-top: 12px;
  font-size: 15px;
}

.icon-button,
.mini-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.icon-sun,
.icon-gear,
.icon-search {
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.icon-sun::after {
  content: "";
  display: block;
  width: 6px;
  height: 6px;
  margin: 4px;
  border-radius: 50%;
  background: currentColor;
}

.icon-search {
  position: relative;
  width: 15px;
  height: 15px;
}

.icon-search::after {
  content: "";
  position: absolute;
  right: -6px;
  bottom: -4px;
  width: 8px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transform: rotate(45deg);
}

.icon-gear {
  position: relative;
}

.icon-gear::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.icon-gear::after {
  content: "";
  position: absolute;
  inset: -5px 7px;
  border-top: 4px solid currentColor;
  border-bottom: 4px solid currentColor;
}

.composer {
  padding: 16px;
}

.composer__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.mood-picker {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.mood-picker::-webkit-scrollbar {
  display: none;
}

.mood-chip,
.segment {
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(142, 142, 147, 0.1);
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
}

.mood-chip {
  padding: 0 12px;
}

.mood-chip.is-active,
.segment.is-active {
  border-color: rgba(120, 146, 174, 0.28);
  background: rgba(174, 191, 209, 0.28);
  color: var(--text);
}

.save-state {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
}

#noteInput,
#dialogInput {
  width: 100%;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--text);
  line-height: 1.65;
}

#noteInput {
  min-height: 136px;
  font-size: 21px;
}

#noteInput::placeholder,
#dialogInput::placeholder,
.search-box input::placeholder,
.login-card input::placeholder {
  color: color-mix(in srgb, var(--muted) 72%, transparent);
}

.toolbar {
  display: grid;
  gap: 12px;
}

.search-box {
  display: flex;
  align-items: center;
  min-height: 44px;
  gap: 12px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(142, 142, 147, 0.1);
  color: var(--muted);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 4px;
  border-radius: 8px;
  background: rgba(142, 142, 147, 0.1);
}

.segment {
  border-radius: 7px;
}

.timeline {
  display: grid;
  gap: 20px;
  padding-bottom: 16px;
}

.timeline-group {
  display: grid;
  gap: 10px;
}

.timeline-group h2 {
  margin: 4px 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 560;
}

.note-card {
  overflow: hidden;
  animation: riseIn 320ms ease both;
}

.note-card__body {
  display: grid;
  width: 100%;
  gap: 10px;
  padding: 16px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.note-card__content {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.note-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.note-tag {
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(174, 191, 209, 0.22);
  color: var(--accent-strong);
  font-size: 12px;
}

.note-card__time {
  color: var(--muted);
  font-size: 12px;
}

.note-card__actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
}

.mini-button {
  height: 42px;
  border-width: 0 1px 0 0;
  border-radius: 0;
}

.mini-button:last-child {
  border-right: 0;
}

.mini-button::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
}

[data-action="pin"]::before {
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
}

[data-action="favorite"]::before {
  border-radius: 50%;
  box-shadow: inset 0 0 0 4px var(--card);
  background: currentColor;
}

[data-action="archive"]::before {
  height: 12px;
  border-radius: 3px;
}

[data-action="delete"]::before {
  height: 18px;
  border-radius: 3px;
  border-top-width: 4px;
}

.mini-button.is-on {
  color: var(--accent-strong);
}

.danger,
.danger-text {
  color: var(--danger);
}

.empty-state {
  padding: 36px 18px;
  color: var(--muted);
  text-align: center;
}

.editor-dialog {
  width: min(92vw, 500px);
  padding: 0;
  border: 0;
  background: transparent;
}

.editor-dialog::backdrop {
  background: rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(10px);
}

.editor-card {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.editor-card label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.editor-card__bar {
  display: flex;
  justify-content: space-between;
}

.text-button {
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  cursor: pointer;
}

.form-message {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.form-message.is-error {
  color: var(--danger);
}

.form-message.is-success {
  color: var(--accent-strong);
}

#dialogInput {
  min-height: 48vh;
  font-size: 18px;
}

@keyframes riseIn {
  from {
    opacity: 0;
    filter: blur(8px);
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

@media (min-width: 700px) {
  .app {
    padding-top: 36px;
  }
}
