/* ============================================================
   Views — per-screen layouts
   ============================================================ */

/* ------- View container ------- */
.view {
  flex: 1;
  overflow: hidden;
  display: none;
  flex-direction: column;
}
.view.is-active { display: flex; }

/* ------- Library ------- */
.library {
  flex: 1;
  overflow-y: auto;
  padding: 0 0 calc(80px + var(--sb));
  -webkit-overflow-scrolling: touch;
  /* Improve scroll perf for long lists */
  contain: layout style;
}

/* ------- Reader ------- */
.reader-bar {
  padding: 14px 16px;
  padding-top: calc(14px + var(--st));
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--brd);
  z-index: 50;
}
.reader-bar__title {
  font-family: var(--ff-serif);
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.reader {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px calc(40px + var(--sb));
  -webkit-overflow-scrolling: touch;
}
.reader__hero {
  width: 100%;
  border-radius: var(--r-lg);
  overflow: hidden;
  margin: 20px 0 28px;
}
.reader__hero img {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
}
.reader__hero-placeholder {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, var(--surf), var(--card));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
}
.reader__title {
  font-family: var(--ff-serif);
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 8px;
}
.reader__meta {
  font-size: 0.85rem;
  color: var(--t2);
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.reader__body {
  font-family: var(--ff-serif);
  font-size: 1.08rem;
  line-height: 2;
  color: var(--t3);
}
.reader__body p { margin-bottom: 1.4rem; }
.reader__body .dialogue   { color: var(--rose-s); font-style: italic; }
.reader__body .emphasis   { color: var(--gold-s); font-weight: 500; }
.reader__body .scene-break {
  text-align: center;
  margin: 2.5rem 0;
  color: var(--rose);
  font-size: 1.1rem;
  letter-spacing: 0.5em;
  opacity: 0.5;
}
.reader__body .hot     { color: var(--rose); font-weight: 600; }
.reader__body .whisper { font-size: 0.95rem; color: var(--tm); font-style: italic; }

.reader__end {
  text-align: center;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--brd);
}
.reader__end-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}
.reader__end-text {
  font-family: var(--ff-script);
  font-size: 1.3rem;
  color: var(--rose-s);
}

/* ------- Submit / Share ------- */
.submit-view {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px calc(80px + var(--sb));
}
.submit-header {
  text-align: center;
  margin-bottom: 28px;
}
.submit-header__icon { font-size: 2.5rem; margin-bottom: 8px; }
.submit-header__title {
  font-family: var(--ff-script);
  font-size: 1.8rem;
  color: var(--rose);
  margin-bottom: 6px;
}
.submit-header__sub {
  font-size: 0.85rem;
  color: var(--t2);
  line-height: 1.6;
}

.previous-list { margin-top: 24px; }
.previous-item {
  background: var(--surf);
  border: 1px solid var(--brd);
  border-radius: var(--r);
  padding: 12px 14px;
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.previous-item__icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 2px;
}
.previous-item__url {
  font-size: 0.8rem;
  color: var(--tm);
  word-break: break-all;
  line-height: 1.4;
}
.previous-item__note {
  font-size: 0.85rem;
  color: var(--t2);
  margin-top: 2px;
}
.previous-item__date {
  font-size: 0.7rem;
  color: var(--tm);
  margin-top: 4px;
}

/* ------- Questionnaire ------- */
.quiz {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px calc(80px + var(--sb));
  -webkit-overflow-scrolling: touch;
}
.quiz-header {
  text-align: center;
  margin-bottom: 32px;
}
.quiz-header__icon { font-size: 2.5rem; margin-bottom: 8px; }
.quiz-header__title {
  font-family: var(--ff-script);
  font-size: 1.8rem;
  color: var(--rose);
  margin-bottom: 6px;
}
.quiz-header__sub {
  font-size: 0.85rem;
  color: var(--t2);
  line-height: 1.6;
}
.quiz-progress {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  padding: 0 4px;
}
.quiz-progress__dot {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--surf);
  transition: background var(--dur);
}
.quiz-progress__dot.is-filled { background: var(--rose); }

.quiz-card {
  background: var(--card);
  border: 1px solid var(--brd);
  border-radius: var(--r-xl);
  padding: 24px;
  margin-bottom: 20px;
}
.quiz-card__num {
  font-size: 0.7rem;
  color: var(--tm);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}
.quiz-card__question {
  font-family: var(--ff-serif);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--t1);
  line-height: 1.5;
  margin-bottom: 18px;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.quiz-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surf);
  border: 2px solid var(--brd);
  border-radius: var(--r);
  font-size: 0.95rem;
  color: var(--t2);
  text-align: left;
  width: 100%;
  transition: all var(--dur-fast);
}
.quiz-option:hover { border-color: var(--rose-s); }
.quiz-option.is-selected {
  border-color: var(--rose);
  background: var(--rose-d);
  color: var(--t1);
}
.quiz-option__dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--brd);
  flex-shrink: 0;
  position: relative;
}
.quiz-option.is-selected .quiz-option__dot {
  border-color: var(--rose);
  background: var(--rose);
}
.quiz-option.is-selected .quiz-option__dot::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: #fff;
}

.quiz-slider {
  background: var(--surf);
  padding: 18px;
  border-radius: var(--r);
  border: 1px solid var(--brd);
}
.quiz-slider__value {
  text-align: center;
  font-family: var(--ff-script);
  font-size: 2rem;
  color: var(--rose);
  margin-bottom: 8px;
}
.quiz-slider__input {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--brd);
  border-radius: 3px;
  outline: none;
}
.quiz-slider__input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--rose);
  cursor: pointer;
  box-shadow: var(--shadow-rose);
}
.quiz-slider__input::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--rose);
  cursor: pointer;
  border: none;
}
.quiz-slider__labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--tm);
  margin-top: 10px;
}

