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

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

:root {
  --bg: #efe4c9;
  --bg-deep: #ddc48e;
  --panel: rgba(255, 250, 240, 0.92);
  --panel-strong: rgba(255, 248, 230, 0.98);
  --ink: #2d1f14;
  --muted: #705846;
  --gold: #d2a23b;
  --gold-soft: rgba(210, 162, 59, 0.2);
  --red: #7b251e;
  --green: #284f43;
  --navy: #243d56;
  --purple: #5c3e70;
  --sidebar-width: 300px;
  --shadow: 0 18px 45px rgba(53, 32, 13, 0.16);
  --radius: 18px;
}

body {
  background:
    linear-gradient(rgba(245, 238, 224, 0.82), rgba(245, 238, 224, 0.86)),
    url('assets/theme_relax.png') center/contain no-repeat fixed;
  color: var(--ink);
  font-family: 'Instrument Sans', system-ui, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-position: center center;
  background-size: 32px 32px;
  content: '';
  inset: 0;
  opacity: 0.18;
  pointer-events: none;
  position: fixed;
  z-index: 0;
}

#welcome-screen {
  align-items: center;
  background:
    linear-gradient(rgba(29, 20, 15, 0.55), rgba(29, 20, 15, 0.6)),
    url('assets/welcome_cover.png') center/cover no-repeat;
  display: flex;
  inset: 0;
  justify-content: center;
  position: fixed;
  z-index: 1000;
}

.welcome-content {
  animation: rise-in 1.1s ease-out;
  max-width: 720px;
  padding: 2.5rem;
  text-align: center;
}

/* welcome cover styles updated and cleaned up */

.welcome-crest {
  color: var(--gold);
  filter: drop-shadow(0 0 20px rgba(210, 162, 59, 0.55));
  font-size: 4.5rem;
  margin-bottom: 0.5rem;
}

.welcome-title,
.day-title,
.footer-title,
.block-header,
.modal-title,
.chapter-name {
  font-family: 'Cinzel', serif;
}

.welcome-title {
  color: #f1d98e;
  font-size: clamp(2.2rem, 5vw, 4rem);
  font-weight: 900;
  line-height: 1.12;
  text-shadow: 0 0 30px rgba(210, 162, 59, 0.18);
}

.welcome-subtitle {
  color: #d7c2a0;
  font-family: 'Fraunces', serif;
  font-size: clamp(1rem, 2.4vw, 1.35rem);
  margin: 0.9rem 0 1.5rem;
}

.welcome-meta {
  color: #c6b299;
  line-height: 1.8;
  margin-bottom: 2rem;
}

.enter-btn,
.action-pill,
.nav-btn,
.add-link-btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: 'Cinzel', serif;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.enter-btn {
  background: linear-gradient(135deg, #76261f, #9b3b2b);
  border: 1px solid rgba(241, 217, 142, 0.45);
  border-radius: 999px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  color: #f6e5af;
  font-size: 1.05rem;
  letter-spacing: 1.8px;
  padding: 1rem 2.2rem;
  text-transform: uppercase;
}

.enter-btn:hover,
.action-pill:hover,
.nav-btn:hover,
.add-link-btn:hover {
  transform: translateY(-1px);
}

#app {
  display: none;
  position: relative;
  z-index: 1;
}

.app-container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  background:
    radial-gradient(circle at top, rgba(210, 162, 59, 0.22), transparent 30%),
    linear-gradient(180deg, #2d1c12 0%, #372117 52%, #22140d 100%);
  border-right: 1px solid rgba(210, 162, 59, 0.28);
  bottom: 0;
  color: #f5e2be;
  left: 0;
  overflow-y: auto;
  padding-bottom: 1.5rem;
  position: fixed;
  top: 0;
  transition: transform 0.25s ease;
  width: var(--sidebar-width);
  z-index: 80;
}

.sidebar-header {
  border-bottom: 1px solid rgba(210, 162, 59, 0.22);
  padding: 1.4rem 1.2rem 1.25rem;
  text-align: center;
}

.sidebar-title {
  color: #f5d98d;
  font-size: 1.1rem;
  font-weight: 700;
}

.sidebar-subtitle {
  color: #d0b488;
  font-size: 0.82rem;
  margin-top: 0.4rem;
}

