:root {
  --an-ink: #141226;
  --an-plum: #2a1838;
  --an-panel: rgba(24, 19, 44, 0.86);
  --an-panel-deep: rgba(18, 15, 34, 0.92);
  --an-gold: #d4af6a;
  --an-gold-soft: rgba(212, 175, 106, 0.36);
  --an-gold-faint: rgba(212, 175, 106, 0.16);
  --an-gold-bright: #f1d38a;
  --an-ivory: #f3ead8;
  --an-ivory-muted: #c8bda8;
  --an-ivory-dim: #988e7f;
  --an-sage: #9bb59a;
  --an-rose: #d49a9a;
  --an-twilight: #7d8fd4;
  --an-strange: #b79ad8;
  --an-nightmare: #8a5a7a;
  --an-danger: #c96f73;
  --an-font-display: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --an-font-body: Georgia, "Times New Roman", serif;
  --an-body-size: 17px;
  --an-radius: 14px;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  background: linear-gradient(180deg, var(--an-ink) 0%, #1c1530 48%, var(--an-plum) 100%);
  background-attachment: fixed;
  color: var(--an-ivory);
  font-family: var(--an-font-body);
  font-size: var(--an-body-size);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body[data-font-size="small"] {
  --an-body-size: 15px;
}

body[data-font-size="medium"] {
  --an-body-size: 17px;
}

body[data-font-size="large"] {
  --an-body-size: 19.5px;
}

/* Layered drifting starfield backdrop */
.an-starfield {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.an-star-layer {
  position: absolute;
  inset: -120px;
  background-repeat: repeat;
  opacity: 0.55;
}

.an-star-layer--far {
  background-image:
    radial-gradient(1px 1px at 14% 22%, rgba(243, 234, 216, 0.55), transparent),
    radial-gradient(1px 1px at 42% 68%, rgba(212, 175, 106, 0.45), transparent),
    radial-gradient(1px 1px at 78% 18%, rgba(243, 234, 216, 0.5), transparent),
    radial-gradient(1px 1px at 64% 84%, rgba(183, 154, 216, 0.4), transparent),
    radial-gradient(1px 1px at 89% 54%, rgba(243, 234, 216, 0.45), transparent),
    radial-gradient(1px 1px at 26% 91%, rgba(212, 175, 106, 0.4), transparent);
  background-size: 320px 320px;
  animation: an-drift-far 180s linear infinite;
}

.an-star-layer--mid {
  background-image:
    radial-gradient(1.3px 1.3px at 18% 40%, rgba(243, 234, 216, 0.65), transparent),
    radial-gradient(1.2px 1.2px at 56% 16%, rgba(241, 211, 138, 0.5), transparent),
    radial-gradient(1.3px 1.3px at 82% 72%, rgba(243, 234, 216, 0.55), transparent),
    radial-gradient(1.2px 1.2px at 34% 82%, rgba(155, 181, 154, 0.4), transparent);
  background-size: 460px 460px;
  animation: an-drift-mid 120s linear infinite;
}

.an-star-layer--near {
  background-image:
    radial-gradient(1.6px 1.6px at 24% 12%, rgba(241, 211, 138, 0.65), transparent),
    radial-gradient(1.6px 1.6px at 72% 46%, rgba(243, 234, 216, 0.65), transparent),
    radial-gradient(1.4px 1.4px at 48% 88%, rgba(212, 175, 106, 0.5), transparent);
  background-size: 620px 620px;
  animation: an-drift-near 85s linear infinite;
}

@keyframes an-drift-far {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(60px, 36px, 0); }
}

@keyframes an-drift-mid {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-80px, 50px, 0); }
}

@keyframes an-drift-near {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(90px, -60px, 0); }
}

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

