:root {
  color-scheme: light;
  --bg: #f6ebdc;
  --ink: #2b2118;
  --ink-soft: #4a3d31;
  --muted: #7a6a5a;
  --card: #fdf5ea;
  --soft: #f1e2cf;
  --sage: #cfdccb;
  --sage-deep: #a9bfa4;
  --peach: #f4d6b8;
  --edge: 4px solid var(--sage-deep);
  --line: rgba(74, 61, 49, 0.12);
  --shadow: 0 10px 28px rgba(90, 64, 34, 0.09);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  position: relative;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Noto Sans", "Segoe UI", sans-serif;
  font-size: 21px;
  line-height: 1.4;
}

.portal {
  padding: 24px 40px 8px;
}

.portal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.portal-nav { margin-top: 16px; }

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

.portal-title h1 {
  margin: 0;
  font-family: "Noto Serif", "Liberation Serif", Georgia, serif;
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.portal-icon {
  width: 52px;
  height: 52px;
  display: block;
  padding: 0;
  border: 0;
  outline: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.stamp { text-align: right; }

.clock {
  margin: 0;
  font-size: 44px;
  font-weight: 750;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.date {
  margin: 0;
  font-size: 22px;
  font-weight: 650;
  color: var(--ink-soft);
}

.modes {
  display: flex;
  gap: 12px;
  align-items: center;
}

.modes button {
  border: 3px solid var(--sage-deep);
  background: var(--soft);
  color: var(--ink);
  border-radius: 999px;
  padding: 14px 26px;
  font: inherit;
  font-size: 20px;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(90, 64, 34, 0.08);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.modes button.is-on {
  background: #1a1a1a;
  color: #fff;
  box-shadow: none;
  border-color: #1a1a1a;
}

.back {
  display: inline-flex;
  align-items: center;
  min-height: 64px;
  background: var(--card);
  color: var(--ink);
  border: var(--edge);
  border-radius: 999px;
  padding: 10px 34px;
  font-size: 24px;
  font-weight: 750;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(90, 64, 34, 0.08);
}

.home {
  max-width: 1000px;
  margin: 0 auto;
  padding: 16px 40px 32px;
}

.greeting {
  margin: 0 0 32px;
  font-family: "Noto Serif", "Liberation Serif", Georgia, serif;
  font-size: 56px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.big-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.big-btn {
  display: grid;
  place-items: center;
  grid-auto-flow: row;
  align-content: center;
  justify-items: center;
  gap: 12px;
  min-height: 190px;
  border: var(--edge);
  border-radius: 28px;
  color: var(--ink);
  font: inherit;
  font-size: 36px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.big-btn.tone-peach { background: var(--peach); }
.big-btn.tone-sage { background: var(--sage); }
.big-btn.tone-card { background: var(--card); }

.tile-icon {
  width: 64px;
  height: 64px;
  border: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
}

.home-status { margin: 24px 0 0; }

.dose-list {
  max-width: 900px;
  margin: 8px auto 32px;
  padding: 0 40px;
}

.dose {
  margin: 0 0 22px;
  padding: 14px 18px 8px;
  border: var(--edge);
  border-radius: 28px;
  background: var(--sage);
  box-shadow: var(--shadow);
}

.dose-head {
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
  min-height: 80px;
  margin: 0 0 6px;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.dose-head:disabled { opacity: 0.7; }

.dose-head h2 {
  flex: 1;
  margin: 0;
  font-size: 34px;
  font-weight: 750;
}

.dose-mark {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink-soft);
}

.pill-box {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: var(--edge);
  border-radius: 16px;
  background: var(--bg);
  color: transparent;
}

.pill-box svg { width: 40px; height: 40px; }

.dose.is-checked .pill-box {
  background: var(--sage-deep);
  color: var(--ink);
}

.med-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 1.4fr auto;
  align-items: center;
  gap: 16px;
  min-height: 72px;
  margin: 0 0 12px;
  padding: 12px 22px;
  border: 3px solid var(--sage-deep);
  border-radius: 20px;
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
}

.med-name {
  font-size: 28px;
  font-weight: 750;
}

.med-purpose {
  font-size: 21px;
  font-weight: 600;
  color: var(--ink-soft);
}

.med-qty {
  font-size: 24px;
  font-weight: 750;
  white-space: nowrap;
}

.detail {
  max-width: 900px;
  margin: 8px auto 32px;
  padding: 0 40px;
}

.detail-name {
  margin: 8px 0 0;
  font-size: 56px;
  font-weight: 750;
  line-height: 1.1;
}

.detail-purpose {
  margin: 4px 0 20px;
  font-size: 26px;
  color: var(--ink-soft);
}

.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px 32px;
  margin: 0 0 24px;
  padding: 26px 30px;
  border: var(--edge);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.fact dt {
  font-size: 22px;
  color: var(--ink-soft);
}

.fact dd {
  margin: 0;
  font-size: 30px;
  font-weight: 750;
}

.detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 96px;
  border: var(--edge);
  border-radius: 24px;
  background: var(--peach);
  color: var(--ink);
  font: inherit;
  font-size: 30px;
  font-weight: 750;
  text-decoration: none;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.action-icon {
  width: 38px;
  height: 38px;
  color: var(--ink-soft);
}

.notes {
  margin: 24px 0 0;
  padding: 22px 26px;
  border: var(--edge);
  border-radius: 24px;
  background: var(--card);
}

.note-text {
  margin: 0 0 14px;
  font-size: 26px;
  line-height: 1.4;
}

.note-image {
  display: block;
  max-width: 100%;
  margin: 0 0 14px;
  border-radius: 16px;
  border: 3px solid var(--sage-deep);
}

.mode-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.board {
  position: relative;
  margin: 4px 8px 56px;
}

.scroller {
  position: relative;
  display: flex;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  margin: 0 84px;
  padding-bottom: 24px;
  outline: none;
}

.scroller::-webkit-scrollbar { display: none; }

.day {
  flex: 0 0 410px;
  min-height: 68vh;
  padding: 0 14px 8px;
  border-left: 1px solid var(--line);
}

.day:first-child { border-left: 0; }

.chip {
  background: var(--sage);
  border-radius: 24px;
  text-align: center;
  padding: 16px 8px 14px;
  margin: 6px 6px 20px;
  box-shadow: var(--shadow);
}

.chip .dow {
  margin: 0;
  font-size: 18px;
  font-weight: 750;
  letter-spacing: 0.14em;
}

.chip .num {
  margin: 0;
  font-family: "Noto Serif", Georgia, serif;
  font-size: 52px;
  line-height: 1.05;
  font-weight: 600;
}

.chip .mon {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink-soft);
}

.card {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 6px 18px;
  align-items: start;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 6px solid var(--sage-deep);
  border-radius: 20px;
  padding: 18px 18px 20px 16px;
  margin: 0 4px 16px;
  box-shadow: var(--shadow);
}

.card:has(.logo[hidden]) {
  grid-template-columns: 1fr;
}

.logo {
  width: 76px;
  height: 76px;
  border-radius: 18px;
  object-fit: cover;
  background: var(--sage);
  grid-row: 1 / span 3;
}

.logo[hidden] { display: none; }

.when {
  margin: 0;
  font-size: 21px;
  font-weight: 750;
  color: var(--ink-soft);
}

.card h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.25;
  font-weight: 750;
}

.card h2 a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.where {
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-size: 21px;
  font-weight: 650;
  line-height: 1.35;
}

.arrow {
  position: absolute;
  top: 40px;
  z-index: 2;
  width: 68px;
  height: 68px;
  border: var(--edge);
  border-radius: 50%;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(90, 64, 34, 0.14);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}

.arrow svg { width: 38px; height: 38px; stroke-width: 2.6; }
.arrow.prev { left: 4px; }
.arrow.next { right: 4px; }

.example-flag {
  margin: 0;
  font-style: italic;
  color: var(--muted);
  font-size: 18px;
}

.status {
  margin: 0 40px 24px;
  color: var(--ink-soft);
  min-height: 1.2em;
}

@media (prefers-reduced-motion: reduce) {
  .scroller { scroll-behavior: auto; }
}

@media (max-width: 720px) {
  body { font-size: 18px; }
  .portal { padding: 16px 16px 8px; }
  .portal-title h1 { font-size: 30px; }
  .portal-icon { width: 42px; height: 42px; padding: 0; }
  .clock { font-size: 32px; }
  .date { font-size: 16px; }
  .modes button { padding: 10px 18px; font-size: 16px; }
  .day { flex-basis: 290px; }
  .scroller { margin: 0 56px; }
  .chip .num { font-size: 44px; }
  .card { grid-template-columns: 60px 1fr; gap: 4px 14px; }
  .logo { width: 60px; height: 60px; }
  .when, .where { font-size: 18px; }
  .card h2 { font-size: 23px; }
  .arrow { width: 52px; height: 52px; }
  .arrow svg { width: 28px; height: 28px; }
  .status { margin: 0 16px 24px; }
  .back { min-height: 52px; padding: 8px 22px; font-size: 18px; }
  .tile-icon { width: 48px; height: 48px; }
  .home { padding: 24px 16px; }
  .greeting { font-size: 40px; margin-bottom: 20px; }
  .big-grid { gap: 14px; }
  .big-btn { min-height: 120px; font-size: 26px; border-radius: 22px; }
  .dose-list, .detail { padding: 0 16px; }
  .dose { padding: 10px 12px 4px; border-radius: 22px; }
  .dose-head h2 { font-size: 26px; }
  .dose-mark { font-size: 18px; }
  .pill-box { width: 52px; height: 52px; }
  .med-row { grid-template-columns: 1fr auto; padding: 10px 14px; }
  .med-purpose { grid-column: 1 / -1; grid-row: 2; font-size: 18px; }
  .med-name { font-size: 22px; }
  .med-qty { font-size: 20px; }
  .detail-name { font-size: 40px; }
  .detail-purpose { font-size: 20px; }
  .facts { gap: 16px 18px; padding: 18px; }
  .fact dt { font-size: 17px; }
  .fact dd { font-size: 22px; }
  .detail-actions { grid-template-columns: 1fr; }
  .action { min-height: 80px; font-size: 24px; }
}