.sidebar-ai-badge {
  background: rgba(255, 248, 231, 0.08);
  border: 1px solid rgba(255, 238, 190, 0.14);
  border-radius: 999px;
  color: #f6e5af;
  font-size: 0.72rem;
  margin-top: 0.9rem;
  padding: 0.45rem 0.8rem;
}

.chapter-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.8rem;
}

.chapter-link {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 14px;
  color: inherit;
  cursor: pointer;
  display: flex;
  gap: 0.85rem;
  padding: 0.95rem 1rem;
  text-align: left;
  transition: background 0.18s ease, transform 0.18s ease;
  width: 100%;
}

.chapter-link:hover {
  background: rgba(255, 248, 231, 0.09);
  transform: translateX(2px);
}

.chapter-link.active {
  background: linear-gradient(135deg, rgba(210, 162, 59, 0.28), rgba(210, 162, 59, 0.08));
  box-shadow: inset 0 0 0 1px rgba(255, 240, 196, 0.16);
}

.chapter-num {
  color: #f2c76c;
  font-size: 0.82rem;
  min-width: 36px;
}

.chapter-info {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.2rem;
}

.chapter-name {
  color: #fff4d9;
  font-size: 0.94rem;
}

.chapter-weather {
  color: #d3bc98;
  font-size: 0.75rem;
}

.main-content {
  margin-left: var(--sidebar-width);
  max-width: 1180px;
  padding: 2rem 2.4rem 4rem;
  width: 100%;
}

.day-header {
  margin-bottom: 1.75rem;
  text-align: center;
}

.chapter-label {
  color: var(--red);
  font-size: 0.82rem;
  letter-spacing: 3px;
  margin-bottom: 0.45rem;
  text-transform: uppercase;
}

.day-title {
  color: #5a241b;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 900;
  line-height: 1.1;
}

.day-date {
  color: var(--muted);
  font-family: 'Fraunces', serif;
  font-size: 1rem;
  margin: 0.5rem 0 0.8rem;
}

.weather-bar {
  background: rgba(255, 249, 235, 0.84);
  border: 1px solid rgba(123, 37, 30, 0.1);
  border-radius: 999px;
  box-shadow: 0 10px 20px rgba(67, 36, 18, 0.08);
  color: var(--ink);
  display: inline-block;
  padding: 0.65rem 1.15rem;
}

.field-guide-band,
.day-summary-panel,
.activity-card,
.footer-section,
.activity-modal-card {
  backdrop-filter: blur(12px);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.field-guide-band {
  align-items: center;
  border: 1px solid rgba(123, 37, 30, 0.08);
  border-radius: 28px;
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1.3fr 1fr;
  margin-bottom: 1.1rem;
  overflow: hidden;
  padding: 1.4rem 1.5rem;
}

.field-guide-kicker,
.summary-label,
.modal-kicker {
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
}

.field-guide-copy h2 {
  font-family: 'Fraunces', serif;
  font-size: clamp(1.45rem, 3vw, 2rem);
  line-height: 1.15;
}

.field-guide-copy p,
.section-copy,
.summary-side-note,
.card-desc,
.modal-summary,
.ai-thread-answer,
.ai-suggestion-reason,
.modal-note-panel p,
.notes-textarea,
.link-input,
.link-url {
  color: var(--muted);
  line-height: 1.6;
}

.field-guide-art svg,
.card-graphic svg,
.modal-graphic svg,
.field-guide-img {
  display: block;
  width: 100%;
}

.field-guide-art {
  overflow: hidden;
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(67, 36, 18, 0.15);
}

.field-guide-img {
  max-height: 180px;
  object-fit: cover;
  transform: scale(1.08);
}

.day-summary-panel {
  align-items: center;
  border: 1px solid rgba(123, 37, 30, 0.08);
  border-radius: 22px;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding: 1rem 1.15rem;
}

.summary-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.summary-chip,
.card-status,
.card-vote-state,
.stat-pill {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.8rem;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
}

.summary-chip {
  background: rgba(210, 162, 59, 0.14);
  color: var(--ink);
}

.summary-chip-muted {
  background: rgba(35, 61, 86, 0.08);
  color: var(--muted);
}

.activity-block {
  margin-bottom: 2.25rem;
}

.block-header {
  color: var(--red);
  font-size: 1.18rem;
  font-weight: 700;
  margin-bottom: 0.9rem;
}

.options-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(285px, 1fr));
}

