:root {
  color-scheme: light;
  --ink: #1d2524;
  --muted: #68736f;
  --line: #d9e1dd;
  --panel: rgba(255, 255, 255, 0.9);
  --accent: #2f7d6b;
  --accent-dark: #1f5d50;
  --soft: #edf4f0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html.desktop,
html.desktop body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: transparent;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: #e8eeea;
}

button { border: 0; font: inherit; cursor: pointer; }

.daily-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
}

.topbar h1, .stage-toolbar h2, .section-heading h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 { font-size: 28px; }

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 780;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar nav { display: flex; gap: 8px; }

.topbar a {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 12px;
  color: var(--accent-dark);
  background: rgba(255,255,255,.72);
  font-size: 13px;
  font-weight: 720;
  text-decoration: none;
}

.experience {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
}

.stage-column { display: grid; gap: 12px; min-width: 0; }

.stage-toolbar, .routine-panel, .now-strip, .state-actions {
  border: 1px solid rgba(255,255,255,.78);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 16px 42px rgba(45, 60, 56, 0.11);
}

.stage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 17px;
}

.stage-toolbar h2 { font-size: 21px; }

.clock-block { display: grid; justify-items: end; }
.clock-block span { color: var(--muted); font-size: 11px; font-weight: 720; }
.clock-block strong { font-size: 25px; font-variant-numeric: tabular-nums; }

.stage {
  position: relative;
  position: relative;
  display: grid;
  place-items: end center;
  overflow: hidden;
  min-height: 610px;
  border: 1px solid rgba(60,70,66,.16);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255,255,255,.36) 0 4px, transparent 4px 100%),
    linear-gradient(180deg, transparent 0 60%, rgba(140,97,66,.2) 60% 100%),
    linear-gradient(145deg, #d8b38b 0%, #f0d8b8 42%, #9fc3b8 43%, #e6eee5 100%);
  background-size: 42px 42px, 100% 100%, 100% 100%;
  box-shadow: 0 24px 70px rgba(44,56,52,.2);
}

.wake-prompt {
  position: absolute;
  z-index: 4;
  top: 6px;
  left: 50%;
  width: max-content;
  max-width: calc(100% - 12px);
  transform: translateX(-50%);
  padding: 7px 9px;
  border: 1px solid rgba(39, 48, 46, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 3px 12px rgba(25, 34, 32, 0.18);
  color: #26302e;
  font: 12px/1.35 -apple-system, BlinkMacSystemFont, sans-serif;
  text-align: center;
}

.wake-prompt[hidden] { display: none; }

.wake-prompt div { margin-top: 5px; }

.wake-prompt button {
  min-width: 34px;
  margin: 0 3px;
  padding: 2px 8px;
  border: 1px solid rgba(39, 48, 46, 0.22);
  border-radius: 5px;
  background: #fff;
  color: #26302e;
  cursor: pointer;
}

.stage::before {
  position: absolute;
  right: 7%;
  bottom: 31%;
  width: 24%;
  height: 30%;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(90deg, rgba(255,255,255,.45) 0 48%, transparent 48% 52%, rgba(255,255,255,.45) 52%), #547d73;
  box-shadow: 0 18px 0 #9a6947;
  content: "";
}

#dailyCanvas,
.pet-placeholder {
  position: relative;
  z-index: 1;
  width: min(72vh, 72vw, 720px);
  max-width: 100%;
  aspect-ratio: 1;
}

.pet-placeholder {
  position: absolute;
  bottom: 0;
  object-fit: contain;
  transition: opacity 180ms ease;
}

.pet-placeholder.hidden { opacity: 0; }

#dailyCanvas { z-index: 2; }

.loading-state {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  color: rgba(29,37,36,.72);
  font-size: 12px;
  font-weight: 720;
  white-space: nowrap;
}

.loading-state.hidden { display: none; }

.state-actions {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 12px;
}

.state-actions button {
  min-width: 118px;
  min-height: 38px;
  border-radius: 6px;
  padding: 0 14px;
  color: white;
  background: var(--accent);
  font-size: 13px;
  font-weight: 760;
}

.state-actions button:hover { background: var(--accent-dark); }
.state-actions button:disabled { cursor: wait; opacity: .48; }

.desktop .daily-shell,
.desktop .experience,
.desktop .stage-column,
.desktop .stage {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.desktop .daily-shell { margin: 0; padding: 0; }
.desktop .experience,
.desktop .stage-column { display: block; }
.desktop .topbar,
.desktop .stage-toolbar,
.desktop .now-strip,
.desktop .routine-panel,
.desktop .state-actions,
.desktop .loading-state { display: none; }

.desktop .stage {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.desktop .stage::before { display: none; }

.desktop #dailyCanvas,
.desktop .pet-placeholder {
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
}

.now-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
}

.now-strip > div { padding: 13px 15px; border-left: 1px solid var(--line); }
.now-strip > div:first-child { border-left: 0; }
.now-strip span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; font-weight: 720; }
.now-strip strong { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }

.routine-panel { align-self: start; overflow: hidden; }
.control-section, .schedule-section, .log-section { padding: 17px; }
.schedule-section, .log-section { border-top: 1px solid var(--line); }

.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-heading h2 { font-size: 14px; }
.section-heading > span { color: var(--muted); font-size: 11px; font-weight: 680; }

.text-button { padding: 4px; color: var(--accent-dark); background: transparent; font-size: 12px; font-weight: 760; }

.speed-control { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.speed-control button, .restart-button { min-height: 40px; border-radius: 6px; background: #eef2ef; color: var(--muted); font-size: 12px; font-weight: 740; }
.speed-control button.active { background: var(--accent); color: white; }
.restart-button { width: 100%; margin-top: 8px; color: var(--ink); }

.timeline, .activity-log { margin: 0; padding: 0; list-style: none; }
.timeline { display: grid; }
.timeline li {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 10px;
  align-items: start;
  border-left: 2px solid var(--line);
  padding: 0 0 17px 13px;
}
.timeline li:last-child { padding-bottom: 0; }
.timeline li.current { border-left-color: var(--accent); }
.timeline time { color: var(--muted); font-size: 11px; font-weight: 720; font-variant-numeric: tabular-nums; }
.timeline div { display: grid; gap: 2px; }
.timeline strong { font-size: 13px; }
.timeline span, .timeline small { color: var(--muted); font-size: 11px; }

.activity-log { display: grid; gap: 8px; min-height: 128px; }
.activity-log li { display: grid; grid-template-columns: 44px 1fr; gap: 8px; color: var(--muted); font-size: 12px; }
.activity-log time { color: var(--accent-dark); font-weight: 760; font-variant-numeric: tabular-nums; }

@media (max-width: 980px) {
  .experience { grid-template-columns: 1fr; }
  .routine-panel { display: grid; grid-template-columns: 1fr 1fr; }
  .control-section { grid-column: 1 / -1; }
  .log-section { border-left: 1px solid var(--line); }
}

@media (max-width: 680px) {
  .daily-shell { padding: 11px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar h1 { font-size: 23px; }
  .stage { min-height: 430px; }
  .stage-toolbar { align-items: flex-start; }
  .stage-toolbar h2 { font-size: 17px; }
  .now-strip { grid-template-columns: 1fr; }
  .now-strip > div { border-top: 1px solid var(--line); border-left: 0; }
  .now-strip > div:first-child { border-top: 0; }
  .routine-panel { grid-template-columns: 1fr; }
  .control-section { grid-column: auto; }
  .log-section { border-left: 0; }
}
