/* Canopy — simple UI: black on white, rainbow accents, emoji-led */

:root {
  --black: #111111;
  --white: #ffffff;
  --gray: #767676;
  --gray-light: #e8e8e8;
  --gray-bg: #f7f7f7;

  --red: #ff3b30;
  --orange: #ff9500;
  --yellow: #ffcc00;
  --green: #34c759;
  --teal: #00b3a4;
  --blue: #007aff;
  --purple: #af52de;
  --pink: #ff2d78;

  --radius: 16px;
  --radius-sm: 10px;
  --gap: 16px;
  --max-width: 480px;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  background: var(--white);
  color: var(--black);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}

#app {
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px 20px 40px;
  display: flex;
  flex-direction: column;
}

/* Typography */

h1 {
  font-size: 26px;
  font-weight: 800;
  margin: 0 0 8px;
  line-height: 1.2;
}

h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 4px;
}

p.subtitle {
  color: var(--gray);
  font-size: 15px;
  margin: 0 0 24px;
  line-height: 1.4;
}

.eyebrow {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray);
  margin: 0 0 6px;
}

/* Layout helpers */

.screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  animation: fadein 0.15s ease-out;
}

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

.spacer {
  flex: 1;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  min-height: 32px;
}

.back-btn {
  background: none;
  border: none;
  font-size: 16px;
  font-weight: 600;
  color: var(--black);
  padding: 4px 8px 4px 0;
  cursor: pointer;
}

.progress-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 4px 0 20px;
}

.progress-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gray-light);
}

.progress-dots span.active {
  background: var(--green);
}

/* Inputs */

label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin: 18px 0 6px;
}

label:first-of-type {
  margin-top: 0;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="time"] {
  width: 100%;
  font-size: 17px;
  padding: 14px 16px;
  border: 2px solid var(--gray-light);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--black);
  font-family: inherit;
}

input:focus {
  outline: none;
  border-color: var(--black);
}

/* Buttons */

.btn {
  display: block;
  width: 100%;
  font-size: 17px;
  font-weight: 700;
  padding: 16px 20px;
  border-radius: var(--radius);
  border: 2px solid var(--black);
  background: var(--white);
  color: var(--black);
  cursor: pointer;
  text-align: center;
  font-family: inherit;
}

.btn-primary {
  background: var(--black);
  color: var(--white);
}

.btn-primary:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-text {
  border: none;
  background: none;
  font-weight: 600;
  color: var(--gray);
  padding: 10px;
}

.btn-row {
  display: flex;
  gap: 10px;
}

.btn-row .btn {
  flex: 1;
}

/* Choice grid (day theme, mood, etc.) */

.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 4px 0 8px;
}

.choice-card {
  border: 2px solid var(--gray-light);
  border-radius: var(--radius);
  padding: 20px 12px;
  text-align: center;
  cursor: pointer;
  background: var(--white);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--black);
}

.choice-card .emoji {
  display: block;
  font-size: 32px;
  margin-bottom: 8px;
}

.choice-card.selected {
  border-color: var(--black);
  background: var(--gray-bg);
}

/* rainbow border accents, cycling by position */
.choice-card:nth-child(8n+1) { border-top: 5px solid var(--red); }
.choice-card:nth-child(8n+2) { border-top: 5px solid var(--orange); }
.choice-card:nth-child(8n+3) { border-top: 5px solid var(--yellow); }
.choice-card:nth-child(8n+4) { border-top: 5px solid var(--green); }
.choice-card:nth-child(8n+5) { border-top: 5px solid var(--teal); }
.choice-card:nth-child(8n+6) { border-top: 5px solid var(--blue); }
.choice-card:nth-child(8n+7) { border-top: 5px solid var(--purple); }
.choice-card:nth-child(8n+8) { border-top: 5px solid var(--pink); }

/* Mood row (single row of emoji) */

.mood-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 0 8px;
}

.mood-btn {
  flex: 1;
  border: 2px solid var(--gray-light);
  border-radius: var(--radius);
  background: var(--white);
  padding: 14px 4px;
  text-align: center;
  cursor: pointer;
  font-family: inherit;
}

.mood-btn .emoji {
  display: block;
  font-size: 28px;
  margin-bottom: 6px;
}

.mood-btn .label {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray);
}

.mood-btn.selected {
  border-color: var(--black);
  background: var(--gray-bg);
}

/* Yes/No */

.yesno-row {
  display: flex;
  gap: 12px;
  margin: 4px 0 8px;
}

.yesno-btn {
  flex: 1;
  padding: 22px 10px;
  border-radius: var(--radius);
  border: 2px solid var(--gray-light);
  background: var(--white);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
}

.yesno-btn.yes.selected {
  border-color: var(--green);
  background: #eafaf0;
  color: #1c8a3d;
}

.yesno-btn.no.selected {
  border-color: var(--gray);
  background: var(--gray-bg);
}

/* Purchase list */

.purchase-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2px solid var(--gray-light);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 10px;
}

.purchase-item .desc {
  flex: 1;
  font-weight: 600;
}

.purchase-item .amt {
  font-weight: 700;
  color: var(--teal);
}

.purchase-item .remove-btn {
  background: none;
  border: none;
  color: var(--red);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.purchase-form {
  border: 2px dashed var(--gray-light);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

/* Cards / summary */

.card {
  border: 2px solid var(--gray-light);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}

.card-emoji {
  font-size: 40px;
  margin-bottom: 10px;
  display: block;
}

.tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  margin: 0 6px 6px 0;
  color: var(--white);
}

.tag.red { background: var(--red); }
.tag.orange { background: var(--orange); }
.tag.yellow { background: var(--yellow); color: var(--black); }
.tag.green { background: var(--green); }
.tag.teal { background: var(--teal); }
.tag.blue { background: var(--blue); }
.tag.purple { background: var(--purple); }
.tag.pink { background: var(--pink); }

/* History list */

.history-entry {
  border: 2px solid var(--gray-light);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
}

.history-entry .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.history-entry .date {
  font-weight: 800;
  font-size: 15px;
}

.history-entry .meta {
  color: var(--gray);
  font-size: 13px;
  margin-top: 2px;
}

.history-entry .big-emoji {
  font-size: 26px;
}

.history-entry .detail {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 2px solid var(--gray-light);
  display: none;
}

.history-entry.expanded .detail {
  display: block;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray);
}

.empty-state .emoji {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
}

/* Bottom nav */

.bottom-nav {
  display: flex;
  border-top: 2px solid var(--gray-light);
  margin: 24px -20px -40px;
  padding: 10px 20px calc(10px + env(safe-area-inset-bottom));
}

.bottom-nav button {
  flex: 1;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--gray);
  padding: 8px;
  cursor: pointer;
}

.bottom-nav button .emoji {
  display: block;
  font-size: 22px;
  margin-bottom: 2px;
}

.bottom-nav button.active {
  color: var(--black);
}