@keyframes an-shimmer {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* App shell */
#app {
  position: relative;
  z-index: 1;
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px 18px 64px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Accessible gold focus ring */
:focus-visible {
  outline: 2px solid var(--an-gold-bright);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(212, 175, 106, 0.25);
}

/* Header */
.an-header {
  text-align: center;
  margin-bottom: 22px;
  padding-top: 6px;
}

.an-brand {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.an-crest {
  width: 180px;
  height: 28px;
  color: var(--an-gold);
  opacity: 0.9;
}

.an-title {
  margin: 0;
  font-family: var(--an-font-display);
  font-size: clamp(1.75rem, 3.2vw, 2.5rem);
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-variant: small-caps;
  color: var(--an-ivory);
  text-shadow: 0 0 24px rgba(212, 175, 106, 0.22);
}

.an-subtitle {
  margin: 2px 0 0;
  font-size: 0.92rem;
  font-style: italic;
  color: var(--an-ivory-muted);
  letter-spacing: 0.04em;
}

/* Cartouche Navigation Tabs */
.an-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 18px auto 24px;
  max-width: 820px;
}

.an-tab {
  position: relative;
  appearance: none;
  background: linear-gradient(180deg, rgba(34, 24, 58, 0.9), rgba(20, 16, 38, 0.92));
  color: var(--an-ivory-muted);
  border: 1px solid var(--an-gold-soft);
  border-radius: 999px 999px 10px 10px;
  padding: 9px 18px 8px;
  font-family: var(--an-font-display);
  font-size: 0.92rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  font-variant: small-caps;
  cursor: pointer;
  transition: color 0.25s ease, border-color 0.25s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.an-tab::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(212, 175, 106, 0.16);
  border-radius: 999px 999px 7px 7px;
  pointer-events: none;
}

.an-tab:hover {
  color: var(--an-ivory);
  border-color: var(--an-gold);
  box-shadow: 0 0 14px rgba(212, 175, 106, 0.18);
}

.an-tab[aria-selected="true"] {
  color: var(--an-gold-bright);
  border-color: var(--an-gold);
  background: linear-gradient(180deg, rgba(55, 36, 82, 0.95), rgba(28, 20, 48, 0.96));
  box-shadow: 0 0 18px rgba(212, 175, 106, 0.22), inset 0 1px 0 rgba(241, 211, 138, 0.28);
}

.an-tab-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  font-size: 0.72rem;
  font-family: var(--an-font-body);
  letter-spacing: 0;
  border-radius: 999px;
  background: rgba(212, 175, 106, 0.16);
  color: var(--an-gold-bright);
  vertical-align: middle;
}

/* Workspace Layout */
.an-workspace {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
}

.an-companion {
  display: none;
}

@media (min-width: 1100px) {
  .an-workspace--split {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  }
  .an-workspace--split .an-companion {
    display: block;
    position: sticky;
    top: 20px;
  }
}

.an-view {
  animation: an-rise 0.35s ease both;
}

/* Art Nouveau Framed Panel */
.an-panel {
  position: relative;
  background: linear-gradient(180deg, var(--an-panel), var(--an-panel-deep));
  border: 1px solid var(--an-gold-soft);
  border-radius: var(--an-radius);
  padding: 26px 24px 28px;
  box-shadow: 0 12px 36px rgba(6, 4, 16, 0.45), 0 0 24px rgba(212, 175, 106, 0.06);
  transition: border-color 0.35s ease, box-shadow 0.35s ease;
}

/* Inner gold double border with subtle shimmer on hover */
.an-panel::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(212, 175, 106, 0.24);
  border-radius: calc(var(--an-radius) - 4px);
  pointer-events: none;
  transition: border-color 0.35s ease;
}

.an-panel:hover {
  border-color: rgba(212, 175, 106, 0.65);
  box-shadow: 0 12px 38px rgba(6, 4, 16, 0.5), 0 0 28px rgba(212, 175, 106, 0.11);
}

.an-panel:hover::before {
  border-image: linear-gradient(
      115deg,
      rgba(212, 175, 106, 0.22) 0%,
      rgba(241, 211, 138, 0.68) 45%,
      rgba(212, 175, 106, 0.22) 100%
    )
    1;
}

.an-corner {
  position: absolute;
  width: 34px;
  height: 34px;
  color: var(--an-gold);
  opacity: 0.72;
  pointer-events: none;
}

.an-corner--tl { top: 6px; left: 6px; }
.an-corner--tr { top: 6px; right: 6px; transform: scaleX(-1); }
.an-corner--bl { bottom: 6px; left: 6px; transform: scaleY(-1); }
.an-corner--br { bottom: 6px; right: 6px; transform: scale(-1, -1); }

/* Arched Cartouche Heading */
.an-cartouche {
  position: relative;
  text-align: center;
  margin: 0 auto 22px;
  padding: 10px 24px 12px;
  max-width: 440px;
}

.an-cartouche-arch {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: var(--an-gold);
  opacity: 0.65;
  pointer-events: none;
}

