:root {
  --bg: #0b1419;
  --bg2: #122028;
  --ink: #e9f0f3;
  --muted: #8aa0ab;
  --accent: #3db8a0;
  --accent-ink: #041411;
  --warm: #f0c27a;
  --line: rgba(233, 240, 243, 0.12);
  --panel: rgba(18, 32, 40, 0.72);
  --shelf: rgba(61, 184, 160, 0.08);
  --font: "Karla", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 70% 50% at 80% 0%, rgba(61, 184, 160, 0.18), transparent 55%),
    radial-gradient(ellipse 45% 40% at 5% 85%, rgba(240, 194, 122, 0.1), transparent 50%),
    linear-gradient(168deg, var(--bg), #0f1c24 48%, var(--bg2));
  animation: wash 16s ease-in-out infinite alternate;
}
@keyframes wash {
  from { opacity: 1; }
  to { opacity: 0.88; }
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.top nav { display: flex; gap: 0.75rem; align-items: center; }
.top nav a:not(.btn) { color: var(--muted); text-decoration: none; font-size: 0.95rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  text-decoration: none;
  font: inherit;
  font-weight: 600;
  padding: 0.65rem 1.1rem;
  border-radius: 3px;
  transition: transform 0.15s ease, background 0.15s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn.buy { background: var(--accent); color: var(--accent-ink); }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* Landing */
.hero {
  min-height: calc(100vh - 4rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem 1.5rem 4rem;
  max-width: 42rem;
  position: relative;
}
.hero::before {
  content: "“";
  position: absolute;
  top: 12%;
  right: 8%;
  font-family: var(--display);
  font-size: clamp(8rem, 28vw, 14rem);
  line-height: 0.7;
  color: rgba(61, 184, 160, 0.12);
  pointer-events: none;
  animation: floatQ 8s ease-in-out infinite alternate;
}
@keyframes floatQ {
  from { transform: translateY(0); }
  to { transform: translateY(12px); }
}
.brand-hero {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.6rem, 9vw, 4.2rem);
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
  line-height: 0.95;
  color: var(--ink);
}
.brand-hero span {
  display: block;
  color: var(--warm);
  font-style: italic;
  font-weight: 500;
}
.hero h1 {
  font-size: clamp(1.2rem, 3vw, 1.55rem);
  font-weight: 600;
  margin: 0 0 0.75rem;
  max-width: 24ch;
}
.lede { color: var(--muted); margin: 0 0 1.75rem; max-width: 36ch; }
.cta-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.strip {
  padding: 2.5rem 1.5rem 3rem;
  border-top: 1px solid var(--line);
  max-width: 42rem;
  background: linear-gradient(180deg, transparent, var(--shelf));
}
.strip h2 {
  font-family: var(--display);
  margin: 0 0 1rem;
  font-size: 1.4rem;
}
.strip ul { margin: 0; padding-left: 1.1rem; color: var(--muted); }
.strip li { margin-bottom: 0.45rem; }

.foot {
  padding: 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}
.foot a { color: var(--accent); }

/* App */
.app-body .workspace {
  max-width: 56rem;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 3rem;
  display: grid;
  gap: 1.25rem;
}
.status {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
  grid-column: 1 / -1;
}
.watermark {
  margin: -0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--warm);
  grid-column: 1 / -1;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 1.25rem;
  grid-column: 1 / -1;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.15rem;
}
.panel h2 {
  font-family: var(--display);
  font-size: 1.2rem;
  margin: 0 0 0.85rem;
  font-weight: 600;
}
.panel h2 span {
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  margin-left: 0.4rem;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.field-grid .full { grid-column: 1 / -1; }

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--muted);
}
input, textarea, select {
  font: inherit;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0.65rem 0.75rem;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid rgba(61, 184, 160, 0.45);
  outline-offset: 1px;
}
textarea { resize: vertical; min-height: 5.5rem; }

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.9rem;
}

.view-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}
.view-tabs button {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.view-tabs button.active {
  background: rgba(61, 184, 160, 0.15);
  color: var(--accent);
  border-color: rgba(61, 184, 160, 0.35);
}

.tray {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 12rem;
}
.tray-empty {
  color: var(--muted);
  font-size: 0.95rem;
  padding: 1.5rem 0.25rem;
  border-top: 2px solid rgba(61, 184, 160, 0.2);
  margin: 0;
}

.quote-card {
  position: relative;
  padding: 1rem 1rem 0.85rem;
  background: linear-gradient(145deg, rgba(61, 184, 160, 0.07), transparent 55%),
    rgba(0, 0, 0, 0.22);
  border: 1px solid var(--line);
  border-radius: 4px;
  border-left: 3px solid var(--accent);
  animation: slideIn 0.35s ease both;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.quote-card .mark {
  font-family: var(--display);
  font-size: 1.8rem;
  line-height: 1;
  color: var(--warm);
  opacity: 0.7;
  margin: 0 0 0.35rem;
}
.quote-card .body {
  margin: 0 0 0.75rem;
  font-size: 1.02rem;
  line-height: 1.45;
}
.quote-card .meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.6rem;
  font-size: 0.88rem;
}
.quote-card .meta strong {
  font-family: var(--display);
  font-weight: 600;
}
.quote-card .meta .role { color: var(--muted); }
.quote-card .stars {
  color: var(--warm);
  letter-spacing: 0.08em;
  font-size: 0.85rem;
}
.quote-card .card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.7rem;
}
.quote-card .card-actions button {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.55rem;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.quote-card .card-actions button:hover {
  color: var(--ink);
  border-color: rgba(61, 184, 160, 0.4);
}

.plain-view {
  margin: 0;
  white-space: pre-wrap;
  font-family: "Karla", ui-monospace, monospace;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1rem;
  min-height: 12rem;
}
.plain-view[hidden], .tray[hidden] { display: none; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  grid-column: 1 / -1;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg2);
  color: var(--ink);
  padding: 1.25rem;
  max-width: 22rem;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
dialog h2 {
  font-family: var(--display);
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}
dialog p { color: var(--muted); font-size: 0.9rem; }
.err { color: #ff8f8f; font-size: 0.85rem; }

.toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.55rem 1rem;
  border-radius: 3px;
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  z-index: 40;
  pointer-events: none;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .top { flex-wrap: wrap; gap: 0.75rem; }
  .field-grid { grid-template-columns: 1fr; }
  .hero::before { right: 2%; top: 8%; opacity: 0.7; }
}
