/* Mobile-first, offline-first, no framework */
:root{
  --bg:#2b2118;             /* cocoa */
  --card:#3a2a20;           /* warm brown */
  --card2:#2f231b;          /* deep brown */
  --text:#f6f0e8;           /* parchment */
  --muted:rgba(246,240,232,.74);
  --line:rgba(246,240,232,.14);
  --accent:#d2a56b;         /* caramel */
  --accent2:#b98b54;        /* toasted */
  --danger:#ff7a7a;
  --shadow: 0 18px 50px rgba(0,0,0,.45);
  --r:18px;
  --pad:14px;
  --w: 980px;
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family:var(--font);
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(215,199,255,.18), transparent 55%),
    radial-gradient(900px 600px at 110% 10%, rgba(199,255,223,.14), transparent 50%),
    radial-gradient(800px 600px at 50% 120%, rgba(255,255,255,.06), transparent 55%),
    var(--bg);
  color:var(--text);
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}

.app{
  min-height:100%;
  display:flex;
  flex-direction:column;
}

.topbar{
  position:sticky;
  top:0;
  z-index:50;
  padding: 14px 14px 10px;
  backdrop-filter: blur(12px);
  background: linear-gradient(to bottom, rgba(15,15,16,.92), rgba(15,15,16,.65));
  border-bottom:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
  min-width: 0;
}
.dot{
  width:12px;height:12px;border-radius:6px;
  background: linear-gradient(135deg, var(--accent), rgba(255,255,255,.2));
  box-shadow: 0 0 0 6px rgba(215,199,255,.08);
}
.brand__text{ min-width:0; }
.brand__title{
  font-weight:750;
  letter-spacing:.02em;
  font-size:14px;
  line-height:1.1;
}
.brand__sub{
  font-size:12px;
  color:var(--muted);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.main{
  width:100%;
  max-width:var(--w);
  margin: 0 auto;
  padding: 14px 14px 88px;
  flex:1;
}

.card{
  background: linear-gradient(to bottom, rgba(20,20,22,.92), rgba(16,16,18,.92));
  border:1px solid rgba(255,255,255,.08);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 16px;
}

.h1{ font-size:26px; line-height:1.08; margin:0 0 10px; letter-spacing:-.01em; }
.h2{ font-size:20px; line-height:1.15; margin:0; letter-spacing:-.01em; }
.h3{ font-size:18px; line-height:1.2; margin:0; letter-spacing:-.01em; }

.kicker{
  font-size:12px;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.14em;
  font-weight:650;
  margin-bottom:6px;
}

.muted{ color:var(--muted); margin:8px 0 0; }
.tiny{ font-size:12px; }
.hr{ height:1px; background:var(--line); margin: 14px 0; }

.grid{
  display:grid;
  grid-template-columns: 1fr;
  gap:12px;
  margin: 14px 0;
}
.grid2{
  display:grid;
  grid-template-columns: 1fr;
  gap:12px;
}

.field{
  display:flex;
  flex-direction:column;
  gap:6px;
}
.field span{
  font-size:12px;
  color:var(--muted);
  font-weight:650;
  letter-spacing:.04em;
}
input, select, textarea{
  font-family:var(--font);
  width:100%;
  padding: 12px 12px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.25);
  color: var(--text);
  outline:none;
}
textarea{ resize:vertical; min-height: 120px; }
input::placeholder, textarea::placeholder{ color: rgba(244,243,241,.45); }

.row{
  display:flex;
  align-items:center;
  gap:10px;
  margin-top:12px;
}
.row.wrap{ flex-wrap:wrap; }

.btn{
  appearance:none;
  border:1px solid rgba(255,255,255,.12);
  background: linear-gradient(135deg, rgba(215,199,255,.25), rgba(255,255,255,.06));
  color: var(--text);
  padding: 11px 14px;
  border-radius: 14px;
  font-weight:750;
  letter-spacing:.02em;
  cursor:pointer;
  user-select:none;
}
.btn:active{ transform: translateY(1px); }
.btn--ghost{
  background: rgba(255,255,255,.04);
}
.btn--danger{
  background: rgba(255,107,107,.16);
  border-color: rgba(255,107,107,.25);
}

.pill{
  appearance:none;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 999px;
  font-weight:700;
  cursor:pointer;
}

.dash{
  display:flex;
  flex-direction:column;
  gap:14px;
}
.dash__actions{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}

.viewhead{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}
.viewhead__actions{ flex:0 0 auto; }

.report-controls, .calendar-controls, .glossary-controls, .sims-controls, .season-controls{
  display:grid;
  grid-template-columns: 1fr;
  gap:12px;
}

.ihk__meta{
  display:grid;
  grid-template-columns: 1fr;
  gap:10px;
  margin-bottom:12px;
}
.ihk__box{
  border:1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.22);
  border-radius: 14px;
  padding: 10px 12px;
}
.val{ font-weight:750; margin-top:2px; }

.list{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.item{
  border:1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.22);
  border-radius: 16px;
  padding: 12px;
}
.item__top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}
.item__title{
  font-weight:800;
  letter-spacing:.01em;
}
.item__meta{
  font-size:12px;
  color:var(--muted);
  margin-top:6px;
}
.item__actions{
  display:flex;
  gap:8px;
  flex:0 0 auto;
}
.chip{
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  padding: 6px 10px;
  border-radius: 999px;
  font-size:12px;
  font-weight:750;
  cursor:pointer;
}

