:root {
  --paper: #f3ead7;
  --ink: #1e1b16;
  --muted: #5b5349;
  --edge: rgba(0,0,0,0.15);
  --shadow: rgba(0,0,0,0.18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--ink);
  background: #2b2b2b;
}

.container {
  padding: 18px;
  max-width: 1200px;
  margin: 0 auto;
}

/* -------------------------------------------------
   PAPER / CARDS
------------------------------------------------- */

.paper {
  background: var(--paper);
  border: 1px solid var(--edge);
  box-shadow: 0 10px 30px var(--shadow);
}

.card {
  padding: 14px;
  border-radius: 14px;
}

.card h2 {
  margin: 0 0 10px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.card-link:hover {
  filter: brightness(1.03);
}

.panel-soft{
  border: 1px solid var(--edge);
  border-radius: 14px;
  background: rgba(255,255,255,0.25);
  padding: 12px;
}

/* -------------------------------------------------
   TOP BAR
------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.title {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.2px;
}

.sub {
  color: var(--muted);
  font-size: 13px;
}

.dot { margin: 0 8px; }

.toplink{
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dashed rgba(0,0,0,0.18);
  padding-bottom: 1px;
}
.toplink:hover{
  border-bottom-color: rgba(0,0,0,0.35);
}

/* -------------------------------------------------
   BUTTONS
------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--edge);
  background: rgba(255,255,255,0.35);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  user-select: none;
}

.btn:hover { background: rgba(255,255,255,0.55); }

.btn.primary {
  background: rgba(0,0,0,0.12);
  font-weight: 700;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* -------------------------------------------------
   GRID SYSTEM
------------------------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}

.wide { grid-column: span 12; }

/* Daily Briefing: 3–6–3 */
.col-left  { grid-column: span 3; }
.col-mid   { grid-column: span 6; grid-row: span 2; }
.col-right { grid-column: span 3; }

/* -------------------------------------------------
   TYPOGRAPHY / HELPERS
------------------------------------------------- */

.big {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 4px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.small { font-size: 12px; }
.tiny { font-size: 11px; }

/* -------------------------------------------------
   KEY / VALUE
------------------------------------------------- */

.kv {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 12px;
  font-size: 13px;
}

.kv-tight{
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 6px 10px;
  font-size: 12px;
}

/* -------------------------------------------------
   STATS
------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.stats > div {
  background: rgba(255,255,255,0.35);
  border: 1px solid var(--edge);
  border-radius: 12px;
  padding: 10px;
}

.stats b {
  font-size: 18px;
  display: block;
}

.stats span {
  font-size: 12px;
  color: var(--muted);
}

/* -------------------------------------------------
   LISTS
------------------------------------------------- */

.list {
  margin: 0;
  padding-left: 18px;
}

.list li {
  margin: 6px 0;
  font-size: 13px;
}

/* -------------------------------------------------
   TAGS
------------------------------------------------- */

.tag {
  display: inline-block;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--edge);
  background: rgba(255,255,255,0.35);
}

.tag.high   { background: rgba(120, 0, 0, 0.10); }
.tag.medium { background: rgba(120, 70, 0, 0.10); }
.tag.low    { background: rgba(0, 80, 120, 0.10); }

/* -------------------------------------------------
   TASKS / MISSIONS
------------------------------------------------- */

.tasks {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.task {
  background: rgba(255,255,255,0.35);
  border: 1px solid var(--edge);
  border-radius: 12px;
  padding: 10px;
}

.task-title {
  font-weight: 700;
  margin-top: 6px;
}

/* -------------------------------------------------
   DAILY BRIEFING – MAP CARD PLACEHOLDER
------------------------------------------------- */

.map-card {
  text-decoration: none;
  color: var(--ink);
  padding: 14px;
}

.map-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}

.map-card-frame {
  position: relative;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--edge);
  background: rgba(0,0,0,0.08);
}

/* Optional: make square when you add .map-square */
.map-square { aspect-ratio: 1 / 1; }

.map-card-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.9) contrast(1.05);
  transition: transform 0.4s ease;
  display: block;
}

.map-card:hover img { transform: scale(1.02); }

.map-card-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.overlay-box {
  position: absolute;
  left: 14px;
  bottom: 14px;
  background: rgba(243,234,215,0.85);
  border: 1px solid var(--edge);
  border-radius: 12px;
  padding: 10px 12px;
  max-width: 320px;
}

.map-card:hover {
  box-shadow: 0 12px 34px rgba(0,0,0,0.22);
  transform: translateY(-1px);
}

/* If you use map-center on Daily Briefing */
.map-center {
  grid-column: span 6;
  grid-row: span 2;
}

/* -------------------------------------------------
   OPERATIONAL MAP PAGE
------------------------------------------------- */

