/* ═══════════════════════════════════════════
   ECO — Yellow Notes / No Box
   ═══════════════════════════════════════════ */

body, html {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow-x: hidden;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  -webkit-overflow-scrolling: touch;
}

/* ── header ── */
.header {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: .7rem 1.5rem;
  border-bottom: 1px solid rgba(220,180,60,.12);
  background: rgba(8,6,13,.88);
  backdrop-filter: blur(12px);
}

.back-btn {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: #f0c040;
  width: 2rem; height: 2rem;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(240,192,64,.2);
  border-radius: 50%;
  background: rgba(240,192,64,.05);
  transition: background .2s, border-color .2s, transform .15s;
  text-decoration: none;
}
.back-btn:hover {
  background: rgba(240,192,64,.12);
  border-color: #f0c040;
}
.back-btn:active { transform: scale(.92); }

.logo {
  font-family: var(--font-display);
  font-size: clamp(1rem, 2.5vw, 1.5rem);
  color: #f0c040;
  letter-spacing: .1em;
}

/* ── title ── */
.diary {
  position: relative;
  padding: 1.5rem 1rem 1rem;
  max-width: 900px;
  margin: auto;
}

.section-title {
  text-align: center;
  font-family: 'Caveat', cursive;
  font-size: clamp(1.6rem, 4vw, 2rem);
  font-weight: 700;
  color: #f0c040;
  margin-bottom: 1.5rem;
  text-shadow: 0 0 20px rgba(240,192,64,.15);
}

/* ── notes container — free floating, no box ── */
#thoughts-container {
  position: relative;
  width: 100%;
  min-height: 200px;
}

/* ── individual note — yellow sticky note ── */
.creative-note {
  position: relative;
  background: linear-gradient(
    160deg,
    rgba(255,230,100,.1) 0%,
    rgba(255,215,60,.06) 40%,
    rgba(240,192,64,.04) 100%
  );
  border: 1px solid rgba(240,192,64,.18);
  border-radius: 2px 2px 4px 4px;
  padding: .85rem 1rem 1.1rem;
  color: rgba(255,240,180,.9);
  cursor: default;
  word-wrap: break-word;
  overflow-wrap: break-word;
  font-family: 'Caveat', cursive;
  font-size: 1.1rem;
  line-height: 1.5;
  transition: transform .3s, box-shadow .3s, border-color .3s;
  animation: noteAppear .5s ease-out forwards;
  opacity: 0;
  transform-origin: top center;
  break-inside: avoid;
  box-shadow:
    1px 2px 6px rgba(0,0,0,.2),
    0 0 0 1px rgba(255,230,100,.03);
}

/* masking tape */
.creative-note::before {
  content: '';
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%) rotate(var(--tape-rotation, 0deg));
  width: 48px;
  height: 14px;
  background: rgba(255,235,150,.12);
  border: 1px solid rgba(255,235,150,.1);
  border-radius: 2px;
  pointer-events: none;
}

/* paper shadow edge */
.creative-note::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, rgba(240,192,64,.08), transparent);
  border-radius: 0 0 4px 4px;
  pointer-events: none;
}

@keyframes noteAppear {
  0% { opacity: 0; transform: scale(.9) translateY(12px); }
  60% { opacity: .8; transform: scale(1.01) rotate(var(--note-rotation, 0deg)) translateY(-2px); }
  100% { opacity: 1; transform: scale(1) rotate(var(--note-rotation, 0deg)) translateY(0); }
}

.creative-note:hover {
  transform: scale(1.02) rotate(0deg) !important;
  border-color: rgba(240,192,64,.35);
  box-shadow:
    2px 4px 12px rgba(0,0,0,.25),
    0 0 15px rgba(240,192,64,.06);
}

.creative-note time {
  font-family: var(--font-mono);
  font-size: .6rem;
  color: rgba(240,192,64,.45);
  display: block;
  margin-top: .5rem;
  padding-top: .35rem;
  border-top: 1px dashed rgba(240,192,64,.1);
}

/* mobile note */
.mobile-note {
  position: static !important;
  left: unset !important;
  top: unset !important;
  width: 100% !important;
  min-height: auto !important;
  margin: 0 0 .6rem 0 !important;
  transform: none !important;
  z-index: 1 !important;
  animation-delay: 0s !important;
}

/* ── composer → floating panel ── */
.notes-fab {
  position: fixed;
  bottom: calc(4.5rem + env(safe-area-inset-bottom));
  right: 1.2rem;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(240,192,64,.9);
  color: var(--bg);
  border: none;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px -4px rgba(240,192,64,.4);
  transition: transform .25s, box-shadow .25s;
  z-index: 900;
}
.notes-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px -4px rgba(240,192,64,.5);
}
.notes-fab:active { transform: scale(.95); }

