/* ═══════════════════════════════════════════
   copertina.css — Consolle Operativa SSE
   Cockpit stile astronave, dati reali
═══════════════════════════════════════════ */

#copertina {
  background: var(--void);
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}

#copertina::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(74,140,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74,140,255,.04) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
}
#copertina::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,.7) 100%);
  pointer-events: none; z-index: 0;
}

/* ── Header ──────────────────────────────── */
.ck-header {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: .55rem 1rem;
  border-bottom: 1px solid rgba(74,140,255,.2);
  background: rgba(7,9,21,.9);
  flex-shrink: 0;
}
.ck-header-left { display: flex; align-items: center; gap: .6rem; }
.ck-logo {
  font-family: 'Space Mono', monospace;
  font-size: .62rem; font-weight: 700; letter-spacing: .15em; color: var(--glow);
}
.ck-sep { color: var(--muted); font-size: .7rem; }
.ck-subtitle {
  font-family: 'Space Mono', monospace;
  font-size: .52rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.ck-header-right { display: flex; align-items: center; gap: .8rem; }
.ck-status {
  display: flex; align-items: center; gap: .3rem;
  font-family: 'Space Mono', monospace;
  font-size: .5rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.ck-led {
  width: 5px; height: 5px; border-radius: 50%;
}
.ck-led.verde { background: var(--verde); box-shadow: 0 0 6px var(--verde); animation: ledBlink 2s ease-in-out infinite; }
.ck-led.blu   { background: var(--glow);  box-shadow: 0 0 6px var(--glow);  animation: ledBlink 3s ease-in-out infinite; }
.ck-led.cyan  { background: var(--pulse); box-shadow: 0 0 6px var(--pulse); animation: ledBlink 2.5s ease-in-out infinite; }

@keyframes ledBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: .2; }
}
.ck-ctrl {
  background: rgba(255,255,255,.04); border: 1px solid var(--dim);
  width: 28px; height: 28px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--muted); transition: all .15s;
}
.ck-ctrl:active { background: var(--surface); color: var(--text); }
.ck-ctrl svg { width: 13px; height: 13px; }

/* ── Layout consolle ─────────────────────── */
.ck-body {
  position: relative; z-index: 1;
  flex: 1; display: flex; flex-direction: column;
  padding: .6rem .7rem; gap: .6rem;
}
.ck-row-top, .ck-row-bot { display: flex; gap: .6rem; flex-shrink: 0; }
.ck-row-mid { display: flex; gap: .6rem; flex: 1; }

/* ── Pannello generico ───────────────────── */
.ck-panel {
  background: rgba(13,17,32,.85);
  border: 1px solid rgba(74,140,255,.15);
  border-radius: 6px; position: relative;
  overflow: hidden; display: flex; flex-direction: column;
}
.ck-panel::before {
  content: '';
  position: absolute; top: 0; left: 0; width: 8px; height: 8px;
  border-top: 1px solid var(--glow); border-left: 1px solid var(--glow);
}
.ck-panel::after {
  content: '';
  position: absolute; bottom: 0; right: 0; width: 8px; height: 8px;
  border-bottom: 1px solid var(--glow); border-right: 1px solid var(--glow);
}
.ck-panel-label {
  font-family: 'Space Mono', monospace;
  font-size: .46rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
  padding: .3rem .55rem;
  border-bottom: 1px solid rgba(74,140,255,.1);
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.ck-panel-label span { font-size: .42rem; color: var(--glow); opacity: .7; }
.ck-panel-body { flex: 1; padding: .45rem .55rem; display: flex; flex-direction: column; }

/* ── RADAR ───────────────────────────────── */
.ck-radar-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: .2rem;
}
.ck-radar {
  position: relative; width: 100px; height: 100px;
}
.ck-radar-circle {
  position: absolute; border-radius: 50%;
  border: 1px solid rgba(0,229,255,.12);
  top: 50%; left: 50%; transform: translate(-50%,-50%);
}
.ck-radar-c1 { width: 100%; height: 100%; }
.ck-radar-c2 { width: 66%;  height: 66%; }
.ck-radar-c3 { width: 33%;  height: 33%; }
.ck-radar::before {
  content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 1px;
  background: rgba(0,229,255,.08);
}
.ck-radar::after {
  content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px;
  background: rgba(0,229,255,.08);
}
.ck-radar-sweep {
  position: absolute; top: 50%; left: 50%;
  width: 50%; height: 1px;
  transform-origin: left center;
  background: linear-gradient(90deg, rgba(0,229,255,.9), transparent);
  animation: radarSweep 4s linear infinite;
  box-shadow: 0 0 4px rgba(0,229,255,.4);
}
@keyframes radarSweep {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.ck-blip {
  position: absolute; width: 5px; height: 5px; border-radius: 50%;
  background: var(--pulse); box-shadow: 0 0 6px var(--pulse);
  transform: translate(-50%,-50%);
  animation: blipFade 4s ease-in-out infinite;
}
.ck-blip-1 { top: 28%; left: 38%; animation-delay:  0s; }
.ck-blip-2 { top: 32%; left: 68%; animation-delay: 1s; }
.ck-blip-3 { top: 62%; left: 42%; animation-delay: 2s; }
.ck-blip-4 { top: 68%; left: 68%; animation-delay: 3s; }
@keyframes blipFade {
  0%, 100% { opacity: .25; }
  25%       { opacity: 1; box-shadow: 0 0 10px var(--pulse); }
}
.ck-radar-lbl {
  font-family: 'Space Mono', monospace;
  font-size: .38rem; letter-spacing: .08em; color: var(--muted);
  text-align: center; padding-top: .25rem;
}

/* ── VITALI ──────────────────────────────── */
.ck-vitale {
  display: flex; align-items: center; gap: .35rem;
  padding: .25rem 0; border-bottom: 1px solid rgba(74,140,255,.05);
}
.ck-vitale:last-of-type { border-bottom: none; }
.ck-vitale-label {
  font-family: 'Space Mono', monospace;
  font-size: .42rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); width: 36px; flex-shrink: 0;
}
.ck-vitale-bar {
  flex: 1; height: 2px; background: var(--dim); border-radius: 1px; overflow: hidden;
}
.ck-vitale-fill {
  height: 100%; border-radius: 1px; animation: vitalPulse 2s ease-in-out infinite;
}
.ck-vitale-fill.fc   { background: var(--hot);   width: 72%; }
.ck-vitale-fill.spo2 { background: var(--verde);  width: 98%; animation-delay: .3s; }
.ck-vitale-fill.fr   { background: var(--glow);   width: 60%; animation-delay: .6s; }
.ck-vitale-fill.pa   { background: var(--pulse);  width: 80%; animation-delay: .9s; }
@keyframes vitalPulse {
  0%, 100% { opacity: .5; }
  50%       { opacity: 1; }
}
.ck-vitale-val {
  font-family: 'Space Mono', monospace; font-size: .5rem; font-weight: 700;
  flex-shrink: 0; width: 30px; text-align: right;
}
.ck-vitale-val.fc   { color: var(--hot); }
.ck-vitale-val.spo2 { color: var(--verde); }
.ck-vitale-val.fr   { color: var(--glow); }
.ck-vitale-val.pa   { color: var(--pulse); }