.omap { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; }
.omap .wide { grid-column: span 12; }

.omap-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  margin-bottom:10px;
}

.omap-title{
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.18em;
  font-weight: 900;
}

.omap-sub{ margin-top: 4px; }

.omap-controls{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.omap-frame{ margin-top: 10px; }

.omap-canvas{
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(0,0,0,0.08);
  border: 1px solid var(--edge);
  
}

.omap-img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display:block;
  filter: saturate(0.95) contrast(1.02);
}

.omap-overlay{
  position:absolute;
  left: 14px;
  top: 14px;
  border-radius: 12px;
  background: rgba(243,234,215,0.55);
  border: 1px dashed rgba(0,0,0,0.18);
  padding: 10px 12px;
  width: fit-content;
  max-width: 420px;
}

.omap-section-head{
  display:flex;
  justify-content:space-between;
  align-items:baseline;
  gap: 10px;
  margin-bottom: 10px;
}

/* unit cards (map + airfield uses same style) */
.unit-cards{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.unit-card{
  border: 1px solid var(--edge);
  border-radius: 14px;
  padding: 12px;
  text-decoration: none;
  color: var(--ink);
  background: rgba(255,255,255,0.25);
}

.unit-card.is-clickable{ cursor: pointer; }
.unit-card.is-clickable:hover{
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
  transform: translateY(-1px);
}
.unit-card.is-locked{ opacity: 0.78; }

.unit-card-top{
  display:flex;
  justify-content:space-between;
  gap:10px;
  align-items:flex-start;
}
.unit-name{ font-weight: 900; font-size: 15px; }
.unit-meta{ display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }

.unit-planes{
  position: relative;
  height: 78px;
  margin: 10px 0 8px;
}

.plane-stack{
  position:absolute;
  top: 6px;
  width: 110px;
  height: 70px;
  object-fit: contain;
  filter: drop-shadow(0 8px 12px rgba(0,0,0,0.18));
  opacity: 0.95;
}

.plane-stack.p0 { left: 0; transform: rotate(-6deg); }
.plane-stack.p1 { left: 28px; transform: rotate(2deg); }
.plane-stack.p2 { left: 56px; transform: rotate(8deg); }

.unit-info .hint{ margin-top: 10px; font-weight: 700; }

/* strength blocks */
.strength-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

.strength-block{
  border: 1px solid var(--edge);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255,255,255,0.25);
}

.strength-title{ font-weight: 900; margin-bottom: 8px; }

/* floating sidepanel on map */
.omap-sidepanel{
  position: absolute;
  top: 14px;
  right: 14px;
  width: 260px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(243,234,215,0.88);
  border: 1px solid var(--edge);
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
}

.sidepanel-title{ font-weight: 900; margin-bottom: 6px; }

.sidepanel-block .muted div{ margin: 4px 0; }

/* legend dots */
.lg{
  display:inline-block;
  width: 10px; height: 10px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.18);
  margin: 0 6px 0 10px;
  vertical-align: middle;
}
.lg:first-child{ margin-left: 0; }
.lg-green{ background: rgba(0, 120, 60, 0.25); }
.lg-gray { background: rgba(120, 120, 120, 0.25); }
.lg-red  { background: rgba(140, 0, 0, 0.20); }
.lg-line { background: rgba(0, 0, 0, 0.10); width: 18px; }

.filt{ margin-right: 12px; white-space: nowrap; }

/* -------------------------------------------------
   AIRCRAFT DETAIL – HERO + SPECS TOGGLE
------------------------------------------------- */

.ac-hero{ margin-top: 10px; }

.ac-hero-frame{
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--edge);
  background: rgba(0,0,0,0.06);
  height: 320px;
}

.ac-hero-img{
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  padding: 0;
}

.ac-hero-placeholder{
  height: 320px;
  display:flex;
  align-items:center;
  justify-content:center;
}

.ac-specs{ display: none; }
.ac-hero-frame.is-specs-open .ac-specs{ display: block; }

.card-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
}
.card-head h2{ margin: 0; }

.ac-specs-toggle{
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 700;
}

.ac-hero-panel{
  position: absolute;
  top: 14px;
  bottom: 14px;
  width: 170px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(243,234,215,0.68);
  border: 1px solid var(--edge);
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
  backdrop-filter: blur(2px);
  overflow: hidden;
}

.ac-hero-panel.left { left: 14px; }
.ac-hero-panel.right{ right: 14px; }

.panel-title{
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  margin-bottom: 8px;
}

/* mobile: panels stack */
@media (max-width: 900px){
  .ac-hero-frame{ height: auto; }
  .ac-hero-panel{
    position: static;
    width: auto;
    margin: 10px 0 0;
    height: auto;
  }
  .ac-hero-img{ height: 320px; }
}