.activity-card {
  border: 1px solid rgba(123, 37, 30, 0.08);
  border-radius: 24px;
  cursor: pointer;
  overflow: hidden;
  padding: 0.9rem;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.activity-card:hover {
  transform: translateY(-3px);
}

.activity-card.selected {
  box-shadow: 0 22px 40px rgba(44, 79, 67, 0.18);
  outline: 2px solid rgba(40, 79, 67, 0.28);
}

.activity-card.dimmed {
  opacity: 0.58;
}

.card-graphic {
  margin-bottom: 0.9rem;
}

.card-topline,
.card-meta-row,
.card-actions,
.owlery-actions,
.modal-controls,
.edit-actions,
.day-nav,
.link-form,
.link-chips,
.modal-stat-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.card-topline {
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.card-status {
  background: rgba(123, 37, 30, 0.1);
  color: var(--red);
}

.card-vote-state {
  background: rgba(36, 61, 86, 0.08);
  color: var(--navy);
}

.card-title {
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1.25;
  margin-bottom: 0.45rem;
}

.card-meta-row {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0.8rem 0 0.85rem;
}

.card-meta-row span {
  background: rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
}

.card-actions {
  border-top: 1px solid rgba(123, 37, 30, 0.08);
  padding-top: 0.75rem;
  position: relative;
}

.card-action-btn,
.vote-btn {
  align-items: center;
  background: rgba(255, 252, 245, 0.94);
  border: 1px solid rgba(123, 37, 30, 0.12);
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  font-size: 0.76rem;
  gap: 0.25rem;
  padding: 0.45rem 0.72rem;
}

.vote-cluster {
  display: inline-flex;
  gap: 0.35rem;
  margin-left: auto;
}

.vote-btn.active {
  background: rgba(40, 79, 67, 0.14);
  border-color: rgba(40, 79, 67, 0.3);
  color: var(--green);
}

.move-dropdown {
  background: var(--panel-strong);
  border: 1px solid rgba(123, 37, 30, 0.14);
  border-radius: 16px;
  bottom: calc(100% + 8px);
  box-shadow: 0 18px 32px rgba(37, 20, 8, 0.2);
  display: none;
  min-width: 220px;
  padding: 0.45rem;
  position: absolute;
  right: 0;
  z-index: 10;
}

.move-dropdown.show {
  display: block;
}

.move-option {
  background: transparent;
  border: 0;
  border-radius: 12px;
  color: var(--ink);
  cursor: pointer;
  display: block;
  font: inherit;
  padding: 0.65rem 0.75rem;
  text-align: left;
  width: 100%;
}

.move-option:hover {
  background: rgba(210, 162, 59, 0.12);
}

.footer-section {
  border: 1px solid rgba(123, 37, 30, 0.08);
  border-radius: 24px;
  margin-bottom: 1.15rem;
  padding: 1.2rem;
}

.footer-title {
  color: var(--red);
  font-size: 1.06rem;
  margin-bottom: 0.55rem;
}

.notes-textarea,
.link-input,
.link-url,
.edit-grid input,
.edit-grid textarea {
  background: rgba(255, 252, 245, 0.95);
  border: 1px solid rgba(123, 37, 30, 0.16);
  border-radius: 14px;
  font: inherit;
  outline: none;
  width: 100%;
}

.notes-textarea,
.edit-grid textarea {
  min-height: 120px;
  padding: 0.95rem 1rem;
  resize: vertical;
}

.link-input,
.link-url,
.edit-grid input {
  min-height: 44px;
  padding: 0.75rem 0.9rem;
}

.notes-textarea:focus,
.link-input:focus,
.link-url:focus,
.edit-grid input:focus,
.edit-grid textarea:focus {
  border-color: rgba(36, 61, 86, 0.35);
  box-shadow: 0 0 0 4px rgba(36, 61, 86, 0.08);
}

.action-pill,
.add-link-btn,
.nav-btn {
  background: rgba(255, 252, 245, 0.96);
  border: 1px solid rgba(123, 37, 30, 0.12);
  border-radius: 999px;
  color: var(--ink);
  padding: 0.62rem 0.95rem;
}

.action-pill-strong,
.add-link-btn {
  background: linear-gradient(135deg, #7b251e, #a14532);
  border-color: rgba(123, 37, 30, 0.2);
  color: #fdf2cf;
}

/* link chips and photo thumbs removed */

.day-nav {
  justify-content: space-between;
  margin-top: 1.4rem;
}

.nav-btn {
  min-width: 150px;
}

.hamburger {
  align-items: center;
  background: linear-gradient(135deg, #7b251e, #a14532);
  border: 1px solid rgba(123, 37, 30, 0.12);
  border-radius: 14px;
  color: #fdf2cf;
  cursor: pointer;
  display: none;
  font-size: 1.2rem;
  height: 46px;
  justify-content: center;
  left: 1rem;
  position: fixed;
  top: 1rem;
  width: 46px;
  z-index: 120;
}

.sidebar-overlay,
.activity-modal {
  display: none;
}

.sidebar-overlay.show {
  background: rgba(17, 11, 8, 0.48);
  display: block;
  inset: 0;
  position: fixed;
  z-index: 70;
}

.activity-modal.show {
  display: block;
}

.activity-modal-close {
  background: rgba(22, 14, 10, 0.8);
  border: 0;
  border-radius: 999px;
  color: #fff6d7;
  cursor: pointer;
  font-size: 1.9rem;
  height: 42px;
  line-height: 1;
  position: absolute;
  right: 1rem;
  top: 1rem;
  width: 42px;
}

.activity-modal {
  inset: 0;
  position: fixed;
  z-index: 350;
}

.activity-modal-scrim {
  background: rgba(13, 10, 9, 0.6);
  inset: 0;
  position: absolute;
}

.activity-modal-card {
  border: 1px solid rgba(123, 37, 30, 0.16);
  border-radius: 28px;
  left: 50%;
  max-height: calc(100vh - 2.5rem);
  max-width: min(1040px, calc(100vw - 2rem));
  overflow: auto;
  position: absolute;
  top: 1.25rem;
  transform: translateX(-50%);
  width: 100%;
}

.activity-modal-body {
  padding: 1.4rem;
}

.activity-modal-hero {
  display: grid;
  gap: 1.1rem;
  grid-template-columns: 1fr 1.1fr;
}

.modal-graphic {
  overflow: hidden;
  border-radius: 14px;
  max-height: 150px;
  box-shadow: 0 6px 16px rgba(67, 36, 18, 0.12);
}

.card-graphic-img {
  display: block;
  width: 100%;
  height: 150px;
  object-fit: cover;
  transform: scale(1.08);
}

.modal-hero-copy {
  align-self: center;
}

.modal-title {
  color: var(--ink);
  font-size: clamp(1.6rem, 3.5vw, 2.5rem);
  line-height: 1.08;
}

.modal-summary {
  margin-top: 0.7rem;
}

.modal-stat-row {
  margin-top: 1rem;
}

.stat-pill {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}

.modal-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1.1rem;
}

.modal-section,
.modal-note-panel,
.ai-panel,
.edit-panel {
  background: rgba(255, 252, 245, 0.72);
  border: 1px solid rgba(123, 37, 30, 0.1);
  border-radius: 22px;
  padding: 1rem;
}

.modal-section h3 {
  color: var(--red);
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  margin-bottom: 0.55rem;
}

.modal-section ul {
  color: var(--muted);
  padding-left: 1.1rem;
}

.modal-section li + li {
  margin-top: 0.5rem;
}

.modal-note-panel,
.edit-panel,
.ai-panel {
  margin-top: 1rem;
}

.modal-note-title {
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 0.45rem;
  text-transform: uppercase;
}

.edit-panel summary {
  color: var(--ink);
  cursor: pointer;
  font-family: 'Cinzel', serif;
  font-weight: 700;
}

.edit-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 0.9rem;
}

.edit-grid label {
  color: var(--ink);
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
  gap: 0.35rem;
}

.edit-grid label:nth-child(3),
.edit-grid label:nth-child(6),
.edit-grid label:nth-child(7),
.edit-grid label:nth-child(8) {
  grid-column: 1 / -1;
}

.ai-empty {
  color: var(--muted);
  font-size: 0.92rem;
}

.ai-thread {
  margin-top: 0.9rem;
}

.ai-thread-answer p + p {
  margin-top: 0.8rem;
}

.ai-chat-history {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  max-height: 380px;
  overflow-y: auto;
  padding: 0.6rem;
  background: rgba(255, 255, 255, 0.45);
  border-radius: 12px;
  border: 1px dashed rgba(36, 61, 86, 0.1);
  margin-bottom: 1rem;
}

.ai-message {
  display: inline-block;
  padding: 0.75rem 1rem;
  border-radius: 18px;
  max-width: 85%;
  line-height: 1.45;
  font-size: 0.94rem;
  word-wrap: break-word;
}

.ai-msg-user {
  background: rgba(36, 61, 86, 0.08);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  border: 1px solid rgba(36, 61, 86, 0.05);
}

.ai-msg-assistant {
  background: rgba(255, 255, 255, 0.85);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(36, 61, 86, 0.05);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.ai-msg-header {
  font-size: 0.78rem;
  margin-bottom: 0.25rem;
  color: var(--ink);
  opacity: 0.72;
}

.ai-msg-body p + p {
  margin-top: 0.6rem;
}

.ai-suggestions-header {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  color: var(--ink);
  margin-bottom: 0.5rem;
  grid-column: 1 / -1;
}

.ai-suggestions {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin: 0.9rem 0;
}

.ai-suggestion-card {
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(36, 61, 86, 0.08);
  border-radius: 18px;
  padding: 0.85rem;
}

.ai-suggestion-title {
  color: var(--ink);
  font-family: 'Cinzel', serif;
  font-size: 0.86rem;
  margin-bottom: 0.35rem;
}

.ai-note-preview,
.ai-thread-meta {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 0.8rem;
}

[contenteditable="true"] {
  outline: 2px dashed rgba(36, 61, 86, 0.35);
}

.theme-train { background: linear-gradient(180deg, rgba(255, 248, 240, 0.95), rgba(255, 237, 220, 0.95)); }
.theme-mountain { background: linear-gradient(180deg, rgba(245, 250, 253, 0.96), rgba(236, 242, 246, 0.95)); }
.theme-gems { background: linear-gradient(180deg, rgba(240, 255, 251, 0.96), rgba(231, 250, 244, 0.95)); }
.theme-adventure { background: linear-gradient(180deg, rgba(244, 252, 247, 0.96), rgba(236, 248, 240, 0.95)); }
.theme-festival { background: linear-gradient(180deg, rgba(251, 243, 255, 0.95), rgba(245, 235, 249, 0.94)); }
.theme-cavern { background: linear-gradient(180deg, rgba(241, 246, 249, 0.96), rgba(232, 241, 245, 0.95)); }
.theme-relax { background: linear-gradient(180deg, rgba(249, 250, 242, 0.96), rgba(240, 245, 236, 0.95)); }
.theme-shop { background: linear-gradient(180deg, rgba(255, 249, 240, 0.96), rgba(250, 242, 231, 0.95)); }

@keyframes rise-in {
  from { opacity: 0; transform: translateY(28px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 980px) {
  .field-guide-band,
  .activity-modal-hero,
  .modal-grid,
  .edit-grid {
    grid-template-columns: 1fr;
  }

  .main-content {
    padding-inline: 1.25rem;
  }

  .day-summary-panel {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 768px) {
  body {
    background:
      linear-gradient(rgba(245, 238, 224, 0.72), rgba(245, 238, 224, 0.76)),
      url('assets/theme_relax.png') center/cover no-repeat fixed;
  }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .hamburger {
    display: inline-flex;
  }

  .main-content {
    margin-left: 0;
    padding: 4.5rem 1rem 3rem;
  }

  .options-grid {
    grid-template-columns: 1fr;
  }

  .activity-card {
    padding: 0.8rem;
  }

  .activity-modal-card {
    max-height: calc(100vh - 1rem);
    top: 0.5rem;
  }

  .activity-modal-body {
    padding: 1rem;
  }

  .day-nav {
    flex-direction: column;
  }
}
