* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: #e7e8ec;
  color: #1d1d1f;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select,
input {
  font: inherit;
}

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, 430px);
  height: 100dvh;
  margin: 0 auto;
  background: #f6f7f9;
  overflow: hidden;
}

.screen {
  flex: 1;
  overflow: auto;
  padding: 16px 16px 12px;
}

.screen[hidden] {
  display: none;
}

.settings-screen {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.settings-body {
  flex: 1;
  overflow: auto;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.topbar h1 {
  margin: 0;
  font-size: 20px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 14px;
  border: none;
  border-radius: 999px;
  background: #e7e9ee;
  color: #3a4150;
  font-weight: 700;
  cursor: pointer;
}

.back {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: #fff;
  color: #1d1d1f;
}

.welcome-screen {
  display: flex;
  flex-direction: column;
  background: #fff;
}

.welcome-screen[hidden] {
  display: none;
}

.welcome-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
}

.welcome-badges {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.icon-btn svg {
  display: block;
  width: 100%;
  height: 100%;
}

.welcome-copy {
  margin-top: 28px;
  color: #4e5563;
  font-size: 16px;
  line-height: 1.45;
}

.welcome-copy p {
  margin: 0;
}

.welcome-copy .lead-line {
  margin-bottom: 18px;
}

.welcome-copy .indent {
  padding-left: 36px;
  margin-bottom: 6px;
}

.welcome-copy .nudge {
  max-width: 34ch;
  margin-top: 18px;
}

.welcome-action {
  position: relative;
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  min-height: 230px;
  margin-top: 8px;
}

.this-way {
  position: absolute;
  top: calc(50% - 112px);
  left: max(0px, calc(50% - 168px));
  width: 128px;
  pointer-events: none;
}

.this-way svg {
  display: block;
  width: 100%;
  height: auto;
}

.orb {
  width: 176px;
  height: 176px;
  border: none;
  border-radius: 50%;
  background: #8ed18a;
  color: #1c1c1c;
  font-size: 20px;
  font-weight: 750;
  line-height: 1.15;
  cursor: pointer;
}

.lead,
.field,
.hint,
.stats p,
.banner,
.next-day {
  margin: 0 0 16px;
}

.lead {
  color: #3f3f46;
  line-height: 1.4;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  border: none;
}

.label,
.field > span,
.field legend {
  font-weight: 650;
  padding: 0;
}

select,
input[type="time"] {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #d7dbe3;
  border-radius: 12px;
  background: #fff;
}

.time-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.time-row-full {
  grid-template-columns: 1fr;
}

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

.day {
  aspect-ratio: 1;
  border: 1px solid #d0d5dd;
  border-radius: 50%;
  background: #fff;
  color: #1d1d1f;
  padding: 0;
}

.day[aria-pressed="true"] {
  border-color: #74d39a;
  background: #74d39a;
  font-weight: 700;
}

.hint {
  color: #c43b55;
  font-size: 14px;
}

.hint[hidden] {
  display: none;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.button {
  min-height: 48px;
  border: none;
  border-radius: 14px;
  padding: 10px 12px;
  font-weight: 700;
}

.button.now,
.orb {
  cursor: pointer;
}

.button.now {
  background: #74d39a;
  color: #143224;
}

.actions .button.now,
.actions .button.schedule {
  background: #e4e6eb;
  color: #8a909b;
  cursor: pointer;
}

.actions .button.now.is-ready,
.actions .button.schedule.is-ready {
  background: #74d39a;
  color: #143224;
}

.actions .button.now:disabled,
.actions .button.schedule:disabled {
  cursor: default;
}

.button.danger {
  background: #f3a0ad;
  color: #5c1824;
}

.button.quiet {
  background: #e4e6eb;
  color: #2a2a2e;
}

.button.idle {
  background: #f3d3b0;
  color: #6a3d12;
}

.home-screen {
  background: #fff;
}

.home-screen[hidden] {
  display: none;
}

.home-stats {
  margin-top: 22px;
}

.home-stats p {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.35;
}

.lives-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hearts {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.hearts svg {
  width: 16px;
  height: 14px;
}

.reminder-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.alarm {
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  flex: none;
}

.alarm svg {
  display: block;
  width: 100%;
  height: 100%;
}

.banner {
  margin: 16px 0 20px;
  padding: 16px 18px;
  border-radius: 18px;
  background: #fde6d2;
  text-align: center;
  line-height: 1.35;
  font-size: 16px;
}

.today-label {
  margin: 0 0 4px;
  font-size: 16px;
}

.today-row {
  display: grid;
  grid-template-columns: 64px 1fr;
  align-items: start;
}

.calendar {
  width: 52px;
  margin-top: 8px;
}

.calendar svg,
.today-art svg {
  display: block;
  width: 100%;
  height: auto;
}

.today-focus {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.today-art {
  width: 108px;
}

.workout-art {
  width: 96px;
}

.home-screen.is-workout .rest-art,
.home-screen.is-rest .workout-art {
  display: none;
}

.checkin {
  position: relative;
  z-index: 1;
  margin-top: -14px;
  min-width: 138px;
  min-height: 46px;
  padding: 8px 18px;
  border: none;
  border-radius: 999px;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.15;
  cursor: pointer;
}

.today-photo {
  width: min(100%, 220px);
  max-height: 320px;
  object-fit: contain;
  border-radius: 18px;
  margin-bottom: 12px;
  background: #f3f4f6;
}

.home-screen.has-photo .today-art {
  display: none;
}

.home-screen.has-photo .checkin {
  margin-top: 0;
}

.photo-status {
  margin: 8px 0 0;
  color: #b42318;
  font-size: 14px;
  line-height: 1.3;
  text-align: center;
}

.photo-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.home-screen.is-workout .checkin {
  background: #b6e3a4;
  color: #1c1c1c;
}

.checkin:disabled {
  opacity: 0.7;
  cursor: default;
}

.home-screen.is-rest .checkin {
  min-width: 176px;
  background: #f6e4c4;
  color: #1c1c1c;
}

.next-day {
  margin-top: 22px;
  color: #1d1d1f;
}

.stub-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.stub-title {
  margin: 0;
  font-size: 28px;
  font-weight: 750;
}

.tabbar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 2px;
  flex: none;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid #e4e6eb;
  background: #fff;
}

.tabbar button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border: none;
  background: transparent;
  color: #3a4150;
  font-size: 10px;
  line-height: 1.15;
  padding: 2px 0;
  cursor: pointer;
}

.tab-icon {
  width: 30px;
  height: 28px;
}

.tab-label {
  max-width: 64px;
  text-align: center;
}

.tabbar button[aria-current="page"] {
  color: #17663a;
  font-weight: 700;
}

.modal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 22, 28, 0.4);
}

.modal[hidden] {
  display: none;
}

.dialog {
  width: min(100%, 320px);
  padding: 20px;
  border-radius: 18px;
  background: #fff;
}

.dialog p {
  margin: 0 0 16px;
  line-height: 1.4;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.home-screen.is-done .banner {
  background: #d9f5e4;
}

.home-screen.is-done .today-focus {
  display: none;
}

.home-screen.is-done .photo-slot {
  display: block;
}

.calendar {
  position: relative;
}

.done-badge {
  display: none;
  position: absolute;
  left: 4px;
  right: 4px;
  top: 24px;
  align-items: center;
  justify-content: center;
  gap: 1px;
  color: #17663a;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.done-badge svg {
  width: 18px;
  height: 18px;
}

.home-screen.is-done .done-badge {
  display: flex;
  flex-direction: column;
}

.home-screen.has-photo .today-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
}

.home-screen.has-photo .calendar {
  width: clamp(112px, 42%, 156px);
  margin-top: 0;
  flex: none;
}

.home-screen.has-photo .done-badge {
  top: 62%;
  left: 8px;
  right: 8px;
  font-size: 16px;
  transform: translateY(-50%);
}

.home-screen.has-photo .done-badge svg {
  width: 28px;
  height: 28px;
}

.home-screen.has-photo .today-side {
  margin-left: auto;
  flex: none;
}

.today-side {
  min-width: 0;
}

.photo-slot {
  display: none;
  position: relative;
  width: 148px;
  min-height: 132px;
}

.photo-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 112px;
  height: 112px;
  border: 1px dashed #b7c3d6;
  border-radius: 16px;
  background: #f4f7fb;
  color: #3a4150;
  font-weight: 700;
  cursor: pointer;
}