/* -------------------------------------------------
   AIRFIELD VIEW
------------------------------------------------- */

.airfield-page{
  display:flex;
  flex-direction:column;
  gap:14px;
}

.af .wide { grid-column: span 12; }

.af-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:14px;
}

.af-title{
  font-weight:900;
  letter-spacing:0.08em;
  text-transform:uppercase;
  font-size:18px;
}

.af-sub{ margin-top:4px; }

.af-canvas-wrap{ margin-top: 8px; }

.af-canvas{
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--edge);
  background: rgba(0,0,0,0.06);
  height: 520px;
}

.af-bg{
  width:100%;
  height:100%;
  object-fit: cover;
  display:block;
  opacity: 0.95;
}

.af-plane{
  position:absolute;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
  border-radius: 10px;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(0,0,0,0.12);
  cursor: pointer;
  text-decoration:none;
}

.af-plane:hover{ background: rgba(255,255,255,0.22); }

.af-plane img{
  width: 42px;
  height: 42px;
  object-fit: contain;
  display:block;
}

.af-overlay{
  position:absolute;
  top: 14px;
  right: 14px;
  width: 260px;
  border-radius: 14px;
  border: 1px solid var(--edge);
  background: rgba(243,234,215,0.72);
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
  backdrop-filter: blur(2px);
  padding: 12px;
  z-index: 3;
}

.overlay-title{
  font-weight:900;
  letter-spacing:0.08em;
  text-transform:uppercase;
  font-size:12px;
  margin-bottom:10px;
}

.af-tip{
  position: absolute;
  z-index: 10;
  pointer-events: none;
  max-width: 280px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--edge);
  background: rgba(243,234,215,0.92);
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
  font-size: 12px;
  color: var(--ink);
  display:none;
}

@media (max-width: 900px){
  .af-canvas{ height: 420px; }
  .af-overlay{ width: 220px; }
}

/* -------------------------------------------------
   CREATE CAMPAIGN UI
------------------------------------------------- */