.an-cartouche-title {
  position: relative;
  margin: 0;
  font-family: var(--an-font-display);
  font-size: 1.25rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-variant: small-caps;
  color: var(--an-gold-bright);
}

.an-cartouche-sub {
  position: relative;
  margin: 3px 0 0;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--an-ivory-muted);
}

.an-divider {
  display: block;
  width: 100%;
  max-width: 360px;
  height: 18px;
  margin: 20px auto;
  color: var(--an-gold);
  opacity: 0.6;
}

/* Form Elements (layered over forge.ui.theme) */
.an-field {
  margin-bottom: 18px;
}

.an-label {
  display: block;
  margin-bottom: 6px;
  font-family: var(--an-font-display);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--an-gold);
}

.an-input,
.an-textarea,
.an-select {
  width: 100%;
  background: rgba(14, 11, 28, 0.82);
  color: var(--an-ivory);
  border: 1px solid rgba(212, 175, 106, 0.34);
  border-radius: 9px;
  padding: 10px 13px;
  font-family: var(--an-font-body);
  font-size: 1rem;
  line-height: 1.55;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.an-input::placeholder,
.an-textarea::placeholder {
  color: var(--an-ivory-dim);
  font-style: italic;
}

.an-input:focus,
.an-textarea:focus,
.an-select:focus {
  border-color: var(--an-gold);
  background: rgba(18, 14, 36, 0.94);
  box-shadow: 0 0 16px rgba(212, 175, 106, 0.18);
  outline: none;
}

.an-textarea {
  min-height: 170px;
  resize: vertical;
}

.an-form-row {
  display: grid;
  grid-template-columns: 165px minmax(0, 1fr);
  gap: 14px;
}

@media (max-width: 600px) {
  .an-form-row {
    grid-template-columns: 1fr;
  }
}

.an-error {
  margin: 5px 0 0;
  font-size: 0.84rem;
  color: #eb9a9e;
  min-height: 1.2em;
}

.an-hint {
  margin: 4px 0 0;
  font-size: 0.84rem;
  color: var(--an-ivory-dim);
  font-style: italic;
}

/* Buttons */
.an-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--an-gold);
  background: linear-gradient(180deg, rgba(212, 175, 106, 0.24), rgba(164, 126, 62, 0.18));
  color: var(--an-ivory);
  font-family: var(--an-font-display);
  font-size: 0.88rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.an-btn:hover {
  background: linear-gradient(180deg, rgba(212, 175, 106, 0.36), rgba(164, 126, 62, 0.26));
  box-shadow: 0 0 16px rgba(212, 175, 106, 0.24);
  color: var(--an-gold-bright);
}

.an-btn--primary {
  background: linear-gradient(180deg, #dfb974, #b68c44);
  color: #161124;
  border-color: var(--an-gold-bright);
  font-weight: 600;
}

.an-btn--primary:hover {
  background: linear-gradient(180deg, #edd08f, #c89d52);
  color: #120e1e;
  box-shadow: 0 0 20px rgba(241, 211, 138, 0.35);
}

.an-btn--ghost {
  background: transparent;
  border-color: rgba(212, 175, 106, 0.32);
  color: var(--an-ivory-muted);
}

.an-btn--ghost:hover {
  background: rgba(212, 175, 106, 0.1);
  color: var(--an-ivory);
  border-color: var(--an-gold);
}

.an-btn--danger {
  border-color: rgba(201, 111, 115, 0.65);
  background: rgba(201, 111, 115, 0.14);
  color: #f3b5b7;
}

.an-btn--danger:hover {
  background: rgba(201, 111, 115, 0.28);
  color: #ffe2e3;
  border-color: #e48c90;
}

.an-btn--sm {
  padding: 5px 12px;
  font-size: 0.78rem;
}

.an-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Symbol Chip Input & Autocomplete */
.an-chip-box {
  position: relative;
}

.an-chip-input-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  min-height: 46px;
  padding: 6px 10px;
  background: rgba(14, 11, 28, 0.82);
  border: 1px solid rgba(212, 175, 106, 0.34);
  border-radius: 9px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.an-chip-input-wrap:focus-within {
  border-color: var(--an-gold);
  box-shadow: 0 0 16px rgba(212, 175, 106, 0.18);
}

.an-chip-input {
  flex: 1 1 150px;
  min-width: 120px;
  border: 0;
  background: transparent;
  color: var(--an-ivory);
  font-family: var(--an-font-body);
  font-size: 0.96rem;
  padding: 4px 2px;
  outline: none;
}

.an-chip-input::placeholder {
  color: var(--an-ivory-dim);
  font-style: italic;
}

.an-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 106, 0.55);
  background: rgba(212, 175, 106, 0.13);
  color: var(--an-ivory);
  font-size: 0.86rem;
  line-height: 1.3;
}