.notes-panel {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-height: 70vh;
  background: rgba(8,6,13,.97);
  border-top: 1px solid rgba(240,192,64,.15);
  border-radius: 16px 16px 0 0;
  padding: 1rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom));
  z-index: 950;
  transform: translateY(100%);
  transition: transform .4s cubic-bezier(.22,.8,.25,1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.notes-panel.open { transform: translateY(0); }

.notes-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .8rem;
}
.notes-panel__title {
  font-family: 'Caveat', cursive;
  font-size: 1.3rem;
  font-weight: 700;
  color: #f0c040;
  margin: 0;
}
.notes-panel__close {
  background: none;
  border: none;
  color: rgba(240,192,64,.5);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 .2rem;
  transition: color .2s;
}
.notes-panel__close:hover { color: #f0c040; }

.notes-panel textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(240,192,64,.15);
  background: rgba(255,230,100,.04);
  color: rgba(255,240,180,.9);
  border-radius: 8px;
  padding: .6rem .8rem;
  font-family: 'Caveat', cursive;
  font-size: 1.05rem;
  line-height: 1.4;
  resize: none;
  max-height: 28vh;
  outline: none;
  transition: border-color .25s;
}
.notes-panel textarea::placeholder {
  color: rgba(240,192,64,.35);
  font-style: italic;
}
.notes-panel textarea:focus {
  border-color: rgba(240,192,64,.3);
  background: rgba(255,230,100,.06);
}
.composer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: .35rem;
  gap: .4rem;
  flex-wrap: wrap;
}
#charCount {
  font-family: var(--font-mono);
  font-size: .65rem;
  color: rgba(240,192,64,.4);
}

/* ── buttons ── */
.btn {
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  border-radius: 6px;
  border: 1px solid rgba(240,192,64,.2);
  padding: .4rem .75rem;
  background: rgba(240,192,64,.06);
  color: rgba(255,240,180,.8);
  font-family: var(--font-display);
  font-size: .7rem;
  letter-spacing: .04em;
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .15s;
}
.btn:active { transform: scale(.95); }
.btn-primary {
  background: rgba(240,192,64,.12);
  border-color: rgba(240,192,64,.4);
  color: #f0c040;
}
.btn-primary:hover {
  background: rgba(240,192,64,.2);
}
.btn-danger {
  background: rgba(255,80,80,.06);
  border-color: rgba(255,80,80,.25);
  color: #ff6b6b;
}
.btn-danger:hover {
  background: rgba(255,80,80,.12);
}
.btn-group {
  display: flex;
  gap: .35rem;
  align-items: center;
}

/* ── secret note ── */
#secret-note {
  position: fixed;
  bottom: 90px;
  right: 12px;
  background: rgba(8,6,13,.9);
  border: 1px solid rgba(240,192,64,.15);
  padding: .7rem;
  border-radius: 8px;
  max-width: 260px;
  display: none;
  box-shadow: 0 6px 20px -8px rgba(0,0,0,.5);
}
#secret-note p {
  margin-bottom: .35rem;
  white-space: pre-wrap;
  color: rgba(240,192,64,.5);
  font-family: 'Caveat', cursive;
  font-size: .9rem;
}
#editSecret {
  background: none;
  border: 1px dashed rgba(240,192,64,.3);
  color: rgba(240,192,64,.6);
  padding: .25rem .5rem;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: .65rem;
  cursor: pointer;
  transition: background .2s, color .2s;
}
#editSecret:hover {
  background: rgba(240,192,64,.08);
  color: #f0c040;
}

/* ── footer ── */
.footer {
  flex-shrink: 0;
  text-align: center;
  padding: .6rem 1rem 1rem;
}
.footer__divider {
  width: 60px; height: 2px; margin: 0 auto .5rem;
  background: linear-gradient(90deg, rgba(240,192,64,.5), rgba(240,192,64,.2));
  border-radius: 1px;
}
.footer__text {
  font-family: var(--font-display);
  font-size: .8rem;
  color: rgba(240,192,64,.6);
  letter-spacing: .1em;
  min-height: 1.2em;
}
.footer__credit {
  font-family: var(--font-mono);
  font-size: .65rem;
  font-weight: 700;
  color: var(--dim);
  letter-spacing: .15em;
  margin-top: .3rem;
  opacity: .8;
}

/* ── hidden legacy ── */
.eco-actions, .card-section, .floating-phrase { display: none !important; }
#customCursor { display: none; }

/* ── masonry grid for desktop ── */
.eco-masonry {
  column-count: 3;
  column-gap: .8rem;
}
.eco-masonry .creative-note {
  display: inline-block;
  width: 100%;
  margin-bottom: .8rem;
}

/* ── mobile ── */
@media (max-width: 600px) {
  .diary { padding: 1rem .75rem 1rem; }
  body { padding-bottom: 0; }
  .notes-fab {
    bottom: calc(5rem + env(safe-area-inset-bottom));
    right: 1rem;
    width: 44px; height: 44px;
    font-size: 1.2rem;
  }
  .section-title { font-size: 1.4rem; margin-bottom: 1rem; }
  .eco-masonry {
    column-count: 1;
  }
  .eco-masonry .creative-note {
    margin-bottom: .6rem;
  }
  .creative-note {
    font-size: 1rem;
    padding: .7rem .85rem .9rem;
  }
  .creative-note::before {
    width: 40px;
    height: 12px;
    top: -6px;
  }
  .creative-note time {
    font-size: .55rem;
  }
}

@media (min-width: 601px) and (max-width: 900px) {
  .eco-masonry {
    column-count: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