.photo-empty[hidden],
.photo-refresh[hidden] {
  display: none;
}

.photo-empty svg {
  width: 42px;
  height: 42px;
}

.photo-slot .today-photo {
  display: block;
  width: 140px;
  height: 168px;
  max-height: none;
  margin: 0;
  object-fit: cover;
  object-position: top;
  border-radius: 14px;
}

.photo-slot .today-photo[hidden] {
  display: none;
}

.photo-refresh {
  position: absolute;
  top: 6px;
  right: 14px;
  width: 28px;
  height: 28px;
  padding: 4px;
  border: none;
  border-radius: 8px;
  background: #2f6bff;
  cursor: pointer;
}

.photo-refresh svg,
.square-action svg {
  display: block;
  width: 100%;
  height: 100%;
}

.checkin-screen,
.engraving-screen,
.ready-screen {
  display: flex;
  flex-direction: column;
  background: #fff;
}

.checkin-screen[hidden],
.engraving-screen[hidden],
.ready-screen[hidden] {
  display: none;
}

.checkin-art {
  width: 96px;
  margin: 18px auto 8px;
}

.checkin-art svg,
.mood svg {
  display: block;
  width: 100%;
  height: auto;
}

.mood {
  width: 112px;
  margin: 12px auto 4px;
}

