:root {
  color-scheme: dark;
  --ground: #10182b;
  --ink: #f6effa;
  --muted: #bac4db;
  --panel: #1a2640;
  --line: #465676;
  --light: #e4d7fc;
  --deep: #171c36;
  --warm: #f4bc9f;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: radial-gradient(ellipse at 16% 6%, #192647, transparent 60%), var(--ground); color: var(--ink); font: 1rem/1.6 var(--sans); }
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-underline-offset: .22em; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .48; cursor: default; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--warm); outline-offset: 3px; }
.frame { width: min(1240px, calc(100% - 104px)); margin-inline: auto; }
.mast, .foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.mast { min-height: 75px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: .6rem; font: 400 1.42rem/1 var(--serif); text-decoration: none; white-space: nowrap; }
.brand span { display: block; width: .92rem; height: .92rem; border: 1px solid #a8a7d8; border-radius: 50%; box-shadow: inset .31rem -.12rem #d4c6f4; transform: rotate(-22deg); }
.mast nav { display: flex; gap: clamp(.8rem, 4vw, 2.6rem); font-size: .84rem; }
.mast nav a { text-decoration: none; color: var(--muted); }
.mast nav a:hover { color: var(--ink); text-decoration: underline; }
.hero { margin-block: 24px 52px; min-height: clamp(395px, 42vw, 565px); position: relative; display: flex; align-items: end; border: 1px solid #5c6b90; isolation: isolate; overflow: hidden; }
.hero img, .hero::after { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero img { object-fit: cover; object-position: 59% 51%; z-index: -2; }
.hero::after { content: ''; z-index: -1; background: linear-gradient(90deg, rgba(13,22,46,.91) 1%, rgba(13,22,46,.63) 34%, transparent 75%), linear-gradient(0deg, rgba(13,22,46,.63), transparent 58%); }
.hero-copy { padding: clamp(1.45rem, 5vw, 4.5rem); }
.hero h1, .guide h1 { font: 400 clamp(3.45rem, 7.7vw, 7.3rem)/.88 var(--serif); letter-spacing: -.072em; }
.hero p { max-width: 34ch; margin-block: 1.35rem; font-size: clamp(.96rem, 1.45vw, 1.16rem); color: #eee7fb; }
.action { display: inline-flex; gap: .7rem; min-height: 43px; align-items: center; justify-content: center; border: 1px solid var(--line); padding: .52rem .83rem; text-decoration: none; font-weight: 740; font-size: .91rem; border-radius: .25rem; }
.primary { background: var(--light); border-color: var(--light); color: var(--deep); }
.primary:hover { background: #f7e9ff; }
.secondary { background: transparent; color: var(--ink); }
.secondary:hover { background: #253453; }
#desk { scroll-margin-top: 1rem; }
.heading { border-bottom: 1px solid var(--line); padding-bottom: 1rem; display: flex; align-items: end; justify-content: space-between; gap: 1rem; }
.heading h2, .guide h2 { font: 400 clamp(2.15rem, 5vw, 3.65rem)/1 var(--serif); letter-spacing: -.05em; }
.heading p { color: var(--muted); font-size: .86rem; margin-top: .4rem; }
.notice { color: #e6c4ac; font-size: .85rem; min-height: 1.4rem; margin-block: .45rem; }
.notice:empty { min-height: 0; }
.desk { display: grid; grid-template-columns: minmax(0,.75fr) minmax(0,1.25fr); gap: clamp(1rem,4vw,3.35rem); align-items: start; margin-block: 1.3rem 4.5rem; }
form, .sample-note { background: var(--panel); border: 1px solid var(--line); padding: clamp(1rem,2.6vw,1.65rem); }
.desk h3 { font: 400 clamp(1.55rem,3.3vw,2.25rem)/1.1 var(--serif); }
label { display: grid; gap: .24rem; font-size: .85rem; font-weight: 720; }
form label { margin-top: .8rem; }
input, select, textarea { color: var(--ink); min-height: 41px; min-width: 0; width: 100%; background: #121e36; border: 1px solid #687997; border-radius: .2rem; padding: .48rem .6rem; font-size: 1rem; }
input::placeholder, textarea::placeholder { color: #aebad2; }
textarea { resize: vertical; }
.hint, .sample-note p { margin-top: .4rem; font-size: .84rem; color: var(--muted); }
.actions, .backup, .entry-actions, .entry-tags { display: flex; flex-wrap: wrap; gap: .55rem .9rem; margin-top: .85rem; }
.backup-options { flex-basis: 100%; padding: .65rem .8rem; background: var(--panel); border: 1px solid var(--line); }
.backup-options details { margin-top: .4rem; color: var(--muted); font-size: .85rem; }
.backup-options summary { cursor: pointer; }
.backup-options label { margin-top: .65rem; }
.text-button { padding: .35rem 0; background: none; color: var(--light); border: 0; text-decoration: underline; text-underline-offset: .2em; font-size: .86rem; font-weight: 650; }
.archive-head { display: flex; align-items: end; justify-content: space-between; gap: .7rem; margin-bottom: .65rem; }
.archive-head select { width: auto; min-height: 38px; font-size: .85rem; }
.patterns { padding: .9rem 1.1rem; border: 1px solid var(--line); background: #14213a; }
.patterns h4 { font-size: .95rem; margin-bottom: .25rem; }
.patterns p, .results p { color: var(--muted); font-size: .84rem; }
.frequency, .pairs, .entries { list-style-type: none; margin: 0; padding: 0; }
.frequency li { display: grid; grid-template-columns: minmax(5.2rem,.75fr) 1.35fr auto; align-items: center; gap: .35rem; }
.frequency button { background: none; border: 0; color: var(--light); font-size: .85rem; padding: .27rem 0; text-align: left; overflow-wrap: anywhere; }
.frequency button:hover, .pair:hover, .tag:hover { text-decoration: underline; text-underline-offset: .2em; }
.frequency meter { width: 100%; height: .66rem; }
.frequency meter::-webkit-meter-bar { background: #293961; border: 0; }
.frequency meter::-webkit-meter-optimum-value { background: #a7a2e0; }
.frequency li span { text-align: right; min-width: 1.2rem; color: var(--muted); font-size: .84rem; }
.pairs { display: flex; flex-wrap: wrap; gap: .45rem; }
.pairs:not(:empty) { margin-top: .7rem; padding-top: .55rem; border-top: 1px solid var(--line); }
.pair, .tag { background: #242c4f; border: 1px solid #7380a4; color: var(--ink); padding: .25rem .55rem; border-radius: .25rem; font-size: .8rem; overflow-wrap: anywhere; }
.search { margin-block: .9rem .4rem; }
.results { display: flex; align-items: baseline; justify-content: space-between; gap: .8rem; min-height: 1.5rem; }
.entries li { border-bottom: 1px solid var(--line); }
.entries summary { cursor: pointer; list-style: none; display: grid; grid-template-columns: 1.1rem minmax(0, 1fr) auto; align-items: baseline; gap: .5rem; padding: .78rem 0; }
.entries summary::-webkit-details-marker { display: none; }
.entries summary::before { content: '+'; color: var(--warm); }
.entries details[open] summary::before { content: '−'; }
.entries time { color: var(--muted); font-size: .76rem; white-space: nowrap; }
.entries summary strong { overflow-wrap: anywhere; }
.dream-text { padding-left: 1.6rem; overflow-wrap: anywhere; white-space: pre-wrap; font-size: .92rem; }
.entry-tags, .entry-actions { padding-left: 1.6rem; margin: .5rem 0 .6rem; }
#more { margin-top: .8rem; }
.foot { border-top: 1px solid var(--line); padding-block: 1rem 1.7rem; }
.foot > a:last-child { font-size: .84rem; color: var(--muted); }
.guide { max-width: 770px; padding-block: 3.5rem; }
.guide h1 { font-size: clamp(3rem, 7vw, 5.9rem); }
.guide .intro { color: var(--muted); font-size: 1.13rem; margin-block: 1.4rem; max-width: 52ch; }
.guide section { border-top: 1px solid var(--line); margin-top: 2rem; padding-top: 1.35rem; }
.guide h2 { font-size: clamp(1.7rem,4vw,2.6rem); margin-bottom: .65rem; }
.guide ul { padding-left: 1.15rem; }
.guide li + li { margin-top: .5rem; }
@media (max-width: 850px) { .frame { width: calc(100% - 48px); } }
@media (max-width: 610px) {
  .frame { width: calc(100% - 30px); }
  .mast { min-height: 60px; }
  .mast nav { font-size: .76rem; }
  .brand { font-size: 1.2rem; }
  .hero { min-height: 405px; margin-block: 17px 35px; }
  .hero img { object-position: 60% 38%; }
  .hero::after { background: linear-gradient(0deg, #141e39, rgba(16,26,54,.75) 46%, transparent 88%); }
  .hero h1 { font-size: clamp(3.4rem, 13vw, 5rem); }
  .hero p { margin-block: .8rem; }
  .heading { align-items: start; flex-direction: column; gap: .65rem; }
  .desk { grid-template-columns: 1fr; gap: 1.5rem; }
  .archive-head label { font-size: .75rem; }
  .foot { align-items: start; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