.campaign-cards{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.campaign-card{
  display:block;
  text-decoration:none;
  color: var(--ink);
  border: 1px solid var(--edge);
  border-radius: 14px;
  background: rgba(255,255,255,0.25);
  padding: 12px;
}

.campaign-card:hover{
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
  transform: translateY(-1px);
}

.campaign-card.is-selected{
  outline: 2px solid rgba(0,0,0,0.18);
  background: rgba(255,255,255,0.35);
}

.campaign-title{
  font-weight: 900;
  letter-spacing: 0.04em;
}

/* Top area: left stack + right map */
.create-top{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:14px;
  align-items:start;
}

.create-left{
  display:flex;
  flex-direction:column;
  gap:14px;
}

/* Pilot identity */
.pilot-form{
  display:flex;
  gap:12px;
  align-items:flex-start;
}

.pilot-photo{
  width:92px;
  flex:0 0 auto;
}

.pilot-photo-placeholder{
  width:92px;
  height:92px;
  border-radius:16px;
  border:1px solid rgba(0,0,0,0.14);
  background: rgba(0,0,0,0.06);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:800;
  font-size:12px;
  letter-spacing:0.1em;
}

/* Stage cards */
.stage-cards{
  display:grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.stage-card{
  display:block;
  border:1px solid var(--edge);
  border-radius:12px;
  padding:10px;
  background: rgba(255,255,255,0.25);
}

/* Unit select cards */
.unit-select-cards{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:10px;
  margin-top:10px;
}

.unit-select-card{
  position: relative;
  display:block;
  border:1px solid var(--edge);
  border-radius:12px;
  padding:10px;
  background: rgba(255,255,255,0.25);
  cursor:pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}

.unit-select-card:hover{
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
  transform: translateY(-1px);
}

.unit-radio{
  position:absolute;
  opacity:0;
  pointer-events:none;
}

.unit-select-card:has(input[type="radio"]:checked){
  outline:2px solid rgba(0,0,0,0.22);
  background: rgba(255,255,255,0.35);
}

.unit-card-row{
  display:flex;
  gap:12px;
  align-items:center;
}

.unit-badge{
  width:56px;
  height:56px;
  border-radius:12px;
  border:1px solid rgba(0,0,0,0.14);
  background: rgba(0,0,0,0.06);
  display:flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
}

.unit-badge-inner{
  font-weight:900;
  font-size:11px;
  letter-spacing:0.12em;
  opacity:.8;
}

.unit-text{
  position:relative;
  z-index:2;
  min-width:0;
  padding-right:100px; /* safe zone for plane overlay */
}

.unit-title{
  font-weight:900;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.unit-planesop{
  height: 80px;
  display: flex;
  align-items: center;
}

.unit-planeop{
  display: block;
  max-width: 220px;
  max-height: 80px;
  width: auto !important;
  height: auto !important;
  object-fit: contain;
  transform: none !important;
}

/* plane overlay on right */
.unit-plane{
  position:absolute;
  right:10px;          /* ← detta är nyckeln */
  top:45%;
  transform: translateY(-50%);
  height:100px;
  width:180px;          /* lite bredare ger luftigare känsla */
  z-index:1;
  pointer-events:none;
}

.unit-plane img{
  width:100%;
  height:100%;
  object-fit: contain;
  display:block;
  opacity:0.9;
  float: right;
}

/* Responsive */
@media (max-width: 1000px){
  .campaign-cards{ grid-template-columns: 1fr; }
  .stage-cards{ grid-template-columns: repeat(2, 1fr); }
  .unit-select-cards{ grid-template-columns: 1fr; }
  .create-top{ grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .col-left,
  .col-mid,
  .col-right,
  .wide {
    grid-column: span 12;
    grid-row: auto;
  }

  .tasks { grid-template-columns: 1fr; }
  .strength-grid { grid-template-columns: 1fr; }
  .unit-cards { grid-template-columns: repeat(2, 1fr); }

  .omap-sidepanel{
    width: auto;
    left: 14px;
    right: 14px;
    top: auto;
    bottom: 14px;
  }
}

.unit-select-card.is-disabled{
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.25);
}
.unit-select-card.is-disabled:hover{
  box-shadow: none;
  transform: none;
}

.unit-divider{
  grid-column: 1 / -1;
  border-top: 1px solid rgba(0,0,0,0.12);
  margin: 6px 0;
  padding-top: 10px;
}

.unit-divider span{
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.stage-card{
  border: 1px solid var(--edge);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.stage-card.is-selected{
  border: 2px solid rgba(0,0,0,0.35);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.05);
}

.campaign-radio{
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.campaign-card{
  cursor: pointer;
}

.is-hidden { display: none !important; }

.opMapWrap {
  width: 100%;
  max-width: 1200px;
}

.opMapSvg {
  width: 100%;
  aspect-ratio: 1 / 1; /* 6203 x 6203 */
}

.opMapWrap {
  outline: 3px solid red;
}

.you-card__title{
  display:flex;
  gap:8px;
  align-items:baseline;
  margin-bottom:10px;
}

.you-card__rank{ white-space:nowrap; }
.you-card__name{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.you-card__body{
  display:flex;
  gap:12px;
  flex:1;           /* gör att body fyller neråt om kortet har bestämd höjd */
  min-height:0;     /* viktig i vissa flex-layouts så den inte spränger */
}

.you-card__portrait{
  width:108px;      /* justera vid behov */
  flex:0 0 108px;
  border-radius:12px;
  background:rgba(0,0,0,0.08);
  overflow:hidden;
}

.you-card__portrait-img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

.you-card__stats{
  display:flex;
  flex-direction:column;
  gap:6px;
  min-width:0;
}

.you-card__stat{
  display:flex;
  justify-content:space-between;
  gap:10px;
}

.unit-card__plane{
  margin-top:10px;
  border-radius:12px;
  /* samma “paper”-känsla som dina placeholders */
  background:rgba(0,0,0,0.02);
  border:1px solid rgba(0,0,0,0.08);
  height:110px;       /* justera vid behov */
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
}

.unit-card__plane-img{
  width:100%;
  height:100%;
  object-fit:contain; /* viktigt: aldrig beskära silhuett */
  display:block;
}

.unit-card__stats2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
  margin-top:10px;
}

.unit-card__statbox{
  border-radius:12px;
  border:1px solid rgba(0,0,0,0.12);
  background:rgba(255,255,255,0.35);
  padding:10px;
}

.unit-card__statbox b{
  display:block;
  font-size:18px;
  line-height:1.1;
}

.unit-card__statbox span{
  display:block;
  margin-top:2px;
  opacity:.75;
  font-size:12px;
}
/* Ground nodes: symbol readability on scaled-down map */
.op-gn rect.sym { stroke: #111; stroke-width: 2; }
.op-gn line.sym { stroke: #111; stroke-width: 2; stroke-linecap: square; }

.op-gn .op-gn-hit { fill: transparent; } /* hover-area only */

/* Ground nodes: keep symbols readable on a scaled-down map */
.op-gn .sym-box { stroke:#111; stroke-width:3.5; }
.op-gn .sym-line { stroke:#111; stroke-width:3.5; }

.op-gn .sym-oval { stroke:#111; stroke-width:2.2; fill:none; }
.op-gn .sym-dot  { fill:#111; }

.op-gn .op-gn-hit { fill: transparent; } /* bigger hover area only */
