/* pilotwhispers. Dark theme shared with FlightBrief. */
:root {
  --bg: #0e1014;
  --card: #16181d;
  --card-2: #1c1f25;
  --line: #262930;
  --line-2: #2f333b;
  --line-3: #3a3e47;
  --line-4: #5a606c;
  --text: #e6e7ea;
  --text-hi: #f1f2f4;
  --text-2: #9a9ca3;
  --text-3: #80838b;
  --label: #c4c6cc;
  --accent: #8ab4e8;
  --accent-hi: #b5cff0;
  --on-accent: #0e1014;
  --amber: #e5c07b;
  --green: #8fd3ae;
  --red: #f28b82;
  --font: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Instrument Serif', Georgia, serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.4; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
a:hover { color: var(--accent-hi); }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: 0.4; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Header */
.site-header { max-width: 1120px; margin: 0 auto; padding: 24px 32px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text-hi); text-decoration: none; }
.brand:hover { color: var(--text-hi); }
.brand img { width: 34px; height: 34px; display: block; }
.wordmark { font-family: var(--serif); font-style: italic; font-size: 30px; line-height: 1; }
.badge { padding: 3px 8px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; }
.nav { display: flex; align-items: center; gap: 20px; }
.nav a, .nav button { min-height: 44px; padding: 0; border: 0; background: none; display: inline-flex; align-items: center; color: var(--accent); font-size: 16px; font-weight: 600; text-decoration: none; }
.nav a:hover, .nav button:hover { color: var(--accent-hi); }

.wrap { max-width: 1120px; margin: 0 auto; padding: 16px 32px 72px; }
.hero h1 { margin: 0; font-size: 56px; line-height: 1.05; font-weight: 800; letter-spacing: -0.02em; color: var(--text-hi); }
.hero p { margin: 16px 0 0; max-width: 560px; font-size: 18px; line-height: 1.5; color: var(--text-2); }

/* Cards and labels */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.label { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; font-size: 12.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--label); }
.label .sub { font-weight: 500; color: var(--text-3); }
.group-label { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.chips + .group-label { margin-top: 16px; }

/* Write page */
.layout { display: flex; flex-wrap: wrap; gap: 56px; margin-top: 48px; align-items: flex-start; }
.form-card { flex: 999 1 560px; min-width: 0; padding: 28px; display: flex; flex-direction: column; gap: 36px; }
.side-card { flex: 1 1 360px; min-width: 0; padding: 24px; display: flex; flex-direction: column; gap: 20px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card-2); color: var(--text); font-size: 15px; font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.tab { height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--card-2); color: var(--text); font-size: 14px; font-weight: 600; }
.tab[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tab-add { border-style: dashed; border-color: var(--line-4); background: transparent; }

.post-input { display: block; width: 100%; height: 150px; padding: 16px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg); color: var(--text); font: inherit; font-size: 17px; line-height: 1.5; resize: vertical; }
.post-input::placeholder { color: #6b6f78; }
.post-input:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.post-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; min-height: 32px; }
.link-danger { height: 32px; padding: 0; border: 0; background: transparent; color: var(--red); font-size: 13px; font-weight: 600; }
.counter { margin-left: auto; font-size: 13px; color: var(--text-3); }

.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { width: 42px; height: 42px; padding: 0; border-radius: 50%; border: 1px solid transparent; display: inline-flex; align-items: center; justify-content: center; }
.swatch svg { width: 20px; height: 20px; }
.swatch.outline { background: var(--line); box-shadow: 0 0 0 1px var(--line-3); }
.swatch.outline svg { width: 18px; height: 18px; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--accent); }

.presets { display: grid; grid-template-columns: repeat(auto-fill, 40px); gap: 10px; max-width: 390px; }
.preset { width: 40px; height: 40px; padding: 0; border: 0; background: transparent; display: inline-flex; align-items: center; justify-content: center; }
.preset span { width: 40px; height: 40px; flex: none; border-radius: 4px; border: 4px solid; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14); }
.preset[aria-pressed="true"] span { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--accent); }

/* Post card: preview and Read feed */
.post-frame { border-radius: 22px; padding: 10px; }
.post-slide { aspect-ratio: 4 / 5; border-radius: 14px; padding: 26px; display: flex; flex-direction: column; justify-content: space-between; gap: 16px; overflow: hidden; }
.post-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; font-weight: 700; }
.post-chip { padding: 5px 12px; border: 1.5px solid currentColor; border-radius: 999px; font-weight: 600; }
.post-chip.placeholder { opacity: 0.6; }
.post-text { margin: 0; font-weight: 700; line-height: 1.3; white-space: pre-wrap; overflow-wrap: anywhere; }
.post-text.lg { font-size: 28px; }
.post-text.md { font-size: 24px; }
.post-text.sm { font-size: 20px; }
.post-text.empty { opacity: 0.55; }
.post-mark { font-family: var(--serif); font-style: italic; font-size: 22px; }

.slide-nav { display: flex; align-items: center; justify-content: center; gap: 12px; }
.round-btn { width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 1px solid var(--line-2); background: var(--card-2); color: var(--text); display: inline-flex; align-items: center; justify-content: center; }
.round-btn svg { width: 18px; height: 18px; }
.dots { display: flex; align-items: center; }
.dot { width: 30px; height: 44px; padding: 0; border: 0; background: transparent; display: inline-flex; align-items: center; justify-content: center; }
.dot span { width: 8px; height: 8px; border-radius: 999px; background: var(--line-3); transition: width 0.15s; }
.dot[aria-pressed="true"] span { width: 22px; background: var(--accent); }

