@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&display=swap');

:root {
  --bg-deep: #0d0f14;
  --bg-card: #13161d;
  --bg-elevated: #1a1e27;
  --bg-input: #0f1218;
  --bg-box: #181c24;

  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-medium: rgba(255, 255, 255, 0.12);

  --text-primary: #f4f1ed;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;

  /* Priority colors */
  --p1: #f59e0b;
  --p1-soft: rgba(245, 158, 11, 0.12);
  --p1-border: rgba(245, 158, 11, 0.25);

  --p2: #38bdf8;
  --p2-soft: rgba(56, 189, 248, 0.12);
  --p2-border: rgba(56, 189, 248, 0.25);

  --p3: #34d399;
  --p3-soft: rgba(52, 211, 153, 0.12);
  --p3-border: rgba(52, 211, 153, 0.25);

  /* Stabilize/calm mode */
  --calm: #a78bfa;
  --calm-soft: rgba(167, 139, 250, 0.1);
  --calm-border: rgba(167, 139, 250, 0.2);

  --success: #22c55e;
  --rose: #f43f5e;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 24px 16px 80px;
  min-height: 100vh;
}

@media (min-width: 640px) {
  .wrap {
    padding: 32px 24px 80px;
  }
}

/* ============ HEADER ============ */
.header {
  text-align: center;
  margin-bottom: 32px;
}

.header h1 {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.sub {
  margin: 0;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.5;
}

/* ============ INPUT CARD ============ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 20px;
  margin-bottom: 20px;
}

.label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 10px;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

textarea {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-medium);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  outline: none;
  resize: vertical;
  min-height: 140px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea:focus {
  border-color: var(--p1);
  box-shadow: 0 0 0 3px var(--p1-soft);
}

textarea::placeholder {
  color: var(--text-muted);
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
  flex-wrap: wrap;
}

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--p1);
  color: #000;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn.secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
}

.btn.secondary:hover {
  background: var(--bg-box);
  border-color: var(--text-muted);
}

.btn svg {
  width: 16px;
  height: 16px;
}

.status {
  color: var(--text-muted);
  font-size: 14px;
}

.hidden {
  display: none !important;
}

/* ============ OUTPUT SECTION ============ */
#output {
  animation: fadeIn 0.3s ease-out;
}

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

/* ============ OUTPUT HEADER ============ */
.outputHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.outputTitle {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.3;
}

.outputSubtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.copyBtn {
  padding: 8px 14px;
  font-size: 13px;
  white-space: nowrap;
}

.copyBtn.copied {
  background: var(--success);
}

/* ============ BANNER (minimal, ADHD friendly) ============ */
.banner {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.banner ul {
  margin: 0;
  padding: 0 0 0 18px;
}

.banner li {
  margin: 4px 0;
}

/* ============ TASK CARDS ============ */
.taskGrid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.taskCard {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  animation: cardIn 0.35s ease-out backwards;
}

.taskCard:nth-child(1) { animation-delay: 0.05s; }
.taskCard:nth-child(2) { animation-delay: 0.12s; }
.taskCard:nth-child(3) { animation-delay: 0.19s; }

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

/* Priority accent bars */
.taskCard[data-priority="1"] { border-left: 4px solid var(--p1); }
.taskCard[data-priority="2"] { border-left: 4px solid var(--p2); }
.taskCard[data-priority="3"] { border-left: 4px solid var(--p3); }

/* Stabilize/calm mode cards */
.taskCard.calm { border-left: 4px solid var(--calm); }

/* ============ TASK HEADER ============ */
.taskTop {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
}

.taskMeta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.priorityBadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
}

.taskCard[data-priority="1"] .priorityBadge {
  background: var(--p1-soft);
  color: var(--p1);
  border: 2px solid var(--p1-border);
}

.taskCard[data-priority="2"] .priorityBadge {
  background: var(--p2-soft);
  color: var(--p2);
  border: 2px solid var(--p2-border);
}

.taskCard[data-priority="3"] .priorityBadge {
  background: var(--p3-soft);
  color: var(--p3);
  border: 2px solid var(--p3-border);
}

.taskCard.calm .priorityBadge {
  background: var(--calm-soft);
  color: var(--calm);
  border: 2px solid var(--calm-border);
}

.contextChip {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 5px 10px;
  border-radius: 20px;
  background: var(--bg-box);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.minutesPill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 20px;
  background: var(--p1-soft);
  color: var(--p1);
}

.taskCard[data-priority="2"] .minutesPill {
  background: var(--p2-soft);
  color: var(--p2);
}

.taskCard[data-priority="3"] .minutesPill {
  background: var(--p3-soft);
  color: var(--p3);
}

.taskCard.calm .minutesPill {
  background: var(--calm-soft);
  color: var(--calm);
}

.minutesPill svg {
  width: 12px;
  height: 12px;
}

