/* SkyPanda — cozy Animal-Crossing-inspired theme */
:root {
  --bg: #f7f1da;
  --card: #fffdf4;
  --card2: #f8f0d9;
  --ink: #5a4a38;
  --ink-soft: #98866f;
  --line: #eadfb8;
  --accent: #e8863f;
  --accent-dark: #c96a26;
  --leaf: #67ab5b;
  --leaf-dark: #4e8f44;
  --sky: #bfe3f2;
  --sky-deep: #5b93b8;
  --field-green: #8ecb7e;
  --good: #67ab5b;
  --warn: #dd9a33;
  --bad: #e0685c;
  --vlifr: #a06bc9;
  --shadow: 0 4px 0 rgba(90, 74, 56, .07), 0 12px 26px rgba(90, 74, 56, .10);
  --r: 24px;
  font-size: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", "Segoe UI", system-ui, sans-serif;
  background:
    linear-gradient(180deg, var(--sky) 0px, #e3f0e2 260px, var(--bg) 420px);
  background-attachment: fixed;
  color: var(--ink);
  min-height: 100vh;
}

/* drifting clouds */
.sky-deco { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.cloud { position: absolute; opacity: .8; }
.cloud.c1 { width: 190px; top: 26px; animation: drift 80s linear infinite; }
.cloud.c2 { width: 130px; top: 110px; animation: drift 115s linear infinite; animation-delay: -50s; opacity: .6; }
@keyframes drift { from { transform: translateX(-240px); } to { transform: translateX(110vw); } }

.wrap { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: 16px 16px 108px; }

/* ---------- header ---------- */
header { display: flex; align-items: center; gap: 14px; padding: 8px 10px 14px; }
.mascot { width: 92px; height: 92px; flex: 0 0 auto; animation: bob 3.4s ease-in-out infinite; filter: drop-shadow(0 6px 8px rgba(90,74,56,.18)); }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-7px) rotate(2deg); } }
.title-block h1 {
  margin: 0; font-size: 2rem; color: #fffdf4; letter-spacing: .5px;
  text-shadow: 0 2.5px 0 rgba(90,74,56,.35), 0 5px 14px rgba(90,74,56,.25);
}
.title-block p { margin: 2px 0 0; color: #4a6b7e; font-weight: 600; font-size: .93rem; }

/* ---------- pages & cards ---------- */
.page.pop-in { animation: popIn .34s cubic-bezier(.24, 1.2, .4, 1); }
@keyframes popIn { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }

.card {
  background: var(--card); border: 3px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 16px;
}
.card h2 { margin: 0 0 6px; color: var(--accent-dark); font-size: 1.25rem; }
.card h3 { margin: 16px 0 6px; color: var(--accent-dark); font-size: 1.02rem; }
.hint { color: var(--ink-soft); font-size: .89rem; margin: 6px 0 8px; line-height: 1.55; }

/* ---------- bottom dock ---------- */
#dock {
  position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 60;
  display: flex; gap: 4px; padding: 8px;
  background: rgba(255, 253, 244, .96); backdrop-filter: blur(6px);
  border: 3px solid var(--line); border-radius: 999px;
  box-shadow: 0 8px 24px rgba(90, 74, 56, .22);
  max-width: calc(100vw - 20px); overflow-x: auto;
}
.dock-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-width: 74px; padding: 8px 10px; border: none; cursor: pointer;
  background: transparent; border-radius: 999px; color: var(--ink-soft);
  font-family: inherit; font-size: .68rem; font-weight: 700;
  transition: all .18s ease;
}
.dock-btn svg { width: 23px; height: 23px; }
.dock-btn:hover { color: var(--accent-dark); transform: translateY(-2px); }
.dock-btn.active { background: var(--leaf); color: #fff; box-shadow: 0 3px 0 var(--leaf-dark); }

/* ---------- inputs & buttons ---------- */
.btn {
  padding: 11px 22px; font-size: .97rem; font-family: inherit; font-weight: 700;
  background: var(--accent); color: #fff; border: none; border-radius: 999px; cursor: pointer;
  box-shadow: 0 3.5px 0 var(--accent-dark); transition: transform .12s, box-shadow .12s;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(1.5px); box-shadow: 0 1px 0 var(--accent-dark); }
.btn.secondary { background: var(--sky-deep); box-shadow: 0 3.5px 0 #40708f; }
.btn.big { padding: 13px 26px; font-size: 1.02rem; background: var(--leaf); box-shadow: 0 3.5px 0 var(--leaf-dark); }

.search-row { display: flex; gap: 10px; flex-wrap: wrap; position: relative; }
.search-row input, .plan-grid input, .plan-grid select, .plan-grid textarea,
.duo input, .settings-row input, .settings-row select, .ft-field input {
  padding: 11px 16px; font-size: .96rem; font-family: inherit;
  border: 2.5px solid var(--line); border-radius: 16px; background: #fff; color: var(--ink);
  outline: none; transition: border-color .2s; width: 100%;
}
.search-row input { flex: 1 1 300px; }
.search-row input:focus, .plan-grid input:focus, .ft-field input:focus { border-color: var(--accent); }
.suggestions {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 40; margin-top: 6px;
  background: #fff; border: 2.5px solid var(--line); border-radius: 16px; overflow: hidden;
  box-shadow: var(--shadow); max-height: 320px; overflow-y: auto;
}
.suggestions div { padding: 10px 16px; cursor: pointer; font-size: .93rem; }
.suggestions div:hover { background: var(--card2); }
.suggestions b { color: var(--accent-dark); }
.suggestions small { color: var(--ink-soft); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.chip {
  background: var(--card2); border: 2px solid var(--line); border-radius: 999px;
  padding: 5px 14px; cursor: pointer; font-size: .86rem; font-family: inherit; color: var(--ink); font-weight: 600;
}
.chip:hover { border-color: var(--leaf); background: #eef6e7; }

/* from → to strip */
.fromto { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 10px; }
.ft-field { position: relative; flex: 1 1 180px; }
.ft-field label { display: block; font-weight: 700; font-size: .8rem; margin-bottom: 5px; color: var(--ink-soft); }
.ft-arrow { font-size: 1.4rem; color: var(--leaf-dark); padding-bottom: 10px; }

.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 10px; }
.plan-grid label { display: block; font-weight: 700; margin-bottom: 5px; font-size: .82rem; color: var(--ink-soft); }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
details.adv { margin-top: 12px; }
details.adv summary { cursor: pointer; font-weight: 700; color: var(--sky-deep); font-size: .9rem; }

.wp-list { margin: 8px 0; padding-left: 22px; }
.wp-list li { margin: 7px 0; }
.wp-list small { color: var(--ink-soft); }
.wp-kind { font-size: .64rem; font-weight: 800; border-radius: 8px; padding: 2.5px 7px; color: #fff; background: var(--sky-deep); vertical-align: 1px; }
.wp-kind.vfr { background: #cfa50c; }
.wp-x { border: none; background: var(--card2); color: var(--bad); border-radius: 10px; cursor: pointer; padding: 2px 9px; font-weight: 700; margin-left: 6px; }
.wp-x:hover { background: #fbe3e0; }

/* ---------- weather ---------- */
.wx-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-top: 12px; }
.wx-tile { background: var(--card2); border: 2px solid var(--line); border-radius: 18px; padding: 11px 15px; }
.wx-tile .lbl { font-size: .72rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; font-weight: 700; }
.wx-tile .val { font-size: 1.02rem; font-weight: 700; line-height: 1.45; }
.cat-banner { border-radius: 16px; padding: 11px 18px; font-weight: 700; font-size: 1rem; color: #fff; margin-top: 10px; }
.cat-VFR { background: var(--good); } .cat-MVFR { background: var(--warn); }
.cat-IFR { background: var(--bad); } .cat-LIFR { background: var(--vlifr); }
.raw-box {
  background: #52422e; color: #ffeccb; padding: 12px 16px; border-radius: 14px;
  font-family: "SF Mono", ui-monospace, Menlo, monospace; font-size: .84rem;
  white-space: pre-wrap; word-break: break-word; margin-top: 10px; line-height: 1.5;
}
.taf-period { border-left: 5px solid var(--sky-deep); background: var(--card2); border-radius: 0 14px 14px 0; padding: 8px 14px; margin: 8px 0; }
.taf-period .kind { font-weight: 800; color: var(--sky-deep); font-size: .78rem; }
.taf-period pre { margin: 4px 0 0; font-family: ui-monospace, Menlo, monospace; font-size: .82rem; white-space: pre-wrap; }
.notam-item { background: var(--card2); border: 2px solid var(--line); border-radius: 14px; padding: 10px 14px; margin: 8px 0; }
.notam-item pre { margin: 0; font-family: ui-monospace, Menlo, monospace; font-size: .78rem; white-space: pre-wrap; word-break: break-word; max-height: 120px; overflow: hidden; }
.notam-item.open pre { max-height: none; }
.notam-item .more { color: var(--sky-deep); cursor: pointer; font-size: .84rem; font-weight: 700; }
.gfa-imgs { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.gfa-frame { text-align: center; }
.gfa-frame img { width: 100%; border-radius: 16px; border: 3px solid var(--line); background: #fff; cursor: zoom-in; }
.gfa-frame .cap { font-size: .8rem; color: var(--ink-soft); margin-top: 4px; }

table.uw { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: .9rem; }
table.uw th, table.uw td { padding: 7px 10px; text-align: left; border-bottom: 2px dashed var(--line); }
table.uw th { color: var(--accent-dark); }
.rwy-closed-row td { color: var(--bad); }
.closed-flag { background: var(--bad); color: #fff; font-size: .68rem; font-weight: 800; border-radius: 8px; padding: 2px 8px; margin-left: 6px; }
.closed-flag.end { background: var(--warn); }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-top: 8px; font-size: .95rem; }
.info-grid .lbl { display: block; font-size: .72rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }

/* ---------- airport diagram ---------- */
.apt-diagram { width: 100%; display: block; border-radius: 20px; }
.apt-diagram.compass { max-width: 420px; margin: 0 auto; }
.dg-label { font-size: 12px; font-weight: 800; fill: #6b5b45; font-family: inherit; }
.dg-terminal { font-size: 10.5px; fill: #7a5a2e; font-weight: 700; }
.dg-twy-label { font-size: 10px; font-weight: 800; fill: #fff; font-family: inherit; }
.dg-rwy-ident { font-size: 12px; font-weight: 800; fill: #4c4335; font-family: inherit; }
.dg-rwy-ident.closed { fill: #fff; }
.dg-heli { font-size: 10px; font-weight: 800; fill: #fffdf4; }
.dg-wind-label { font-size: 13px; font-weight: 800; fill: #6b5b45; font-family: inherit; }
.compass-txt { font-size: 17px; font-weight: 800; fill: var(--accent-dark); font-family: inherit; }
.compass-needle { transition: transform 1s cubic-bezier(.3,1.2,.5,1); }
.streamline {
  fill: none; stroke: #ffffff; stroke-width: 3.4; stroke-linecap: round; opacity: 0;
  stroke-dasharray: 90 400;
  animation: flow 5s linear infinite;
}
@keyframes flow {
  0% { stroke-dashoffset: 90; opacity: 0; }
  12% { opacity: .65; }
  70% { opacity: .65; }
  100% { stroke-dashoffset: -400; opacity: 0; }
}
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0 4px; font-size: .82rem; color: var(--ink-soft); font-weight: 600; }
.legend .lg { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 17px; height: 11px; border-radius: 5px; display: inline-block; border: 1.5px solid rgba(90,74,56,.2); }
.legend .hatch-red { background: repeating-linear-gradient(45deg, #e0685c 0 3px, #fbe3e0 3px 6px); }
.legend .hatch-org { background: repeating-linear-gradient(45deg, #eda13c 0 3px, #fdf0d8 3px 6px); }
.comp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-top: 8px; }
.ops-line { border-radius: 14px; padding: 9px 13px; margin: 6px 0; font-size: .88rem; background: var(--card2); border-left: 5px solid var(--ink-soft); }
.ops-line.closed { border-left-color: var(--bad); }
.ops-line.end { border-left-color: var(--warn); }
.ops-line.wip { border-left-color: var(--warn); }
.ops-line.lgt { border-left-color: var(--sky-deep); }
.ops-line code { font-size: .78rem; background: rgba(0,0,0,.05); border-radius: 6px; padding: 1px 5px; }

/* ---------- nav log & SHP ---------- */
.nl-wrap { overflow-x: auto; border-radius: 14px; }
table.navlog { font-size: .82rem; white-space: nowrap; }
table.navlog th { position: sticky; top: 0; background: var(--card); }
.shp-col { background: rgba(103, 171, 91, .13); }
.nl-total td { border-top: 3px solid var(--line); background: var(--card2); }
.ok-txt { color: var(--good); } .bad-txt { color: var(--bad); }
.hdg { color: var(--accent-dark); font-size: 1.06em; }
.shp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-top: 10px; }
.shp-card { background: var(--card2); border: 2.5px solid var(--line); border-radius: 18px; padding: 11px 15px; }
.shp-head { font-weight: 800; color: var(--leaf-dark); font-size: .85rem; margin-bottom: 6px; }
.shp-row { display: flex; justify-content: space-between; padding: 3.5px 0; border-bottom: 1.5px dashed var(--line); font-size: .88rem; }
.shp-row:last-child { border-bottom: none; }
.shp-row b { font-variant-numeric: tabular-nums; }
.dep-arr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }

/* route reasoning */
.reason-list { list-style: none; margin: 8px 0 0; padding: 0; }
.reason { background: var(--card2); border: 2px solid var(--line); border-radius: 16px; padding: 10px 14px; margin: 8px 0; font-size: .9rem; line-height: 1.5; position: relative; padding-left: 40px; }
.reason::before { content: "✈"; position: absolute; left: 14px; top: 9px; color: var(--sky-deep); }
.reason.policy::before, .reason.short::before { content: "★"; color: var(--leaf-dark); }
.reason.cp::before { content: "●"; color: #cfa50c; }
.reason.gap::before, .reason.nopois::before { content: "⌛"; color: var(--warn); }
.reason.drift::before { content: "≋"; color: var(--sky-deep); }

/* ---------- map ---------- */
#mapCanvas { height: 64vh; min-height: 420px; border-radius: 20px; border: 3px solid var(--line); }
.leg-label {
  background: rgba(255, 253, 244, .95); border: 2px solid #e0685c; border-radius: 12px;
  padding: 3px 8px; font-size: 11px; font-weight: 800; color: #8c3a30; white-space: nowrap;
  transform: translate(-50%, -125%); width: max-content !important; font-family: inherit;
}
.shp-label {
  background: #67ab5b; color: #fff; border-radius: 12px; padding: 3px 8px; border: 2px solid #4e8f44;
  font-size: 10.5px; font-weight: 800; white-space: nowrap; transform: translate(-50%, 30%);
  width: max-content !important; font-family: inherit;
}
.drift-label {
  background: rgba(78, 143, 209, .92); color: #fff; border-radius: 9px; padding: 1px 6px;
  font-size: 10px; font-weight: 800; transform: translate(-50%, -50%); width: max-content !important;
}
.wp-tt { background: #fffdf4; border: 2px solid var(--accent-dark); border-radius: 9px; font-weight: 800; font-size: 11px; padding: 1px 6px; font-family: inherit; color: var(--ink); }
.wp-tt.vfr { background: #ffd83d; border-color: #a8850a; }
.apt-tt { background: rgba(255,255,255,.92); border: 1.5px solid #5a76b8; color: #5a76b8; font-size: 10px; font-weight: 800; border-radius: 7px; padding: 0 5px; font-family: inherit; }

/* ---------- clouds ---------- */
.cloud-type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin-top: 8px; }
.cloud-type { display: flex; align-items: center; gap: 10px; background: var(--card2); border: 2px solid var(--line); border-radius: 16px; padding: 8px 12px; }
.cloud-ico { width: 74px; height: 50px; flex: 0 0 auto; }
.cloud-profile { width: 100%; display: block; border-radius: 16px; }
.cp-axis { font-size: 11px; fill: #5a6b80; font-family: inherit; font-weight: 600; }
.cp-lbl { font-size: 12px; fill: #3b4a5c; font-weight: 700; font-family: inherit; }
.cp-lbl.ceil { fill: #b3341f; font-weight: 800; }
.cp-lbl.cruise { fill: #c2311e; font-weight: 800; }

/* ---------- settings, misc ---------- */
.settings-row { margin: 14px 0; }
.settings-row label { display: block; font-weight: 700; margin-bottom: 6px; }
.settings-row input, .settings-row select { max-width: 460px; }
footer { color: var(--ink-soft); font-size: .78rem; margin-top: 22px; line-height: 1.6; }
.spinner { text-align: center; padding: 28px; color: var(--ink-soft); font-size: 1rem; font-weight: 600; }
.spinner::before { content: ""; display: inline-block; width: 14px; height: 14px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent); margin-right: 10px; vertical-align: -2px;
  animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.lightbox {
  position: fixed; inset: 0; background: rgba(74, 60, 40, .78); z-index: 100;
  display: flex; align-items: center; justify-content: center; cursor: zoom-out; padding: 20px;
}
.lightbox img { max-width: 96%; max-height: 92%; border-radius: 16px; background: #fff; }
.hidden { display: none !important; }
@media (max-width: 680px) {
  .dock-btn { min-width: 56px; font-size: .6rem; }
  .title-block h1 { font-size: 1.5rem; }
  .mascot { width: 72px; height: 72px; }
}

/* per-leg wind, sources, TOC/TOD, night lights */
.legwind-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 8px; }
.legwind { background: var(--card2); border: 2px solid var(--line); border-radius: 16px; padding: 10px 14px; }
.legwind.manual { border-color: var(--warn); }
.legwind .lw-head { font-weight: 800; font-size: .84rem; color: var(--sky-deep); margin-bottom: 4px; }
.legwind .lw-fb { font-size: .82rem; color: var(--ink-soft); margin-bottom: 6px; }
.legwind input { padding: 7px 10px; border: 2px solid var(--line); border-radius: 10px; width: 100%; font-family: inherit; }
.src { font-size: .68rem; font-weight: 700; border-radius: 6px; padding: 1px 5px; background: #e4f0e0; color: var(--leaf-dark); }
.src.manual { background: #fdeeda; color: #a8700f; }
.src.none { background: #eee; color: #888; }
.toc-tag { background: var(--leaf); color: #fff; border-radius: 8px; font-size: .68rem; padding: 2px 7px; margin-left: 4px; }
.tocd-label { background: #fffdf4; border: 2px solid var(--leaf-dark); color: var(--leaf-dark); border-radius: 10px; padding: 2px 7px; font-size: 10.5px; font-weight: 800; transform: translate(-50%, -50%); width: max-content !important; font-family: inherit; }
.tocd-label.tod { border-color: #a8700f; color: #a8700f; }
.rwy-lgt { animation: twinkle 2.2s ease-in-out infinite; }
@keyframes twinkle { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* openAIP badge, vias, community & profile */
.oap-badge { background: #2e7d5b; color: #fff; font-size: .62rem; font-weight: 800; border-radius: 999px; padding: 3px 10px; vertical-align: 3px; letter-spacing: .04em; }
.ft-field.via { position: relative; }
.ft-field.via .wp-x { position: absolute; top: 0; right: 0; }
#addViaBtn { padding: 11px 16px; font-size: 1.1rem; }
.post-card { background: var(--card2); border: 2.5px solid var(--line); border-radius: 18px; padding: 14px 16px; margin: 10px 0; }
.post-card.small { padding: 10px 14px; }
.post-card h3 { margin: 6px 0; }
.post-head { display: flex; gap: 10px; align-items: center; }
.post-head small { color: var(--ink-soft); display: block; }
.post-stats { display: flex; gap: 14px; align-items: center; font-weight: 700; color: var(--ink-soft); margin-top: 8px; flex-wrap: wrap; }
.like-btn { cursor: pointer; color: var(--bad); }
.like-btn:hover { transform: scale(1.1); }
.avatar-img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2.5px solid var(--line); }
.avatar-img.big { width: 76px; height: 76px; }
.avatar-fallback { width: 40px; height: 40px; border-radius: 50%; background: var(--leaf); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; }
.avatar-fallback.big { width: 76px; height: 76px; font-size: 1.6rem; }
.profile-head { display: flex; gap: 16px; align-items: center; margin-bottom: 12px; }
.profile-head input { padding: 9px 13px; border: 2.5px solid var(--line); border-radius: 12px; font-family: inherit; }
.auth-box { max-width: 380px; }
.auth-box input { display: block; width: 100%; margin: 8px 0; padding: 11px 15px; border: 2.5px solid var(--line); border-radius: 14px; font-family: inherit; }
.btn.oauth { background: #fff; color: var(--ink); border: 2.5px solid var(--line); box-shadow: 0 3px 0 var(--line); }
.btn.oauth.apple { background: #1d1d1f; color: #fff; border: none; box-shadow: 0 3px 0 #000; }
.comment { background: #fff; border-radius: 12px; padding: 7px 12px; margin: 6px 0; font-size: .9rem; }
.cp-flag { background: #ffd83d; border: 2px solid #a8850a; border-radius: 9px; font-weight: 800; font-size: 10.5px; padding: 1px 6px; color: #5a4a10; transform: translate(-50%, -120%); width: max-content !important; font-family: inherit; }

.post-card { margin: 18px 0; padding: 18px 20px; }
.post-detail { margin-top: 12px; }
.comment-btn { background: var(--leaf); box-shadow: 0 3.5px 0 var(--leaf-dark); border-radius: 999px; transform: rotate(-1.5deg); }
.comment-btn:hover { transform: rotate(1.5deg) translateY(-2px); }