.an-chip--link {
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.an-chip--link:hover {
  background: rgba(212, 175, 106, 0.26);
  border-color: var(--an-gold-bright);
  color: var(--an-gold-bright);
}

.an-chip-remove {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--an-gold);
  cursor: pointer;
  padding: 0 2px;
  font-size: 1rem;
  line-height: 1;
}

.an-chip-remove:hover {
  color: var(--an-ivory);
}

.an-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  list-style: none;
  margin: 0;
  padding: 4px;
  background: #1a1430;
  border: 1px solid var(--an-gold);
  border-radius: 10px;
  box-shadow: 0 14px 32px rgba(5, 3, 14, 0.72);
}

.an-suggestion-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: 7px;
  cursor: pointer;
  color: var(--an-ivory);
  font-size: 0.94rem;
}

.an-suggestion-item u {
  text-decoration: underline;
  text-decoration-color: var(--an-gold-bright);
  color: var(--an-gold-bright);
}

.an-suggestion-item[aria-selected="true"],
.an-suggestion-item:hover {
  background: rgba(212, 175, 106, 0.2);
}

.an-suggestion-count {
  font-size: 0.78rem;
  color: var(--an-ivory-dim);
}

/* Mood Picker */
.an-mood-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

@media (max-width: 640px) {
  .an-mood-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.an-mood-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 6px;
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 106, 0.24);
  background: rgba(14, 11, 28, 0.65);
  color: var(--an-ivory-muted);
  cursor: pointer;
  font-family: var(--an-font-display);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: border-color 0.25s ease, background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.an-mood-btn:hover {
  border-color: var(--mood-color, var(--an-gold));
  color: var(--an-ivory);
}

.an-mood-btn[aria-checked="true"] {
  border-color: var(--mood-color, var(--an-gold));
  background: rgba(212, 175, 106, 0.12);
  color: var(--an-ivory);
  box-shadow: 0 0 14px color-mix(in srgb, var(--mood-color, #d4af6a) 30%, transparent);
}

/* Lucidity & Recurring */
.an-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.an-lucidity {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.an-star-btn {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 3px;
  cursor: pointer;
  color: var(--an-gold);
  line-height: 1;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.an-star-btn:hover {
  transform: scale(1.12);
}

.an-lucidity-text {
  font-size: 0.85rem;
  color: var(--an-ivory-muted);
  margin-left: 4px;
  font-style: italic;
}

.an-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.94rem;
  color: var(--an-ivory-muted);
}

.an-checkbox-label input {
  accent-color: var(--an-gold);
  width: 17px;
  height: 17px;
  cursor: pointer;
}

.an-editor-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(212, 175, 106, 0.16);
}

.an-draft-status {
  font-size: 0.82rem;
  color: var(--an-ivory-dim);
  font-style: italic;
}

.an-edit-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 16px;
  border-radius: 10px;
  border: 1px solid rgba(212, 175, 106, 0.45);
  background: rgba(212, 175, 106, 0.1);
  font-size: 0.9rem;
}

/* Atlas Canvas */
.an-atlas-stage {
  position: relative;
  width: 100%;
  height: 500px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(212, 175, 106, 0.34);
  background: radial-gradient(ellipse at 50% 42%, #24193d 0%, #141028 65%, #0d0a1b 100%);
  touch-action: none;
}

.an-atlas-stage--compact {
  height: 460px;
}

@media (max-width: 640px) {
  .an-atlas-stage {
    height: 390px;
  }
}

.an-atlas-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

.an-atlas-canvas:active {
  cursor: grabbing;
}

.an-atlas-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
  z-index: 4;
}

.an-atlas-ctrl {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(212, 175, 106, 0.5);
  background: rgba(18, 14, 36, 0.84);
  color: var(--an-gold-bright);
  font-family: var(--an-font-display);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.an-atlas-ctrl:hover {
  background: rgba(212, 175, 106, 0.22);
}

.an-atlas-empty-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  pointer-events: none;
}

.an-atlas-empty-overlay p {
  margin: 0;
  font-style: italic;
  color: var(--an-ivory-muted);
  font-size: 1.05rem;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
}

.an-atlas-empty-overlay button {
  pointer-events: auto;
}

.an-star-card {
  position: absolute;
  z-index: 6;
  max-width: 240px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--an-gold);
  background: rgba(18, 14, 34, 0.95);
  box-shadow: 0 12px 28px rgba(4, 2, 12, 0.72), 0 0 18px rgba(212, 175, 106, 0.16);
  pointer-events: none;
  font-size: 0.85rem;
}

