:root {
  color-scheme: light;
  --paper: #f4f0e8;
  --paper-deep: #e8e2d7;
  --surface: #fbf9f4;
  --ink: #24231f;
  --muted: #777268;
  --line: rgba(36, 35, 31, 0.13);
  --forest: #244b3d;
  --forest-soft: #d8e3dc;
  --coral: #f18771;
  --yellow: #efc85c;
  --blue: #8cb6c5;
  --lilac: #b9acd1;
  --shadow: 0 24px 70px rgba(50, 44, 34, 0.12);
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Iowan Old Style, Baskerville, "Times New Roman", serif;
  font-family: var(--sans);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 78% 8%, rgba(255, 255, 255, 0.74), transparent 28%),
    var(--paper);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

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

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(36, 75, 61, 0.25);
  outline-offset: 3px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.app {
  min-height: 100vh;
}

.topbar {
  position: relative;
  z-index: 10;
  min-height: 88px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 18px 30px;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 240, 232, 0.88);
  backdrop-filter: blur(18px);
}

.brand {
  width: fit-content;
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--forest);
  color: #fff;
  font-family: var(--serif);
  font-size: 17px;
  font-style: italic;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-copy strong {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
}

.brand-copy small {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.language-switch {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.52);
}

.language-tab {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.language-tab span {
  font-size: 9px;
  letter-spacing: 0.08em;
  opacity: 0.66;
}

.language-tab.is-active {
  background: var(--forest);
  color: #fff;
  box-shadow: 0 5px 16px rgba(36, 75, 61, 0.2);
}

.top-add-button {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 18px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.top-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 9px;
}

.sync-status-button {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.sync-status-button:hover {
  background: var(--surface);
  color: var(--ink);
  transform: translateY(-1px);
}

.sync-status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: #aaa49a;
  box-shadow: 0 0 0 4px rgba(119, 114, 104, 0.09);
}

[data-sync-state="ready"] .sync-status-dot,
.sync-account .sync-status-dot {
  background: #4d8b69;
  box-shadow: 0 0 0 4px rgba(77, 139, 105, 0.12);
}

[data-sync-state="syncing"] .sync-status-dot {
  background: var(--yellow);
  box-shadow: 0 0 0 4px rgba(239, 200, 92, 0.16);
  animation: sync-pulse 1s ease-in-out infinite;
}

[data-sync-state="error"] .sync-status-dot {
  background: var(--coral);
  box-shadow: 0 0 0 4px rgba(241, 135, 113, 0.15);
}

@keyframes sync-pulse {
  50% {
    opacity: 0.4;
    transform: scale(0.72);
  }
}

.top-add-button span {
  font-size: 18px;
  line-height: 1;
}

.top-add-button:hover {
  background: var(--ink);
  color: #fff;
  transform: translateY(-1px);
}

.workspace {
  min-height: calc(100vh - 88px);
  display: grid;
  grid-template-columns: 314px minmax(0, 1fr);
}

.sidebar {
  padding: 28px 24px;
  border-right: 1px solid var(--line);
}

.calendar-card,
.progress-card {
  border: 1px solid rgba(36, 35, 31, 0.09);
  border-radius: 22px;
  background: rgba(251, 249, 244, 0.88);
  box-shadow: 0 12px 42px rgba(50, 44, 34, 0.06);
}

.calendar-card {
  padding: 22px;
}

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

.kicker {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.month-navigation h2 {
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 500;
  text-transform: capitalize;
}

.month-buttons {
  display: flex;
  gap: 6px;
}

.icon-button,
.round-button,
.dialog-close {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.icon-button {
  width: 32px;
  height: 32px;
  font-size: 13px;
}

.icon-button:hover,
.round-button:hover,
.dialog-close:hover {
  background: var(--ink);
  color: #fff;
  transform: translateY(-1px);
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}

.calendar-weekday,
.calendar-day {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.calendar-weekday {
  color: #9b968c;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.calendar-day {
  position: relative;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font-size: 11px;
  transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}

.calendar-day:hover {
  background: var(--paper-deep);
  transform: scale(1.04);
}

.calendar-day.is-muted {
  color: #c2bdb4;
}

.calendar-day.is-today::after,
.calendar-day.has-entry::after {
  content: "";
  position: absolute;
  bottom: 3px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--coral);
}

.calendar-day.has-entry {
  background: var(--forest-soft);
  color: var(--forest);
  font-weight: 800;
}

.calendar-day.is-selected {
  background: var(--forest);
  color: #fff;
}

.calendar-day.is-selected::after {
  background: #fff;
}

.today-button {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  padding: 0 13px;
  border: 0;
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.today-button span:last-child {
  color: var(--muted);
  font-weight: 500;
}

.progress-card {
  margin-top: 16px;
  padding: 20px 22px;
}

.progress-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 16px;
}

.progress-grid > div + div {
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.progress-grid strong,
.progress-grid span {
  display: block;
}

.progress-grid strong {
  margin-bottom: 3px;
  font-family: var(--serif);
  font-size: 35px;
  font-weight: 500;
  line-height: 1;
}

.progress-grid span {
  color: var(--muted);
  font-size: 10px;
}

.review-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.review-row strong {
  color: var(--ink);
  font-size: 11px;
}

.review-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 4px rgba(241, 135, 113, 0.14);
}

.journal-area {
  min-width: 0;
  overflow: hidden;
  padding: 42px 0 32px;
}

.journal-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  padding: 0 42px 26px;
}

.journal-heading h1 {
  font-family: var(--serif);
  font-size: clamp(42px, 5vw, 72px);
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 0.95;
}

.journal-subtitle {
  max-width: 530px;
  margin-top: 13px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.track-controls {
  display: flex;
  gap: 8px;
  padding-bottom: 4px;
}

.round-button {
  width: 44px;
  height: 44px;
}

.journal-track-wrap {
  position: relative;
}

.journal-track {
  display: flex;
  align-items: stretch;
  gap: 22px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 12px 42px 30px;
  scroll-behavior: smooth;
  scroll-padding-inline: 42px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.journal-track::-webkit-scrollbar {
  display: none;
}

.journal-page {
  --page-color: var(--lilac);
  --page-ink: #2e2940;
  position: relative;
  width: 328px;
  min-width: 328px;
  min-height: 430px;
  overflow: hidden;
  border-radius: 26px 26px 26px 7px;
  background: var(--page-color);
  color: var(--page-ink);
  box-shadow: 0 19px 44px rgba(50, 44, 34, 0.12);
  scroll-snap-align: start;
  transition: transform 220ms ease, box-shadow 220ms ease;
}

.journal-page:nth-child(4n + 1) {
  --page-color: #b9acd1;
  --page-ink: #302848;
}

.journal-page:nth-child(4n + 2) {
  --page-color: #f09a83;
  --page-ink: #5f2d24;
}

.journal-page:nth-child(4n + 3) {
  --page-color: #92bbc3;
  --page-ink: #163e45;
}

.journal-page:nth-child(4n + 4) {
  --page-color: #e7c65e;
  --page-ink: #594715;
}

.journal-page:hover {
  transform: translateY(-5px) rotate(-0.35deg);
  box-shadow: 0 27px 58px rgba(50, 44, 34, 0.17);
}

.page-open {
  width: 100%;
  min-height: 430px;
  display: flex;
  flex-direction: column;
  padding: 25px;
  border: 0;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.19), transparent 44%),
    transparent;
  color: inherit;
  text-align: left;
}

.page-open::after {
  content: "";
  position: absolute;
  right: -43px;
  bottom: -48px;
  width: 150px;
  height: 150px;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: 0.12;
}

.page-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 17px;
  border-bottom: 1px solid currentColor;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.78;
}

.page-date {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: end;
  gap: 11px;
  margin-top: 25px;
}

.page-date strong {
  font-family: var(--serif);
  font-size: 82px;
  font-weight: 400;
  letter-spacing: -0.07em;
  line-height: 0.75;
}

.page-date span {
  display: grid;
  gap: 2px;
  padding-bottom: 2px;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-date em {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 400;
  text-transform: none;
}

.page-label {
  margin-top: 27px;
  font-family: var(--serif);
  font-size: 28px;
  font-style: italic;
  line-height: 1;
}

.page-preview {
  min-height: 62px;
  display: -webkit-box;
  margin-top: 13px;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.55;
  opacity: 0.78;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.page-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid currentColor;
}

.page-metrics span {
  display: grid;
  gap: 3px;
}

.page-metrics span + span {
  padding-left: 12px;
  border-left: 1px solid currentColor;
}

.page-metrics small {
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  opacity: 0.62;
}

.page-metrics b {
  overflow: hidden;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-copy {
  position: absolute;
  top: 61px;
  right: 20px;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: inherit;
  font-size: 9px;
  font-weight: 800;
  opacity: 0;
  transition: opacity 160ms ease, background 160ms ease;
}

.journal-page:hover .page-copy,
.journal-page:focus-within .page-copy {
  opacity: 0.72;
}

.page-copy:hover {
  background: rgba(255, 255, 255, 0.3);
  opacity: 1;
}

.add-page {
  width: 328px;
  min-width: 328px;
  min-height: 430px;
  display: grid;
  place-items: center;
  padding: 30px;
  border: 1px dashed rgba(36, 35, 31, 0.28);
  border-radius: 26px 26px 26px 7px;
  background: rgba(255, 255, 255, 0.2);
  color: var(--ink);
  text-align: center;
  scroll-snap-align: start;
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.add-page:hover {
  border-color: var(--forest);
  background: rgba(255, 255, 255, 0.48);
  transform: translateY(-4px);
}

.add-page-content {
  max-width: 210px;
}

.add-page-icon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  margin: 0 auto 21px;
  border-radius: 50%;
  background: var(--forest);
  color: #fff;
  font-family: var(--serif);
  font-size: 42px;
  font-weight: 300;
  line-height: 1;
  box-shadow: 0 12px 28px rgba(36, 75, 61, 0.2);
}

.add-page strong,
.add-page span {
  display: block;
}

.add-page strong {
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 500;
}

.add-page span:last-child {
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.empty-intro {
  width: 328px;
  min-width: 328px;
  min-height: 430px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 27px;
  border-radius: 26px 26px 26px 7px;
  background: var(--forest);
  color: #f6f2e9;
  scroll-snap-align: start;
  box-shadow: var(--shadow);
}

.empty-intro p:last-child {
  max-width: 250px;
  font-family: var(--serif);
  font-size: 31px;
  line-height: 1.1;
}

.empty-intro .empty-number {
  font-family: var(--serif);
  font-size: 120px;
  font-style: italic;
  line-height: 0.8;
  opacity: 0.18;
}

.scroll-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 1px 42px 0;
  color: var(--muted);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.scroll-hint span {
  width: 54px;
  height: 1px;
  display: block;
  background: var(--muted);
  opacity: 0.45;
}

.entry-dialog {
  width: min(980px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 27px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 35px 110px rgba(21, 22, 19, 0.28);
}

.sync-dialog {
  width: min(470px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 27px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 35px 110px rgba(21, 22, 19, 0.28);
}

.entry-dialog::backdrop,
.sync-dialog::backdrop {
  background: rgba(26, 29, 25, 0.42);
  backdrop-filter: blur(7px);
}

.entry-dialog[open],
.sync-dialog[open] {
  animation: dialog-in 220ms ease both;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(15px) scale(0.985);
  }
}

.entry-form {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 36px);
}

.dialog-header,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.dialog-header {
  padding: 23px 26px 19px;
  border-bottom: 1px solid var(--line);
}

.dialog-header h2 {
  font-family: var(--serif);
  font-size: 33px;
  font-weight: 500;
}

.sync-panel {
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.sync-panel-body {
  padding: 30px 32px 32px;
}

.sync-loading,
.sync-join,
.sync-account {
  text-align: center;
}

.sync-panel-body h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 500;
  line-height: 1.05;
}

.sync-panel-body section > p:not(.kicker):not(.sync-help) {
  max-width: 340px;
  margin: 10px auto 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.cloud-illustration {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  margin: 0 auto 21px;
  border-radius: 50%;
  background: var(--forest);
  color: #fff;
  font-family: var(--serif);
  font-size: 34px;
  box-shadow: 0 13px 30px rgba(36, 75, 61, 0.19);
}

.cloud-illustration.is-success {
  background: #4d8b69;
}

.cloud-illustration.is-loading {
  animation: cloud-breathe 1.2s ease-in-out infinite alternate;
}

@keyframes cloud-breathe {
  to {
    transform: translateY(-4px);
    box-shadow: 0 18px 38px rgba(36, 75, 61, 0.28);
  }
}

.sync-form {
  display: grid;
  gap: 14px;
  margin-top: 25px;
  text-align: left;
}

.sync-help {
  margin-top: 18px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.sync-help code {
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--paper-deep);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.wide-button {
  width: 100%;
  justify-content: center;
}

.text-button {
  min-height: 36px;
  padding: 0 9px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.text-button:hover {
  color: var(--ink);
}

.danger-text {
  color: #9a493b;
}

.sync-account h3 {
  font-size: 25px;
}

.account-sync-state {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 25px;
  padding: 15px 17px;
  border-radius: 14px;
  background: var(--forest-soft);
  color: var(--forest);
  text-align: left;
}

.account-sync-state div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.account-sync-state strong,
.account-sync-state small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-sync-state strong {
  font-size: 11px;
}

.account-sync-state small {
  font-size: 9px;
  opacity: 0.72;
}

.account-actions {
  display: grid;
  gap: 8px;
  margin-top: 20px;
}

.sync-recovery-code {
  min-height: 88px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  line-height: 1.55;
  word-break: break-all;
}

.sync-back-button {
  margin-top: 13px;
}

.sync-error {
  margin: 18px 0 0;
  padding: 12px 14px;
  border-radius: 11px;
  background: rgba(241, 135, 113, 0.14);
  color: #8c4134;
  font-size: 10px;
  line-height: 1.5;
  text-align: left;
}

.dialog-close {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  font-size: 25px;
}

.dialog-body {
  min-height: 0;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 24px;
  overflow: auto;
  padding: 24px 26px;
}

.entry-meta {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.field > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  color: var(--ink);
}

.field input {
  height: 47px;
  padding: 0 13px;
}

.field textarea {
  min-height: 410px;
  resize: vertical;
  padding: 17px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  line-height: 1.65;
}

.paste-note {
  padding: 18px;
  border-radius: 15px;
  background: var(--forest-soft);
  color: var(--forest);
}

.paste-note-icon {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  margin-bottom: 26px;
  border-radius: 50%;
  background: var(--forest);
  color: #fff;
}

.paste-note p {
  font-size: 11px;
  line-height: 1.55;
}

.paste-note strong {
  display: block;
  margin-bottom: 3px;
}

.dialog-actions {
  padding: 17px 26px;
  border-top: 1px solid var(--line);
}

.dialog-actions > div {
  display: flex;
  gap: 9px;
}

.delete-button,
.secondary-button,
.save-button {
  min-height: 43px;
  padding: 0 17px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
}

.delete-button {
  border: 0;
  background: transparent;
  color: #9a493b;
}

.secondary-button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}

.save-button {
  border: 1px solid var(--forest);
  background: var(--forest);
  color: #fff;
}

.delete-button:hover,
.secondary-button:hover,
.save-button:hover {
  transform: translateY(-1px);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 0 17px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .language-switch {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }

  .language-tab {
    flex: 1;
    justify-content: center;
  }

  .workspace {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .sidebar {
    padding: 20px 16px;
  }

  .calendar-card,
  .progress-card {
    padding: 17px;
  }
}

@media (max-width: 720px) {
  .topbar {
    position: sticky;
    top: 0;
    grid-template-columns: 1fr auto;
    gap: 13px;
    padding: 12px 16px;
  }

  .brand-copy small {
    display: none;
  }

  .brand-mark {
    width: 39px;
    height: 39px;
  }

  .brand-copy strong {
    font-size: 17px;
  }

  .top-add-button {
    width: 42px;
    height: 42px;
    min-height: 42px;
    justify-content: center;
    padding: 0;
    border-radius: 50%;
    font-size: 0;
  }

  .top-actions {
    gap: 7px;
  }

  .sync-status-button {
    min-height: 42px;
    padding: 0 12px;
  }

  .top-add-button span {
    font-size: 20px;
  }

  .workspace {
    display: block;
  }

  .sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 160px;
    gap: 12px;
    padding: 18px 16px 0;
    border-right: 0;
  }

  .progress-card {
    margin-top: 0;
  }

  .progress-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .progress-grid > div + div {
    padding-top: 15px;
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .review-row {
    grid-template-columns: auto 1fr;
  }

  .review-row strong {
    grid-column: 2;
  }

  .journal-area {
    padding-top: 34px;
  }

  .journal-heading {
    padding: 0 16px 21px;
  }

  .journal-heading h1 {
    font-size: 48px;
  }

  .journal-subtitle {
    max-width: 330px;
  }

  .track-controls {
    display: none;
  }

  .journal-track {
    gap: 14px;
    padding: 10px 16px 24px;
    scroll-padding-inline: 16px;
  }

  .journal-page,
  .add-page,
  .empty-intro {
    width: min(82vw, 328px);
    min-width: min(82vw, 328px);
  }

  .scroll-hint {
    margin-left: 16px;
  }

  .dialog-body {
    grid-template-columns: 1fr;
  }

  .entry-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 500px) {
  .brand-copy {
    display: none;
  }

  .sync-status-button {
    padding: 0 10px;
  }

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

  .progress-card {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 18px;
    align-items: center;
  }

  .progress-card > .kicker {
    grid-column: 1 / -1;
  }

  .progress-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0;
  }

  .progress-grid > div + div {
    padding-top: 0;
    padding-left: 14px;
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .review-row {
    margin-top: 14px;
    padding-top: 0;
    border-top: 0;
  }

  .entry-dialog {
    width: 100vw;
    max-width: none;
    max-height: 100dvh;
    border-radius: 0;
  }

  .sync-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
    border-radius: 22px;
  }

  .sync-panel {
    max-height: calc(100dvh - 20px);
  }

  .sync-panel-body {
    padding: 25px 20px 27px;
  }

  .entry-form {
    max-height: 100dvh;
  }

  .dialog-header,
  .dialog-body,
  .dialog-actions {
    padding-right: 17px;
    padding-left: 17px;
  }

  .entry-meta {
    grid-template-columns: 1fr;
  }

  .paste-note {
    display: none;
  }

  .dialog-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .dialog-actions > div {
    display: grid;
    grid-template-columns: auto 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