.checkin-copy {
  margin: 8px 0 16px;
  text-align: center;
  line-height: 1.35;
}

.checkin-label {
  margin: 0 0 8px;
  font-weight: 700;
}

.picks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.pick {
  min-height: 36px;
  padding: 6px 14px;
  border: none;
  border-radius: 999px;
  background: #f8d3de;
  color: #7a2430;
  font-weight: 700;
  cursor: pointer;
}

.pick[aria-pressed="true"] {
  background: #74d39a;
  color: #143224;
}

.mood-input {
  width: 100%;
  min-height: 48px;
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid #d0d5dd;
  border-radius: 14px;
  background: #fff;
  color: #1d1d1f;
}

.checkin-actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 8px;
  margin-top: auto;
}

.button.soft,
.button.pink {
  cursor: pointer;
}

.button.soft {
  background: #f8d3de;
  color: #7a2430;
}

.button.pink {
  background: #74d39a;
  color: #143224;
}

.button.soft:disabled,
.button.pink:disabled {
  opacity: 0.7;
  cursor: default;
}

.frame {
  position: relative;
  width: min(100%, 240px);
  margin: 0 auto;
}

.frame img:not([src]),
.ready-photo:not([src]) {
  display: none;
}

.frame img {
  display: block;
  width: min(100%, 240px);
  max-height: 320px;
  margin: 0 auto;
  object-fit: contain;
  border-radius: 12px;
  background: #111;
}

.tbd {
  position: absolute;
  left: 50%;
  top: 42%;
  color: #fff;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.65);
  transform: translate(-50%, -50%);
}

.ready-screen {
  min-height: 0;
  overflow: hidden;
}

.ready-screen .mood {
  width: 72px;
  margin: 0 auto;
  flex: none;
}

.ready-screen .checkin-copy {
  margin: 6px 0 8px;
  flex: none;
}

.ready-frame {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.ready-frame .ready-photo {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: contain;
  border-radius: 12px;
  background: transparent;
}

.ready-frame .ready-photo:not([src]) {
  display: none;
}

.ready-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.ready-top .welcome-badges {
  margin-left: auto;
}

.photo-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
  flex: none;
}

.square-action {
  width: 42px;
  height: 42px;
  padding: 9px;
  border: none;
  border-radius: 10px;
  background: #2f6bff;
  cursor: pointer;
}

.square-action:disabled {
  opacity: 0.5;
  cursor: default;
}