.an-star-card h4 {
  margin: 0 0 4px;
  font-family: var(--an-font-display);
  font-size: 0.98rem;
  letter-spacing: 0.08em;
  text-transform: capitalize;
  color: var(--an-gold-bright);
}

.an-star-card-meta {
  color: var(--an-ivory-muted);
  margin: 0 0 6px;
  font-size: 0.8rem;
}

.an-star-card-moods {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.an-mood-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
}

.an-mood-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.an-constellation-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.an-constellation-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 106, 0.36);
  background: rgba(212, 175, 106, 0.08);
  font-size: 0.84rem;
  color: var(--an-ivory);
}

.an-constellation-tag strong {
  font-family: var(--an-font-display);
  font-weight: 400;
  color: var(--an-gold-bright);
  letter-spacing: 0.05em;
}

.an-kbd-hint {
  margin: 10px 0 0;
  font-size: 0.8rem;
  color: var(--an-ivory-dim);
  text-align: center;
}

/* Journal */
.an-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.an-toolbar .an-input {
  flex: 2 1 200px;
}

.an-toolbar .an-select {
  flex: 1 1 140px;
}

.an-filter-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(212, 175, 106, 0.35);
  background: rgba(212, 175, 106, 0.09);
  font-size: 0.88rem;
}

.an-dream-list {
  display: grid;
  gap: 14px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.an-dream-card {
  position: relative;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 106, 0.28);
  background: rgba(16, 13, 32, 0.76);
  cursor: pointer;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.an-dream-card:hover {
  border-color: var(--an-gold);
  background: rgba(24, 19, 44, 0.9);
  box-shadow: 0 6px 22px rgba(6, 4, 16, 0.4), 0 0 16px rgba(212, 175, 106, 0.1);
}

.an-dream-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.an-dream-date {
  font-family: var(--an-font-display);
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--an-gold);
}

.an-dream-title {
  margin: 2px 0 8px;
  font-family: var(--an-font-display);
  font-size: 1.18rem;
  font-weight: 400;
  color: var(--an-ivory);
}

.an-dream-excerpt {
  margin: 0 0 12px;
  color: var(--an-ivory-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.an-dream-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.an-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.an-dream-badges {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--an-ivory-muted);
}

.an-mark {
  background: rgba(241, 211, 138, 0.28);
  color: var(--an-ivory);
  border-radius: 3px;
  padding: 0 2px;
}

/* Reading View */
.an-reading {
  animation: an-rise 0.3s ease both;
}

.an-reading-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}

.an-reading-body {
  white-space: pre-wrap;
  margin: 18px 0 22px;
  color: var(--an-ivory);
  line-height: 1.72;
}

.an-reading-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-size: 0.9rem;
  color: var(--an-ivory-muted);
  margin-bottom: 14px;
}

/* Tides (Insights) */
.an-tides-grid {
  display: grid;
  gap: 22px;
}

.an-subpanel {
  padding: 18px;
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 106, 0.24);
  background: rgba(15, 12, 30, 0.64);
}

.an-subpanel h3 {
  margin: 0 0 12px;
  font-family: var(--an-font-display);
  font-size: 0.95rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--an-gold);
  font-weight: 400;
}

.an-lunar-row {
  display: grid;
  grid-template-columns: repeat(15, minmax(0, 1fr));
  gap: 8px 6px;
}

@media (max-width: 640px) {
  .an-lunar-row {
    grid-template-columns: repeat(10, minmax(0, 1fr));
  }
}

.an-lunar-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 2px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--an-ivory-dim);
  cursor: pointer;
  font-size: 0.68rem;
}

.an-lunar-cell:hover,
.an-lunar-cell[aria-pressed="true"] {
  border-color: rgba(212, 175, 106, 0.45);
  background: rgba(212, 175, 106, 0.08);
  color: var(--an-ivory);
}