/* ECG SVG */
.ck-ecg { width: 100%; margin-top: .3rem; }

/* ── MISSION STATUS ──────────────────────── */
.ck-mission-list { display: flex; flex-direction: column; gap: .18rem; flex: 1; }

.ck-mod {
  display: flex; align-items: center; gap: .4rem;
  padding: .28rem .38rem;
  border: 1px solid transparent; border-radius: 3px;
  cursor: pointer; transition: all .15s;
}
.ck-mod:active { background: rgba(74,140,255,.08); border-color: rgba(74,140,255,.25); }
.ck-mod.bloccato { opacity: .4; cursor: default; }

.ck-mod-num {
  font-family: 'Space Mono', monospace;
  font-size: .42rem; color: var(--muted); flex-shrink: 0; width: 24px;
}
.ck-mod-name {
  font-family: 'Space Mono', monospace;
  font-size: .44rem; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text); flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ck-mod.bloccato .ck-mod-name { color: var(--muted); }

.ck-mod-bar { width: 24px; height: 2px; background: var(--dim); border-radius: 1px; flex-shrink: 0; }
.ck-mod-bar-fill { height: 100%; border-radius: 1px; background: var(--glow); }

.ck-mod-status {
  font-family: 'Space Mono', monospace; font-size: .4rem; letter-spacing: .05em;
  flex-shrink: 0; min-width: 40px; text-align: right;
}
.ck-mod-status.ok  { color: var(--verde); }
.ck-mod-status.wip { color: var(--pulse); }
.ck-mod-status.new { color: var(--muted); }
.ck-mod-status.lck { color: var(--dim); }

/* ── LOG ─────────────────────────────────── */
.ck-log { display: flex; flex-direction: column; gap: .18rem; flex: 1; }
.ck-log-line {
  font-family: 'Space Mono', monospace; font-size: .42rem; letter-spacing: .03em;
  color: var(--muted); line-height: 1.4; display: flex; gap: .35rem;
}
.ck-log-time { color: var(--glow); flex-shrink: 0; }
.ck-cursor {
  display: inline-block; width: 5px; height: 8px; background: var(--pulse); margin-left: 2px;
  animation: cursorBlink .8s step-end infinite;
}
@keyframes cursorBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* ── SOREU STATUS ────────────────────────── */
.ck-soreu-list { display: flex; flex-direction: column; gap: .28rem; flex: 1; }
.ck-soreu-item { display: flex; align-items: center; gap: .4rem; }
.ck-soreu-led {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--verde); box-shadow: 0 0 5px var(--verde); flex-shrink: 0;
  animation: ledBlink 2s ease-in-out infinite;
}
.ck-soreu-name {
  font-family: 'Space Mono', monospace;
  font-size: .42rem; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text); flex: 1;
}
.ck-soreu-pop {
  font-family: 'Space Mono', monospace; font-size: .4rem; color: var(--muted);
}