.quiz-textarea {
  width: 100%;
  min-height: 90px;
  padding: 13px 16px;
  background: var(--surf);
  border: 2px solid var(--brd);
  border-radius: var(--r);
  color: var(--t1);
  font-size: 0.95rem;
  font-family: var(--ff-body);
  resize: vertical;
  line-height: 1.6;
  transition: border-color var(--dur);
}
.quiz-textarea:focus {
  outline: none;
  border-color: var(--rose);
}

.quiz-submit-wrap {
  text-align: center;
  margin-top: 12px;
}

/* ------- Journal ------- */
.journal {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px calc(80px + var(--sb));
  -webkit-overflow-scrolling: touch;
}
.journal-header {
  text-align: center;
  margin-bottom: 28px;
}
.journal-header__icon { font-size: 2.5rem; margin-bottom: 8px; }
.journal-header__title {
  font-family: var(--ff-script);
  font-size: 1.8rem;
  color: var(--rose);
  margin-bottom: 6px;
}
.journal-header__sub {
  font-size: 0.85rem;
  color: var(--t2);
  line-height: 1.6;
}

.journal-compose {
  background: var(--card);
  border: 1px solid var(--brd-a);
  border-radius: var(--r-xl);
  padding: 24px;
  margin-bottom: 24px;
}
.journal-compose__title {
  font-family: var(--ff-script);
  font-size: 1.3rem;
  color: var(--gold);
  margin-bottom: 16px;
}

.mood-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.mood-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--surf);
  border: 2px solid var(--brd);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  transition: all 0.25s;
}
.mood-btn:hover { border-color: var(--rose-s); }
.mood-btn.is-selected {
  border-color: var(--rose);
  background: var(--rose-d);
  transform: scale(1.1);
}

.tag-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.tag-btn {
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--surf);
  border: 1px solid var(--brd);
  font-size: 0.75rem;
  color: var(--t2);
  transition: all 0.25s;
}
.tag-btn:hover { border-color: var(--rose-s); }
.tag-btn.is-selected {
  border-color: var(--rose);
  background: var(--rose-d);
  color: var(--t1);
}

.journal-entry {
  background: var(--card);
  border: 1px solid var(--brd);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 20px;
}
.journal-entry__date {
  font-size: 0.7rem;
  color: var(--tm);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}
.journal-entry__mood {
  font-size: 1.5rem;
  margin-bottom: 8px;
}
.journal-entry__text {
  font-family: var(--ff-serif);
  font-size: 0.95rem;
  color: var(--t3);
  line-height: 1.8;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.journal-entry__tag {
  display: inline-block;
  padding: 3px 10px;
  background: var(--rose-d);
  border-radius: 8px;
  font-size: 0.65rem;
  color: var(--rose-s);
  font-weight: 700;
  text-transform: uppercase;
  margin-top: 10px;
}

.journal-privacy {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--rose-d);
  border: 1px solid var(--brd-a);
  border-radius: var(--r);
  margin-bottom: 16px;
  font-size: 0.78rem;
  color: var(--rose-s);
}
.journal-privacy__check {
  width: 18px;
  height: 18px;
  accent-color: var(--rose);
  flex-shrink: 0;
}

/* ------- Videos ------- */
.videos {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px calc(80px + var(--sb));
  -webkit-overflow-scrolling: touch;
}
.videos-header {
  text-align: center;
  margin-bottom: 28px;
}
.videos-header__icon { font-size: 2.5rem; margin-bottom: 8px; }
.videos-header__title {
  font-family: var(--ff-script);
  font-size: 1.8rem;
  color: var(--rose);
  margin-bottom: 6px;
}
.videos-header__sub {
  font-size: 0.85rem;
  color: var(--t2);
  line-height: 1.6;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.video-card {
  background: var(--card);
  border: 1px solid var(--brd);
  border-radius: var(--r-lg);
  overflow: hidden;
  text-align: left;
}
.video-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  width: 100%;
}
.video-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.video-thumb__placeholder {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  background: linear-gradient(160deg, var(--surf), var(--card));
}
.video-thumb__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--dur);
}
.video-card:hover .video-thumb__overlay { opacity: 1; }
.video-thumb__play {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--rose);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #fff;
}
.video-info { padding: 12px 14px; }
.video-info__title {
  font-family: var(--ff-serif);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.video-info__meta {
  font-size: 0.7rem;
  color: var(--t2);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.video-add {
  background: var(--surf);
  border: 2px dashed var(--brd-a);
  border-radius: var(--r-xl);
  padding: 24px;
  text-align: center;
  width: 100%;
  transition: all var(--dur);
}
.video-add:hover {
  border-color: var(--rose);
  background: var(--rose-d);
}
.video-add__icon { font-size: 2.5rem; margin-bottom: 8px; }
.video-add__text {
  font-size: 0.9rem;
  color: var(--t2);
}
.video-add__sub {
  font-size: 0.75rem;
  color: var(--tm);
  margin-top: 4px;
}

.video-form {
  display: none;
  background: var(--card);
  border: 1px solid var(--brd-a);
  border-radius: var(--r-xl);
  padding: 24px;
  margin-bottom: 20px;
}
.video-form.is-visible { display: block; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
}
.empty-state__icon {
  font-size: 3rem;
  margin-bottom: 12px;
}
.empty-state__title {
  font-family: var(--ff-script);
  font-size: 1.4rem;
  color: var(--rose);
  margin-bottom: 8px;
}
.empty-state__text {
  font-size: 0.9rem;
  color: var(--t2);
  line-height: 1.6;
}