.an-lunar-detail {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(212, 175, 106, 0.08);
  border: 1px solid rgba(212, 175, 106, 0.22);
  font-size: 0.88rem;
  color: var(--an-ivory-muted);
}

.an-streak-box {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.an-streak-main {
  margin: 0;
  font-size: 1.12rem;
  color: var(--an-ivory);
}

.an-streak-sub {
  margin: 0;
  font-size: 0.88rem;
  color: var(--an-ivory-muted);
  font-style: italic;
}

.an-bars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.an-bar-item {
  display: grid;
  grid-template-columns: minmax(100px, 160px) minmax(0, 1fr) 36px;
  align-items: center;
  gap: 10px;
}

.an-bar-label {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--an-ivory);
  text-align: left;
  font-family: var(--an-font-body);
  font-size: 0.94rem;
  cursor: pointer;
  padding: 2px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.an-bar-label:hover {
  color: var(--an-gold-bright);
  text-decoration: underline;
}

.an-bar-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(212, 175, 106, 0.12);
  overflow: hidden;
}

.an-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(212, 175, 106, 0.6), var(--an-gold-bright));
}

.an-bar-count {
  text-align: right;
  font-size: 0.84rem;
  color: var(--an-gold);
}

/* Settings */
.an-settings-group {
  margin-bottom: 22px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(212, 175, 106, 0.18);
}

.an-settings-group:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.an-settings-group h3 {
  margin: 0 0 8px;
  font-family: var(--an-font-display);
  font-size: 0.96rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--an-gold);
  font-weight: 400;
}

.an-settings-group p {
  margin: 0 0 12px;
  font-size: 0.92rem;
  color: var(--an-ivory-muted);
}

.an-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.an-merge-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

@media (max-width: 640px) {
  .an-merge-row {
    grid-template-columns: 1fr;
  }
}

/* Empty State */
.an-empty {
  text-align: center;
  padding: 28px 16px;
  color: var(--an-ivory-muted);
}

.an-empty p {
  margin: 0 0 16px;
  font-style: italic;
}

/* Undo Floating Bar */
.an-undo-bar {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 18px;
  border-radius: 999px;
  border: 1px solid var(--an-gold);
  background: rgba(20, 15, 38, 0.96);
  box-shadow: 0 12px 32px rgba(4, 2, 12, 0.72), 0 0 20px rgba(212, 175, 106, 0.22);
  color: var(--an-ivory);
  animation: an-rise 0.25s ease both;
}

/* Footer */
.an-footer {
  margin-top: 28px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--an-ivory-dim);
}

.an-footer kbd {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(212, 175, 106, 0.35);
  background: rgba(212, 175, 106, 0.08);
  color: var(--an-gold-bright);
  font-family: var(--an-font-display);
  font-size: 0.76rem;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .an-star-layer,
  .an-view,
  .an-reading,
  .an-undo-bar {
    animation: none !important;
  }
  * {
    transition-duration: 0.01ms !important;
  }
}

/* Print View for Dreams */
@media print {
  html,
  body {
    background: #ffffff !important;
    color: #1b1724 !important;
    font-size: 12pt !important;
  }
  .an-starfield,
  .an-nav,
  .an-companion,
  .an-footer,
  .an-reading-top,
  .an-undo-bar,
  .an-toolbar,
  .an-filter-banner {
    display: none !important;
  }
  #app {
    max-width: 100%;
    padding: 0;
  }
  .an-header {
    margin-bottom: 16pt;
    border-bottom: 1pt solid #9c7c3e;
    padding-bottom: 10pt;
  }
  .an-title,
  .an-cartouche-title,
  .an-dream-title,
  .an-dream-date {
    color: #1b1724 !important;
    text-shadow: none !important;
  }
  .an-subtitle,
  .an-reading-meta,
  .an-reading-body {
    color: #2b2636 !important;
  }
  .an-panel {
    background: #ffffff !important;
    border: 1pt solid #9c7c3e !important;
    box-shadow: none !important;
    padding: 18pt !important;
  }
  .an-panel::before {
    border-color: rgba(156, 124, 62, 0.4) !important;
  }
  .an-corner,
  .an-crest,
  .an-cartouche-arch,
  .an-divider {
    color: #9c7c3e !important;
  }
  .an-chip {
    border-color: #9c7c3e !important;
    background: #f8f4ea !important;
    color: #1b1724 !important;
  }
}