.human { min-height: 65px; display: flex; align-items: center; justify-content: center; color: var(--text-3); font-size: 14px; text-align: center; }
.note { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-2); }
.form-error { margin: 0; padding: 10px 12px; border-radius: 10px; background: rgba(242, 139, 130, 0.12); color: var(--red); font-size: 14px; font-weight: 600; }
.follow { margin: 0; text-align: center; font-size: 14px; color: var(--text-2); }
.follow a { color: var(--text); font-weight: 700; text-decoration: none; }

/* Buttons */
.btn { height: 56px; padding: 0 20px; border-radius: 12px; font-size: 17px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { border: 0; background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hi); color: var(--on-accent); }
.btn-secondary { border: 1px solid var(--line-2); background: var(--card-2); color: var(--text); }
.btn-secondary:hover { border-color: var(--line-4); color: var(--text); }
.btn-danger { border: 1px solid var(--line-2); background: var(--card-2); color: var(--red); }
.btn-sm { height: 44px; border-radius: 10px; font-size: 15px; padding: 0 12px; }
.btn-block { width: 100%; }

/* Sent */
.sent { max-width: 460px; margin: 96px auto 0; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.sent-icon { width: 88px; height: 88px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; }
.sent-icon svg { width: 40px; height: 40px; }
.sent h1 { margin: 0; font-size: 56px; line-height: 1.05; font-weight: 800; letter-spacing: -0.02em; color: var(--text-hi); }
.sent p { margin: 0; font-size: 18px; line-height: 1.5; color: var(--text-2); }
.sent .actions { width: 100%; display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }

/* Read */
.feed { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 28px; margin-top: 40px; }
.feed-post { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; border-radius: 14px; }
.track::-webkit-scrollbar { display: none; }
.track .post-slide { flex: 0 0 100%; scroll-snap-align: start; border-radius: 0; }
.feed-nav { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 13px; font-weight: 600; color: var(--text-3); }
.feed-status { margin-top: 40px; color: var(--text-2); }
.more { margin: 32px auto 0; }

/* Admin */
.admin-wrap { max-width: 640px; margin: 0 auto; padding: 8px 20px 60px; display: flex; flex-direction: column; gap: 28px; }
.admin-title h1 { margin: 0; font-size: 32px; line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; color: var(--text-hi); }
.admin-title p { margin: 6px 0 0; font-size: 15px; color: var(--text-2); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack > .label { margin: 0; }
.q-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.q-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.q-tags { display: flex; align-items: center; gap: 8px; }
.q-dot { width: 26px; height: 26px; flex: none; border-radius: 50%; }
.q-chip { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line-4); font-size: 12px; font-weight: 600; }
.q-title { font-size: 16px; font-weight: 700; color: var(--text-hi); }
.q-meta { font-size: 13px; color: var(--text-3); }
.q-slides { display: flex; flex-direction: column; gap: 8px; }
.q-slide { display: flex; gap: 10px; align-items: flex-start; }
.q-num { flex: none; width: 22px; height: 22px; margin-top: 1px; border-radius: 50%; background: var(--line); color: var(--label); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.q-slide p { margin: 0; font-size: 15px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.flag { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: rgba(229, 192, 123, 0.12); color: var(--amber); font-size: 13px; font-weight: 600; }
.flag svg { width: 16px; height: 16px; flex: none; }
.ready { margin-top: 4px; font-size: 13px; color: var(--green); }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; min-width: 0; }
.thumbs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.thumbs img, .thumb-wait { width: 100%; aspect-ratio: 4 / 5; border-radius: 8px; display: block; }
.thumb-wait { background: var(--card-2); }
.empty-note { margin: 0; padding: 20px; text-align: center; font-size: 15px; color: var(--text-2); }
.edit-area { display: block; width: 100%; min-height: 90px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; font-size: 15px; line-height: 1.45; resize: vertical; }
.select, .input { width: 100%; height: 48px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg); color: var(--text); font: inherit; font-size: 16px; }
.signin { max-width: 400px; margin: 48px auto; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.signin h1 { margin: 0; font-size: 28px; font-weight: 800; color: var(--text-hi); }
.signin .label { margin: 0; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: calc(100% - 40px); padding: 10px 16px; border-radius: 10px; background: var(--card-2); border: 1px solid var(--line-2); color: var(--text); font-size: 14px; font-weight: 600; z-index: 10; }

/* Phones */
@media (max-width: 720px) {
  .site-header { padding: 16px 20px; }
  .brand { gap: 8px; }
  .brand img { width: 30px; height: 30px; }
  .wordmark { font-size: 26px; }
  .wrap { padding: 8px 20px 40px; }
  .hero h1 { font-size: 32px; line-height: 1.1; }
  .hero p { margin-top: 12px; font-size: 16px; }
  .layout { margin-top: 28px; gap: 28px; }
  .form-card, .side-card { padding: 0; gap: 28px; background: transparent; border: 0; }
  .swatches { gap: 14px; }
  .swatch { width: 44px; height: 44px; }
  .swatch[aria-pressed="true"], .preset[aria-pressed="true"] span { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
  .presets { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px 0; max-width: none; }
  .preset { width: 100%; height: 44px; }
  .preset span { width: 34px; height: 34px; }
  .post-input { height: 140px; padding: 14px; font-size: 16px; background: var(--card); }
  .post-slide { padding: 24px; }
  .post-text.lg { font-size: 26px; }
  .post-text.md { font-size: 22px; }
  .post-text.sm { font-size: 19px; }
  .post-mark { font-size: 20px; }
  .sent { margin-top: 72px; }
  .sent h1 { font-size: 40px; }
  .sent p { font-size: 16px; }
  .feed { margin-top: 28px; }
}
