/* My lander: a customisable lander with a Central Asian hat that drops onto the Moon. */
.kl-card { order: 1; width: 300px; max-width: calc(100vw - 16px); background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; backdrop-filter: blur(6px); overflow: hidden; }
.kl-card.closed { width: auto; background: none; border: 0; backdrop-filter: none; overflow: visible; }
.kl-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 6px 6px 6px; }
.kl-card.closed .kl-head { padding: 0; }
.kl-toggle { flex: 1 1 auto; text-align: left; background: transparent; border-color: transparent; padding: 6px 8px; }
.kl-card.closed .kl-toggle { flex: none; background: rgba(10,14,20,.78); border-color: var(--teal); }
.kl-card.closed .kl-toggle:hover { background: var(--teal); }
.kl-card:not(.closed) .kl-toggle:hover { background: transparent; color: var(--teal); }
.kl-x { flex: none; width: 30px; height: 30px; border: 1px solid var(--line-2); background: transparent; color: var(--muted); border-radius: 6px; font-size: 20px; line-height: 1; cursor: pointer; }
.kl-x:hover { color: var(--text); border-color: var(--teal); }
.kl-card.closed .kl-x, .kl-card.closed .kl-body { display: none; }
.kl-body { padding: 0 12px 10px; display: grid; gap: 8px; }
.kl-prev { position: relative; height: 104px; border-radius: 6px; background: radial-gradient(ellipse at 50% 100%, rgba(70,224,200,.14), rgba(8,11,16,.0) 60%), linear-gradient(#05070b, #0d131c); border: 1px solid var(--line); overflow: hidden; }
.kl-prev canvas { width: 100%; height: 100%; display: block; }
.kl-row { display: grid; grid-template-columns: 54px 1fr; align-items: center; gap: 8px; }
.kl-row.kl-hrow { grid-template-columns: 1fr; gap: 4px; }
.kl-cap { position: absolute; left: 8px; bottom: 6px; font-size: 12px; color: var(--text); background: rgba(8,11,16,.7); border: 1px solid var(--line); border-radius: 10px; padding: 2px 9px; }
.kl-lbl { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.kl-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.kl-pill { background: rgba(255,255,255,.03); border: 1px solid var(--line-2); border-radius: 6px; padding: 6px 2px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; cursor: pointer; color: var(--text); }
.kl-pill:hover { border-color: var(--teal); }
.kl-pill.on { background: var(--teal); border-color: var(--teal); color: #001; }
.kl-sw { display: flex; gap: 9px; flex-wrap: nowrap; }
.kl-swatch { width: 28px; height: 28px; flex: none; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); cursor: pointer; padding: 0; transition: transform .12s; }
.kl-swatch:hover { transform: scale(1.12); }
.kl-swatch.on { border-color: #fff; box-shadow: 0 0 0 3px var(--teal); }
.kl-input { width: 100%; background: #0d1118; border: 1px solid var(--line-2); border-radius: 6px; padding: 6px 10px; font-size: 15px; color: var(--text); font-family: var(--sans); }
.kl-input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 2px rgba(70,224,200,.25); }
.kl-hats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.kl-hat { background: rgba(255,255,255,.04); border: 1px solid var(--line-2); border-radius: 6px; padding: 2px 0; height: 52px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.kl-hat img { width: 46px; height: 46px; object-fit: contain; pointer-events: none; }
.kl-hat:hover { border-color: var(--teal); }
.kl-hat.on { border-color: var(--teal); background: rgba(70,224,200,.18); box-shadow: 0 0 0 2px rgba(70,224,200,.35); }
.kl-hint { margin: 0; font-size: 11.5px; line-height: 1.35; color: var(--muted); }

/* the drop: a transparent canvas over the whole page, never taking a click */
#landerfx { display: none; position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 24; }
.kl-bubble { position: fixed; z-index: 25; transform: translateX(-50%); width: max-content; max-width: min(300px, calc(100vw - 16px)); pointer-events: none; opacity: 0; transition: opacity .2s; }
.kl-bubble.on { opacity: 1; }
.kl-bt { position: relative; background: rgba(8,11,16,.94); border: 2px solid var(--teal); border-radius: 12px; padding: 9px 12px 8px; color: var(--text); box-shadow: 0 6px 22px rgba(0,0,0,.5); display: grid; gap: 3px; }
.kl-bubble.ok .kl-bt { border-color: #3ddc84; }
.kl-bubble.lost .kl-bt { border-color: #8fd3ff; }
.kl-bt b { font-size: 15px; letter-spacing: .02em; }
.kl-bubble.ok b { color: #3ddc84; }
.kl-bubble.lost b { color: #8fd3ff; }
.kl-bt span { font-size: 15px; line-height: 1.3; }
.kl-bt .kl-skip { font-size: 11px; color: var(--muted); font-style: normal; }
.kl-bt::after { content: ""; position: absolute; left: 50%; bottom: -9px; width: 14px; height: 14px; background: rgba(8,11,16,.94); border: 2px solid; border-color: transparent currentColor currentColor transparent; transform: translateX(-50%) rotate(45deg); color: var(--teal); }
.kl-bubble.ok .kl-bt::after { color: #3ddc84; }
.kl-bubble.lost .kl-bt::after { color: #8fd3ff; }
.kl-bubble.below .kl-bt::after { bottom: auto; top: -9px; transform: translateX(-50%) rotate(225deg); }
@media (max-width: 760px) {
  .kl-card { width: 100%; max-width: none; flex: 1 1 100%; }
  .kl-card.closed { width: auto; flex: none; }
  .kl-prev { height: 120px; }
}
/* A desktop screen of ordinary height: the card lies flat (picture left, choices right), clear of the day table below. */
@media (max-height: 900px) and (min-width: 761px) {
  .kl-card:not(.closed) { width: 500px; }
  .kl-body { grid-template-columns: 150px 1fr; column-gap: 12px; }
  .kl-prev { grid-column: 1; grid-row: 1 / span 4; height: auto; min-height: 150px; }
  .kl-body > .kl-row { grid-column: 2; }
  .kl-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) { .kl-swatch { transition: none; } }