/* ── PULSANTE PRINCIPALE ─────────────────── */
.ck-btn-wrap {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: .45rem; flex: 1;
}
@keyframes btnShimmer {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}
.ck-main-btn {
  position: relative; width: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: .75rem .5rem;
  border: 1px solid rgba(74,140,255,.4); border-radius: 6px;
  cursor: pointer; overflow: hidden;
  background: linear-gradient(
    90deg,
    rgba(74,140,255,.06) 0%, rgba(74,140,255,.14) 40%,
    rgba(255,255,255,.06) 50%, rgba(74,140,255,.14) 60%, rgba(74,140,255,.06) 100%
  );
  background-size: 200% auto;
  animation: btnShimmer 4s linear infinite;
  transition: border-color .2s, box-shadow .2s;
}
.ck-main-btn:active { border-color: var(--glow); box-shadow: 0 0 20px rgba(74,140,255,.3); }
.ck-btn-label {
  font-family: 'Space Mono', monospace; font-size: .44rem;
  letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: .25rem;
}
.ck-btn-text {
  font-family: 'Space Mono', monospace; font-size: .6rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--glow);
}

.ck-quick-links { display: flex; gap: .4rem; width: 100%; }
.ck-quick-btn {
  flex: 1; font-family: 'Space Mono', monospace;
  font-size: .4rem; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); background: rgba(74,140,255,.04);
  border: 1px solid var(--dim); border-radius: 4px;
  padding: .38rem .3rem; cursor: pointer; text-align: center; transition: all .15s;
}
.ck-quick-btn:active { border-color: var(--glow); color: var(--glow); }

/* ── CONTATORI ───────────────────────────── */
.ck-counter-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: .28rem; flex: 1;
}
.ck-counter {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: .3rem; background: rgba(74,140,255,.04);
  border: 1px solid rgba(74,140,255,.08); border-radius: 4px;
}
.ck-counter-val {
  font-family: 'Space Mono', monospace; font-size: 1rem; font-weight: 700;
  color: var(--glow); line-height: 1;
}
.ck-counter-lbl {
  font-family: 'Space Mono', monospace; font-size: .36rem;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  margin-top: .18rem; text-align: center;
}

/* ── Nasconde copertina inattiva ─────────── */
#copertina:not(.active) { display: none !important; pointer-events: none !important; }
#copertina:not(.active) * { visibility: hidden !important; pointer-events: none !important; }


/* ── Espansione pannello al tap ──────────── */
.ck-panel-anim {
  border-radius: 8px !important;
}
.ck-panel-anim .ck-panel-label {
  padding: .6rem 1rem;
  font-size: .72rem !important;
  letter-spacing: .12em;
}
.ck-panel-anim .ck-panel-label span {
  font-size: .62rem !important;
}
.ck-panel-anim .ck-panel-body {
  padding: 1.2rem 1.4rem;
  overflow-y: auto;
  flex: 1;
  font-size: 1.1rem;
}
/* Tutti i testi interni scalati */
.ck-panel-anim .ck-mod-num,
.ck-panel-anim .ck-mod-name,
.ck-panel-anim .ck-mod-status   { font-size: .72rem !important; }
.ck-panel-anim .ck-vitale-label { font-size: .65rem !important; }
.ck-panel-anim .ck-vitale-val   { font-size: .78rem !important; }
.ck-panel-anim .ck-soreu-name   { font-size: .68rem !important; }
.ck-panel-anim .ck-soreu-pop    { font-size: .62rem !important; }
.ck-panel-anim .ck-log-line     { font-size: .64rem !important; }
.ck-panel-anim .ck-log-time     { font-size: .64rem !important; }
.ck-panel-anim .ck-radar-lbl    { font-size: .58rem !important; }
.ck-panel-anim .ck-counter-val  { font-size: 1.6rem !important; }
.ck-panel-anim .ck-counter-lbl  { font-size: .56rem !important; }
.ck-panel-anim .ck-btn-label    { font-size: .62rem !important; }
.ck-panel-anim .ck-btn-text     { font-size: .88rem !important; }
.ck-panel-anim .ck-quick-btn    { font-size: .58rem !important; padding: .6rem .5rem !important; }
.ck-panel-anim .ck-vitale-bar   { height: 4px !important; }
.ck-panel-anim .ck-mod          { padding: .5rem .5rem !important; }
.ck-panel-anim .ck-mod-bar      { width: 40px !important; }
.ck-panel-anim .ck-soreu-item   { padding: .2rem 0 !important; }

.ck-overlay {
  position: fixed; inset: 0; z-index: 199;
  background: rgba(3,4,10,.8);
  backdrop-filter: blur(4px);
  animation: overlayIn .3s ease forwards;
}
@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
