/* Demo embed: variables for #demo and fullscreen overlay */
#demo,
.fullscreen-overlay {
  --green: #3A5C47;
  --green-mid: #4E7A5F;
  --green-dark: #253C2E;
  --green-light: #EAF0EB;
  --peach: #EDB88B;
  --peach-light: #FBF3EA;
  --peach-deep: #C8843A;
  --raspberry: #993955;
  --raspberry-light: #F7EAEE;
  --olive: #788A0B;
  --olive-light: #F2F4DC;
  --bg: #FAF8F3;
  --surface: #F0EBE0;
  --surface2: #E4DDD0;
  --white: #FFFFFF;
  --text: #1C1A18;
  --text-soft: #52504A;
  --text-muted: #8A8678;
  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;

  --forest: #2F543B;
  --forest-light: #3d6b4a;
  --forest-pale: #e8f0ea;
  --peach-lp: #EDB082;
  --off-white: #FAF8F5;
  --warm-white: #FFFDF9;
  --text-dark-lp: #1a1a18;
  --text-mid-lp: #4a4a44;
  --text-light-lp: #8a8a82;
  --border-lp: #e8e4dc;
}

/* Phone and screen styles scoped to #demo */
    /* ───── PHONE CONTAINER ───── */
    #demo .phone-wrapper {
      display: flex;
      justify-content: center;
      padding: 0 20px 60px;
    }

    #demo .phone-frame {
      background: white;
      border-radius: 36px;
      box-shadow:
        0 0 0 1px rgba(0,0,0,0.06),
        0 8px 40px rgba(28,26,24,0.12),
        0 2px 8px rgba(28,26,24,0.06);
      overflow: hidden;
      width: 375px;
      height: 720px;
      display: flex;
      flex-direction: column;
      position: relative;
      flex-shrink: 0;
    }

    @media (max-width: 420px) {
      #demo .phone-frame {
        width: 100%;
        max-width: 375px;
        height: 680px;
        border-radius: 28px;
      }
    }

    /* ───── STATUS BAR ───── */
    #demo .status-bar {
      padding: 12px 20px 6px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      background: white;
      flex-shrink: 0;
    }

    #demo .time {
      font-size: 13px;
      font-weight: 600;
      color: var(--text);
    }

    #demo .status-icons {
      display: flex;
      align-items: center;
      gap: 5px;
    }

    #demo .battery {
      width: 20px;
      height: 11px;
      border-radius: 2.5px;
      border: 1.5px solid var(--text);
      position: relative;
    }
    #demo .battery::before {
      content: '';
      position: absolute;
      top: 2px; left: 2px; right: 2px; bottom: 2px;
      background: var(--text);
      border-radius: 1px;
    }
    #demo .battery::after {
      content: '';
      position: absolute;
      top: 2.5px; right: -4px;
      width: 2px; height: 5px;
      background: var(--text);
      border-radius: 0 1px 1px 0;
    }

    /* ───── SCREEN HEADER ───── */
    #demo .screen-header {
      padding: 6px 20px 12px;
      border-bottom: 1px solid var(--surface);
      background: white;
      flex-shrink: 0;
    }

    #demo .header-with-back {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    #demo .back-btn {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      background: var(--surface);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
      color: var(--text);
      cursor: pointer;
      border: none;
      transition: background 0.15s;
      flex-shrink: 0;
    }
    .back-btn:hover { background: var(--surface2); }

    #demo .screen-title {
      font-family: var(--serif);
      font-size: 19px;
      font-weight: 700;
      color: var(--text);
    }

    #demo .screen-subtitle {
      font-size: 11px;
      color: var(--green-mid);
      font-weight: 500;
      margin-top: 1px;
    }

    /* ───── SCREEN CONTENT ───── */
    #demo .screen-content {
      flex: 1;
      padding: 18px;
      background: var(--bg);
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }

    .screen-content::-webkit-scrollbar { width: 0; }

    /* ───── BOTTOM NAV ───── */
    #demo .nav-bar {
      display: flex;
      justify-content: space-around;
      padding: 10px 0 8px;
      border-top: 1px solid var(--surface);
      background: white;
      flex-shrink: 0;
    }

    #demo .nav-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 3px;
      cursor: pointer;
      transition: opacity 0.15s;
      -webkit-tap-highlight-color: transparent;
    }
    .nav-item:active { opacity: 0.7; }

    #demo .nav-icon {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 13px;
      color: var(--text-muted);
      transition: all 0.2s;
    }

    #demo .nav-icon.como-icon {
      width: 32px;
      height: 32px;
      background: var(--green-light);
      font-family: var(--serif);
      font-weight: 700;
      color: var(--green);
      font-size: 14px;
    }

    #demo .nav-icon.active {
      background: var(--green);
      color: white;
    }

    #demo .nav-icon.como-icon.active {
      background: var(--green);
      color: var(--peach);
    }

    #demo .nav-label {
      font-size: 9px;
      color: var(--text-muted);
      font-weight: 400;
    }

    #demo .nav-label.active {
      color: var(--green);
      font-weight: 600;
    }

    /* ───── FORM ELEMENTS ───── */
    .form-group { margin-bottom: 18px; }

    #demo .label {
      font-size: 13px;
      font-weight: 600;
      color: var(--text);
      margin-bottom: 10px;
      display: block;
    }

    #demo .scale-container {
      background: white;
      border: 1px solid var(--surface);
      border-radius: 14px;
      padding: 14px;
    }

    #demo .scale-visual {
      display: flex;
      justify-content: space-between;
      align-items: flex-end;
      height: 50px;
      margin-bottom: 8px;
      gap: 3px;
    }

    #demo .scale-bar {
      flex: 1;
      border-radius: 4px 4px 0 0;
      cursor: pointer;
      transition: all 0.2s ease;
      position: relative;
    }
    .scale-bar:hover { opacity: 0.8; }

    #demo .scale-labels {
      display: flex;
      justify-content: space-between;
      font-size: 10px;
      color: var(--text-muted);
      margin-top: 4px;
    }

    #demo .options-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
    }

    #demo .option-btn {
      background: white;
      border: 1.5px solid var(--surface2);
      border-radius: 14px;
      padding: 12px 14px;
      font-family: var(--sans);
      font-size: 13px;
      color: var(--text-soft);
      text-align: left;
      cursor: pointer;
      transition: all 0.2s ease;
      -webkit-tap-highlight-color: transparent;
    }
    .option-btn:hover { border-color: var(--green); }
    #demo .option-btn.selected {
      background: var(--green-light);
      border-color: var(--green);
      color: var(--green);
      font-weight: 500;
    }

    #demo .emotion-chips {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }

    #demo .emotion-chip {
      padding: 8px 14px;
      border-radius: 50px;
      font-family: var(--sans);
      font-size: 13px;
      font-weight: 500;
      border: 1.5px solid var(--surface2);
      background: white;
      color: var(--text-soft);
      cursor: pointer;
      transition: all 0.2s ease;
      -webkit-tap-highlight-color: transparent;
    }
    .emotion-chip:hover { border-color: var(--raspberry); }
    #demo .emotion-chip.selected {
      background: var(--raspberry-light);
      border-color: var(--raspberry);
      color: var(--raspberry);
    }

    #demo .text-input {
      width: 100%;
      background: white;
      border: 1.5px solid var(--surface2);
      border-radius: 14px;
      padding: 12px 14px;
      font-family: var(--sans);
      font-size: 13px;
      color: var(--text);
      min-height: 64px;
      resize: none;
      outline: none;
      transition: border-color 0.2s;
    }
    .text-input:focus { border-color: var(--green); }
    .text-input::placeholder { color: var(--text-muted); }

    #demo .primary-btn {
      background: var(--green);
      color: white;
      border: none;
      border-radius: 50px;
      padding: 14px 28px;
      font-family: var(--sans);
      font-size: 14px;
      font-weight: 600;
      width: 100%;
      cursor: pointer;
      transition: all 0.2s;
      -webkit-tap-highlight-color: transparent;
    }
    .primary-btn:hover { background: var(--green-mid); }
    .primary-btn:active { transform: scale(0.98); }

    /* ───── COMO RESPONSE ───── */
    #demo .como-response {
      background: white;
      border: 1px solid var(--surface);
      border-radius: 14px;
      padding: 14px 16px;
      display: flex;
      gap: 10px;
      align-items: flex-start;
    }

    #demo .como-avatar {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      background: var(--green);
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }

    #demo .como-avatar-letter {
      font-family: var(--serif);
      font-size: 14px;
      font-weight: 700;
      color: var(--peach);
    }

    #demo .como-text {
      font-size: 13px;
      color: var(--text-soft);
      line-height: 1.6;
      flex: 1;
    }

    /* ───── ENTRY CARD ───── */
    #demo .entry-card {
      background: var(--bg);
      border: 1px solid var(--surface);
      border-radius: 16px;
      padding: 16px 18px;
      margin-bottom: 10px;
    }

    #demo .entry-time-large {
      font-size: 14px;
      font-weight: 600;
      color: var(--text);
      margin-bottom: 12px;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    #demo .emotion-tag {
      padding: 4px 12px;
      border-radius: 50px;
      font-size: 11px;
      font-weight: 500;
    }

    #demo .entry-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 8px;
    }

    #demo .entry-label {
      font-size: 12px;
      color: var(--text-muted);
    }

    #demo .entry-value {
      font-size: 12px;
      color: var(--text);
      font-weight: 500;
      text-align: right;
    }

    #demo .dots-container {
      display: flex;
      gap: 4px;
      align-items: center;
    }

    #demo .dot {
      width: 10px;
      height: 10px;
      border-radius: 50%;
    }
    .dot.hunger { background: var(--green); }
    .dot.hunger.empty { background: transparent; border: 1.5px solid var(--green); }
    .dot.fullness { background: var(--peach); }
    .dot.fullness.empty { background: transparent; border: 1.5px solid var(--peach); }

    /* ───── TOGGLE SWITCH ───── */
    #demo .toggle-group {
      display: flex;
      background: var(--surface);
      border-radius: 10px;
      padding: 3px;
    }

    #demo .toggle-opt {
      flex: 1;
      padding: 8px 10px;
      text-align: center;
      border-radius: 8px;
      font-size: 13px;
      color: var(--text-soft);
      cursor: pointer;
      transition: all 0.2s;
      -webkit-tap-highlight-color: transparent;
    }
    #demo .toggle-opt.selected {
      background: white;
      color: var(--text);
      font-weight: 500;
      box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    }

    /* ───── CHAT ───── */
    #demo .chat-messages {
      display: flex;
      flex-direction: column;
      gap: 10px;
      margin-bottom: 14px;
    }

    #demo .message {
      display: flex;
      gap: 8px;
      max-width: 88%;
      animation: msgFade 0.3s ease both;
    }

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

    #demo .message.user {
      flex-direction: row-reverse;
      align-self: flex-end;
    }

    #demo .message-bubble {
      background: white;
      border: 1px solid var(--surface);
      border-radius: 18px;
      padding: 12px 14px;
      font-size: 13px;
      line-height: 1.55;
      color: var(--text);
    }

    #demo .message.user .message-bubble {
      background: var(--green);
      color: white;
      border: none;
    }

    #demo .chat-input-area {
      background: white;
      border-top: 1px solid var(--surface);
      padding: 12px 18px;
      display: flex;
      gap: 10px;
      align-items: center;
      flex-shrink: 0;
    }

    #demo .chat-input {
      flex: 1;
      background: var(--bg);
      border: 1px solid var(--surface2);
      border-radius: 22px;
      padding: 10px 16px;
      font-family: var(--sans);
      font-size: 13px;
      outline: none;
      transition: border-color 0.2s;
    }
    .chat-input:focus { border-color: var(--green); }

    #demo .send-btn {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      background: var(--green);
      border: none;
      display: flex;
      align-items: center;
      justify-content: center;
      color: white;
      font-size: 16px;
      cursor: pointer;
      transition: background 0.15s;
      flex-shrink: 0;
    }
    .send-btn:hover { background: var(--green-mid); }

    /* ───── CALENDAR ───── */
    #demo .calendar-strip {
      display: flex;
      gap: 5px;
      margin-bottom: 14px;
    }

    #demo .day-cell {
      flex: 1;
      height: 46px;
      border-radius: 10px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      background: white;
      border: 1px solid var(--surface);
      cursor: pointer;
      transition: all 0.2s;
    }
    .day-cell:hover { border-color: var(--green); }
    #demo .day-cell.has-entry {
      background: var(--green-light);
      border-color: var(--green);
    }

    #demo .day-label-cal {
      font-size: 9px;
      color: var(--text-muted);
      font-weight: 500;
    }

    #demo .day-number {
      font-size: 13px;
      color: var(--text);
      font-weight: 600;
    }
    .day-cell.has-entry .day-number { color: var(--green); }

    /* ───── INSIGHT CARD ───── */
    #demo .insight-card {
      background: var(--green-light);
      border: 2px solid var(--green);
      border-radius: 18px;
      padding: 18px;
      margin-bottom: 14px;
    }

    #demo .insight-label {
      font-size: 10px;
      font-weight: 600;
      letter-spacing: 1px;
      margin-bottom: 8px;
      color: var(--green);
    }

    #demo .insight-text {
      font-size: 14px;
      line-height: 1.6;
      color: var(--text);
    }

    /* ───── TOOL CARD ───── */
    #demo .tool-card {
      background: white;
      border: 1px solid var(--surface);
      border-radius: 14px;
      padding: 16px;
      margin-bottom: 12px;
      cursor: pointer;
      transition: all 0.2s;
    }
    .tool-card:hover { border-color: var(--green); transform: translateY(-1px); }

    #demo .tool-header {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-bottom: 8px;
    }

    #demo .tool-icon-wrap {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      flex-shrink: 0;
    }

    #demo .tool-title {
      font-size: 14px;
      font-weight: 600;
      color: var(--text);
    }

    #demo .tool-description {
      font-size: 12px;
      color: var(--text-soft);
      line-height: 1.55;
    }

    /* ───── PROGRESS BAR ───── */
    #demo .progress-row {
      display: flex;
      gap: 5px;
      margin: 8px 0;
    }

    #demo .progress-seg {
      flex: 1;
      height: 6px;
      border-radius: 3px;
      background: var(--surface);
      transition: background 0.3s;
    }
    .progress-seg.done { background: var(--green); }

    /* ───── SCREEN TRANSITIONS ───── */
    .screen-enter { animation: screenIn 0.25s ease both; }

    @keyframes screenIn {
      from { opacity: 0; transform: translateX(20px); }
      to { opacity: 1; transform: translateX(0); }
    }

    /* ───── FOOTER CTA ───── */
    #demo .demo-footer {
      width: 100%;
      padding: 60px 20px 80px;
      text-align: center;
      background: var(--forest);
      position: relative;
      overflow: hidden;
    }
    #demo .demo-footer::before {
      content: '';
      position: absolute;
      top: -60px; left: 50%;
      transform: translateX(-50%);
      width: 400px; height: 400px;
      background: radial-gradient(circle, rgba(237,176,130,0.1) 0%, transparent 65%);
      pointer-events: none;
    }

    #demo .demo-footer h2 {
      font-family: var(--serif);
      font-size: clamp(26px, 6vw, 40px);
      font-weight: 700;
      line-height: 1.15;
      color: white;
      margin-bottom: 12px;
      position: relative;
    }
    .demo-footer h2 em { font-style: italic; color: var(--peach); }

    #demo .demo-footer p {
      font-size: 15px;
      font-weight: 300;
      line-height: 1.7;
      color: rgba(255,255,255,0.55);
      margin-bottom: 28px;
      position: relative;
    }

    #demo .demo-footer .cta-row {
      display: flex;
      justify-content: center;
      gap: 12px;
      flex-wrap: wrap;
      position: relative;
    }

    #demo .btn-peach-footer {
      background: var(--peach);
      color: var(--text);
      padding: 14px 28px;
      border-radius: 100px;
      font-size: 15px;
      font-weight: 500;
      text-decoration: none;
      transition: all 0.2s;
      display: inline-block;
    }
    .btn-peach-footer:hover { opacity: 0.9; transform: translateY(-1px); }

    #demo .btn-outline-footer {
      color: rgba(255,255,255,0.6);
      padding: 14px 28px;
      border-radius: 100px;
      font-size: 15px;
      font-weight: 400;
      text-decoration: none;
      border: 1.5px solid rgba(255,255,255,0.2);
      transition: all 0.2s;
      display: inline-block;
    }
    .btn-outline-footer:hover { border-color: rgba(255,255,255,0.4); color: white; }

    /* ───── TYPING INDICATOR ───── */
    #demo .typing-dots {
      display: flex;
      gap: 4px;
      padding: 4px 0;
    }
    #demo .typing-dots span {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: var(--text-muted);
      animation: typing 1.2s infinite;
    }
    .typing-dots span:nth-child(2) { animation-delay: 0.2s; }
    .typing-dots span:nth-child(3) { animation-delay: 0.4s; }

    @keyframes typing {
      0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
      40% { opacity: 1; transform: scale(1); }
    }

    /* ───── FADE ANIMATIONS ───── */
    @keyframes fadeUp {
      from { opacity: 0; transform: translateY(20px); }
      to   { opacity: 1; transform: translateY(0); }
    }
    .demo-hero h1        { animation: fadeUp 0.5s ease both; }
    .demo-hero p          { animation: fadeUp 0.5s ease 0.1s both; }
    .demo-hero-hint       { animation: fadeUp 0.5s ease 0.2s both; }