.editToggle {
  font-size: 12px;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid var(--border-medium);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.editToggle:hover {
  background: var(--bg-box);
  color: var(--text-secondary);
}

.editToggle.active {
  background: var(--p1-soft);
  border-color: var(--p1-border);
  color: var(--p1);
}

/* Task action buttons container */
.taskActions {
  display: flex;
  gap: 6px;
}

/* Details toggle button */
.detailsToggle {
  font-size: 12px;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid var(--border-medium);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.detailsToggle:hover {
  background: var(--bg-box);
  color: var(--text-secondary);
}

.detailsToggle.active {
  background: var(--bg-box);
  border-color: var(--text-muted);
  color: var(--text-secondary);
}

/* Collapsible details section */
.taskDetails {
  display: none;
  margin-top: 12px;
}

.taskCard.expanded .taskDetails {
  display: block;
  animation: fadeIn 0.2s ease-out;
}

/* ============ TASK BODY ============ */
.taskBody {
  padding: 16px;
}

.taskTitle {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 16px 0;
  line-height: 1.35;
}

/* ============ INFO BOXES ============ */
.infoBox {
  background: var(--bg-box);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 12px;
}

.infoBox:last-child {
  margin-bottom: 0;
}

.infoLabel {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.infoLabel svg {
  width: 14px;
  height: 14px;
  opacity: 0.7;
}

/* Different box types */
.infoBox.start .infoLabel { color: var(--p1); }
.infoBox.pause .infoLabel { color: var(--p2); }
.infoBox.next .infoLabel { color: var(--p3); }

.taskCard.calm .infoBox.start .infoLabel,
.taskCard.calm .infoBox.pause .infoLabel,
.taskCard.calm .infoBox.next .infoLabel {
  color: var(--calm);
}

.infoContent {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ADHD-friendly: break long text into scannable chunks */
.infoContent ul {
  margin: 0;
  padding: 0 0 0 16px;
}

.infoContent li {
  margin: 4px 0;
}

/* ============ EDIT MODE ============ */
.editFields {
  display: none;
}

.taskCard.editing .editFields {
  display: block;
}

.taskCard.editing .readOnlyFields {
  display: none;
}

.editField {
  margin-bottom: 12px;
}

.editField:last-child {
  margin-bottom: 0;
}

.editField label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.editField input,
.editField textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-medium);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

.editField input:focus,
.editField textarea:focus {
  border-color: var(--p1);
}

.editField textarea {
  min-height: 60px;
  resize: vertical;
}

/* ============ PARKING LOT ============ */
.parking {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
  animation: fadeIn 0.3s ease-out 0.25s backwards;
}

.parkingHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}

.parkingTitle {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.parkingTitle svg {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.parkingReassurance {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

.parkingCounts {
  display: flex;
  gap: 8px;
}

.countPill {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

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

@media (max-width: 540px) {
  .columns {
    grid-template-columns: 1fr;
  }
}

.listBox {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
}

.listBoxTitle {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.listBox ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.listBox li {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.4;
}

.listBox li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.listBox li::before {
  content: '•';
  color: var(--text-muted);
  font-size: 10px;
  margin-top: 3px;
  flex-shrink: 0;
}

.emptyNote {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

/* ============ ASSUMPTIONS ============ */
.assumptions {
  margin-top: 16px;
  animation: fadeIn 0.3s ease-out 0.3s backwards;
}

/* ============ SAFETY BOX ============ */
.safetyBox {
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.2);
  border-left: 4px solid var(--rose);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}

.safetyTitle {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--rose);
  margin: 0 0 10px 0;
}

.safetyContent {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.safetyContent a {
  color: var(--rose);
}

/* ============ REFINE BOX ============ */
.refine {
  margin-top: 20px;
  animation: fadeIn 0.3s ease-out 0.35s backwards;
}

.refineBox {
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.refineTitle {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 6px 0;
}

.refineQuestion {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 12px 0;
}

.refineRow {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.refineBtn {
  font-size: 13px;
  padding: 8px 14px;
}

.refineNote {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 10px;
}

/* ============ FOOTER ============ */
.footer {
  margin-top: 40px;
  text-align: center;
}

.footer .tiny {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ============ STABILIZE/CALM MODE ============ */
#output.calmMode .outputTitle {
  color: var(--calm);
}

#output.calmMode .banner {
  background: var(--calm-soft);
  border-color: var(--calm-border);
}

#output.calmMode .copyBtn {
  background: var(--calm);
}

/* ============ LOADING PULSE ============ */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.status:not(:empty) {
  animation: pulse 1.2s ease-in-out infinite;
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--bg-elevated);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-medium);
}

/* ============ FOCUS VISIBLE ============ */
:focus-visible {
  outline: 2px solid var(--p1);
  outline-offset: 2px;
}

button:focus:not(:focus-visible) {
  outline: none;
}