.sim{
  display:flex;
  flex-direction:column;
  gap:12px;
}
.sim__top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.sim__progress{
  font-weight:800;
  letter-spacing:.02em;
}
.sim__timer{
  font-weight:850;
  padding: 6px 10px;
  border-radius: 999px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.25);
}
.options{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.option{
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  border-radius: 16px;
  padding: 12px;
  cursor:pointer;
}
.option input{ margin-right:10px; transform: translateY(1px); }
.option--ok{ border-color: rgba(199,255,223,.35); background: rgba(199,255,223,.10); }
.option--bad{ border-color: rgba(255,107,107,.35); background: rgba(255,107,107,.10); }

.result{
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.22);
  border-radius: 16px;
  padding: 12px;
}

.season{
  display:grid;
  grid-template-columns: 1fr;
  gap:12px;
}
.season__col{
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.22);
  border-radius: 16px;
  padding: 12px;
}
.season__col h3{
  margin:0 0 10px;
  font-size:14px;
  letter-spacing:.08em;
  text-transform:uppercase;
  color: rgba(244,243,241,.82);
}
.taglist{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.tag{
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  padding: 7px 10px;
  border-radius: 999px;
  font-weight:750;
  font-size:12px;
}

/* Tabbar */
.tabbar{
  position:fixed;
  left:0; right:0; bottom:0;
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  display:flex;
  gap:8px;
  justify-content:space-between;
  background: linear-gradient(to top, rgba(15,15,16,.96), rgba(15,15,16,.65));
  border-top:1px solid var(--line);
  backdrop-filter: blur(12px);
  z-index:60;
}
.tab{
  flex:1;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
  padding: 10px 8px;
  border-radius: 16px;
  border:1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.04);
  color: var(--text);
  cursor:pointer;
  font-weight:800;
  font-size:12px;
}
.tab__dot{
  width:8px;height:8px;border-radius:999px;
  background: rgba(255,255,255,.24);
}
.tab.is-active{
  background: linear-gradient(135deg, rgba(215,199,255,.22), rgba(199,255,223,.10));
  border-color: rgba(255,255,255,.14);
}
.tab.is-active .tab__dot{
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}

/* Desktop tweaks */
@media (min-width: 900px){
  .grid{ grid-template-columns: 1fr 1fr 1fr; }
  .grid2{ grid-template-columns: 1fr 1fr; }
  .report-controls, .calendar-controls, .glossary-controls, .sims-controls, .season-controls{
    grid-template-columns: 1fr auto;
    align-items:end;
  }
  .dash{ flex-direction:row; align-items:flex-start; justify-content:space-between; }
  .dash__actions{ justify-content:flex-end; }
  .ihk__meta{ grid-template-columns: 1fr 1fr 1fr; }
  .season{ grid-template-columns: 1fr 1fr 1fr; }
}

/* Print layout for PDF export */
@media print{
  body{ background:#fff; color:#000; }
  .topbar, .tabbar{ display:none !important; }
  .main{ padding:0; max-width:none; }
  .card{ box-shadow:none; border:none; background:#fff; color:#000; }
  input, textarea, select{ border:1px solid #000; background:#fff; color:#000; }
  .muted{ color:#333; }
}

/* Signature */
.sigWrap{display:flex;flex-direction:column;gap:10px;margin-top:10px}
#sigCanvas{width:100%;height:auto;border:1px solid var(--line);border-radius:12px;background:rgba(255,255,255,.04);touch-action:none}
.sigActions{display:flex;gap:10px;flex-wrap:wrap}

/* Saison */
.season{display:grid;grid-template-columns:1fr;gap:14px}
@media(min-width:840px){.season{grid-template-columns:repeat(3,1fr)}}
.season__col{border:1px solid var(--line);border-radius:16px;padding:14px;background:rgba(255,255,255,.04)}
.season__list{list-style:none;margin:10px 0 0 0;padding:0;display:flex;flex-direction:column;gap:8px}
.season__item details{border:1px solid rgba(255,255,255,.10);border-radius:14px;padding:10px 12px;background:rgba(0,0,0,.12)}
.season__item summary{cursor:pointer;font-weight:800;letter-spacing:.01em}
.season__details{margin-top:8px;display:flex;flex-direction:column;gap:6px}


/* Language toggle (top right) */
.lang-toggle{
  position:absolute;
  top:14px;
  right:14px;
  z-index:50;
  border:1px solid var(--line);
  background:rgba(255,255,255,.06);
  color:var(--text);
  font-weight:800;
  letter-spacing:.12em;
  border-radius:999px;
  padding:10px 12px;
  min-width:54px;
}
.lang-toggle:active{ transform:translateY(1px); }


/* AI Coach */
.aiOut{ margin-top:14px; }
.aiBubble{
  padding:14px 14px;
  border-radius:16px;
  border:1px solid rgba(0,0,0,.12);
  background:rgba(255,255,255,.86);
  line-height:1.45;
}
.pill--ok{ border-color: rgba(25,135,84,.35); background: rgba(25,135,84,.10); }

/* Tabbar – allow horizontal scroll if needed */
.tabbar{ overflow-x:auto; -webkit-overflow-scrolling:touch; }
.tabbar::-webkit-scrollbar{ height:6px; }
.tabbar::-webkit-scrollbar-thumb{ background: rgba(0,0,0,.12); border-radius:999px; }
