:root {
  color-scheme: light;
  --background: #f8efe5;
  --surface: #fffaf5;
  --surface-strong: #ffffff;
  --text: #392a24;
  --muted: #7b6b63;
  --line: #e8d9cd;
  --accent: #df766d;
  --accent-dark: #bd554d;
  --green: #7da18a;
  --shadow: 0 10px 30px rgb(77 50 36 / 10%);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

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

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--text);
  background: radial-gradient(circle at 85% 8%, rgb(255 255 255 / 70%) 0 8rem, transparent 8.1rem), var(--background);
}

button, input, textarea { font: inherit; }
button { color: inherit; }
button:not(:disabled) { cursor: pointer; }
[hidden] { display: none !important; }

.screen {
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(24px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
}

.screen--center { display: grid; place-items: center; }

.loading-mark, .brand-mark {
  display: inline-grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: -0.06em;
  color: white;
  background: var(--accent);
}

.loading-mark {
  width: 64px;
  height: 64px;
  margin-inline: auto;
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.login-card {
  width: min(100%, 420px);
  padding: 32px 24px;
  border: 1px solid rgb(255 255 255 / 80%);
  border-radius: 28px;
  background: rgb(255 250 245 / 92%);
  box-shadow: var(--shadow);
}

.eyebrow, .view-kicker {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-dark);
}

.login-card h1 {
  margin: 6px 0 10px;
  font-family: Georgia, "Yu Mincho", serif;
  font-size: clamp(2rem, 10vw, 3rem);
}

.login-description {
  margin: 0 0 28px;
  color: var(--muted);
  line-height: 1.7;
}

.form-stack, .menu-form { display: grid; gap: 10px; }
label { margin-top: 8px; font-weight: 700; }

input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  background: var(--surface-strong);
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input { min-height: 50px; padding: 0 14px; }

textarea {
  min-height: 190px;
  padding: 14px;
  line-height: 1.7;
  resize: vertical;
}

input:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(223 118 109 / 16%);
}

.button {
  min-height: 50px;
  padding: 0 18px;
  border: 0;
  border-radius: 14px;
  font-weight: 700;
}

.button--primary {
  margin-top: 12px;
  color: white;
  background: var(--accent);
  box-shadow: 0 8px 18px rgb(189 85 77 / 18%);
}

.button--primary:active { background: var(--accent-dark); }
.button:disabled { opacity: 0.6; }

.form-message {
  min-height: 1.5em;
  margin: 14px 0 0;
  color: var(--accent-dark);
  line-height: 1.5;
}

.app-shell { min-height: 100vh; min-height: 100dvh; }

.app-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: calc(60px + env(safe-area-inset-top));
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  border-bottom: 1px solid rgb(232 217 205 / 70%);
  background: rgb(248 239 229 / 90%);
  backdrop-filter: blur(14px);
}

.brand-button, .text-button, .sub-button, .back-button { border: 0; background: transparent; }

.brand-button {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 0;
  font-weight: 800;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  font-size: 0.75rem;
}

.text-button {
  min-height: 44px;
  padding: 0 4px 0 12px;
  color: var(--muted);
  font-size: 0.875rem;
}

.app-main {
  width: min(100%, 760px);
  margin-inline: auto;
  padding: 20px 14px calc(32px + env(safe-area-inset-bottom));
}

.view { animation: appear 180ms ease-out; }

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

.calendar-toolbar {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  text-align: center;
}

.calendar-toolbar h1, .edit-heading h1 {
  margin: 3px 0 0;
  font-family: Georgia, "Yu Mincho", serif;
  font-size: clamp(1.45rem, 7vw, 2rem);
}

.icon-button {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-family: Arial, sans-serif;
  font-size: 2rem;
  line-height: 1;
  background: var(--surface);
}

.weekday-row, .month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }

.weekday-row {
  padding: 0 2px 8px;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}

.sunday { color: var(--accent-dark); }
.saturday { color: #587c9d; }

.month-grid {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-strong);
  box-shadow: 0 8px 24px rgb(77 50 36 / 7%);
}

.month-day {
  position: relative;
  min-width: 0;
  min-height: 86px;
  padding: 7px 4px;
  overflow: hidden;
  border: 0;
  border-right: 1px solid #f0e5dc;
  border-bottom: 1px solid #f0e5dc;
  text-align: left;
  background: white;
}

.month-day:nth-child(7n) { border-right: 0; }
.month-day:nth-last-child(-n + 7) { border-bottom: 0; }

.month-day--outside {
  color: #b9ada7;
  background: #fcf8f4;
}

.month-day--today .day-number { color: white; background: var(--green); }

.day-number {
  display: inline-grid;
  place-items: center;
  min-width: 25px;
  height: 25px;
  padding-inline: 4px;
  border-radius: 9px;
  font-size: 0.78rem;
}

.month-menu {
  display: -webkit-box;
  margin-top: 5px;
  padding: 4px;
  overflow: hidden;
  border-radius: 6px;
  color: #563a32;
  font-size: clamp(0.58rem, 2.4vw, 0.72rem);
  line-height: 1.25;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.menu-color-0 { background: #f8d7d2; }
.menu-color-1 { background: #f8e5b8; }
.menu-color-2 { background: #d7ead9; }
.menu-color-3 { background: #d7e9ef; }

.sub-button, .back-button {
  min-height: 44px;
  padding: 0 8px;
  color: var(--accent-dark);
  font-weight: 700;
}

.sub-button { display: block; margin: -12px auto 12px; }

.week-tabs {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 16px;
  padding: 7px;
  border-radius: 18px;
  background: rgb(255 255 255 / 58%);
}

.week-tab {
  min-width: 0;
  min-height: 56px;
  padding: 5px 2px;
  border: 0;
  border-radius: 13px;
  background: transparent;
}

.week-tab span { display: block; }

.week-tab-day {
  margin-bottom: 2px;
  font-size: 0.68rem;
  color: var(--muted);
}

.week-tab-date { font-weight: 800; }
.week-tab--today { color: white; background: var(--green); }
.week-tab--today .week-tab-day { color: white; }
.week-list { display: grid; gap: 12px; }

.day-card {
  width: 100%;
  min-height: 104px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 20px;
  text-align: left;
  background: var(--surface-strong);
  box-shadow: 0 7px 20px rgb(77 50 36 / 7%);
}

.day-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding-bottom: 9px;
  border-bottom: 1px dashed var(--line);
  font-weight: 800;
}

.edit-symbol { color: var(--accent); font-size: 1.15rem; }

.day-card-menu {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.day-card-menu--empty { color: #a2958e; }
.back-button { margin: -6px 0 12px -8px; }
.edit-heading { margin-bottom: 22px; }

.menu-form {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.input-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.toast {
  position: fixed;
  z-index: 30;
  right: 16px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  left: 16px;
  width: fit-content;
  max-width: calc(100% - 32px);
  margin-inline: auto;
  padding: 12px 18px;
  border-radius: 999px;
  color: white;
  background: #463731;
  box-shadow: var(--shadow);
  text-align: center;
}

@media (min-width: 600px) {
  .app-main { padding-inline: 24px; }
  .month-day { min-height: 108px; padding: 9px 7px; }
  .month-menu { font-size: 0.75rem; }
}

@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;
  }
}
