/* Journal Side Panel */
.journal-panel {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 280px;
  background: #fff;
  border-left: 1px solid #E8E8EE;
  z-index: 100;
  transform: translateX(240px);
  transition: transform .3s ease;
  display: flex;
  flex-direction: column;
  box-shadow: -2px 0 12px rgba(0,0,0,.06);
}
.journal-panel.open {
  transform: translateX(0);
}

/* Toggle button */
.journal-toggle {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translate(-100%, -50%);
  width: 40px;
  height: 44px;
  background: #fff;
  border: 1px solid #E8E8EE;
  border-right: none;
  border-radius: 8px 0 0 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5A5A72;
  transition: all .2s;
}
.journal-toggle:hover { background: #f5f5f5; }
.journal-toggle svg { pointer-events: none; }

/* Badge */
.journal-badge {
  position: absolute;
  top: 2px;
  right: 4px;
  background: #6366F1;
  color: #fff;
  font-size: .6rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Content */
.journal-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}
.journal-header h3 {
  font-family: 'Fraunces', serif;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: #1E1E2A;
}

/* Sections */
.journal-section {
  margin-bottom: 1.2rem;
}
.journal-section h4 {
  font-size: .75rem;
  font-weight: 700;
  color: #8A8AA0;
  margin-bottom: .5rem;
  display: flex;
  align-items: center;
  gap: .35rem;
}
.journal-section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: .7rem;
  font-weight: 700;
}
.journal-icon-clarify {
  background: #EEF0FE;
  color: #6366F1;
}
.journal-icon-interest {
  background: #FFF9E6;
  color: #D97720;
}

/* Entries */
.journal-entry {
  background: #FAFAF8;
  border: 1px solid #E8E8EE;
  border-radius: 8px;
  padding: .5rem .6rem;
  margin-bottom: .4rem;
  position: relative;
}
.journal-entry-text {
  font-size: .8rem;
  color: #1E1E2A;
  line-height: 1.4;
  font-style: italic;
  padding-right: 1.4rem;
  word-break: break-word;
}
.journal-entry-meta {
  font-size: .65rem;
  color: #8A8AA0;
  margin-top: .2rem;
}
.journal-entry-remove {
  position: absolute;
  top: .3rem;
  right: .4rem;
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
  transition: color .2s;
}
.journal-entry-remove:hover { color: #E85D5D; }

.journal-empty {
  font-size: .78rem;
  color: #ccc;
  font-style: italic;
  margin: 0;
}

/* Selection popup */
.journal-popup {
  position: absolute;
  display: none;
  gap: .3rem;
  transform: translate(-50%, -100%);
  z-index: 1000;
  background: #333;
  border-radius: 8px;
  padding: .25rem;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
}
.journal-popup::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #333;
}
.journal-popup-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: none;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  font-family: 'DM Sans', sans-serif;
}
.journal-popup-btn.clarify {
  background: #4A4A5A;
  color: #A5B4FC;
}
.journal-popup-btn.clarify:hover {
  background: #6366F1;
  color: #fff;
}
.journal-popup-btn.interest {
  background: #4A4A5A;
  color: #FCD34D;
}
.journal-popup-btn.interest:hover {
  background: #D97720;
  color: #fff;
}

/* Responsive — narrow viewports */
@media (max-width: 768px) {
  .journal-panel {
    width: 100%;
    height: 300px;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    border-left: none;
    border-top: 1px solid #E8E8EE;
    transform: translateY(260px);
  }
  .journal-panel.open {
    transform: translateY(0);
  }
  .journal-toggle {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, -100%);
    width: 44px;
    height: 36px;
    border-radius: 8px 8px 0 0;
    border: 1px solid #E8E8EE;
    border-bottom: none;
    border-right: 1px solid #E8E8EE;
  }
}