/* Fullscreen overlay (global) */

    /* ───── FULLSCREEN MODE ───── */
    .fullscreen-overlay {
      display: none;
      position: fixed;
      inset: 0;
      z-index: 9999;
      background: var(--bg);
      flex-direction: column;
      align-items: center;
      justify-content: center;
    }

    .fullscreen-overlay.active {
      display: flex;
    }

    .fullscreen-phone {
      width: 100%;
      max-width: 430px;
      height: 100%;
      background: white;
      display: flex;
      flex-direction: column;
      position: relative;
      overflow: hidden;
    }

    .fullscreen-phone .status-bar {
      padding-top: max(12px, env(safe-area-inset-top, 12px));
    }

    .fullscreen-phone .nav-bar {
      padding-bottom: max(8px, env(safe-area-inset-bottom, 8px));
    }

    .fullscreen-exit {
      position: fixed;
      top: max(14px, env(safe-area-inset-top, 14px));
      right: 14px;
      z-index: 10001;
      width: 36px;
      height: 36px;
      border-radius: 50%;
      background: rgba(28,26,24,0.55);
      backdrop-filter: blur(8px);
      border: none;
      color: white;
      font-size: 18px;
      display: none;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: background 0.2s;
      -webkit-tap-highlight-color: transparent;
    }
    .fullscreen-exit:hover { background: rgba(28,26,24,0.75); }
    .fullscreen-exit.active { display: flex; }

    body.fullscreen-active {
      overflow: hidden;
    }

    body.fullscreen-active .demo-page {
      display: none !important;
    }
