/* v19_layout_fix: prevent overflow */
*{box-sizing:border-box;}

:root{
  --bgA:#090b2a;
  --bgB:#081a3f;

  --glow1: rgba(255, 210, 245, .34);
  --glow2: rgba(190, 255, 250, .26);
  --glow3: rgba(255, 245, 200, .20);

  --card: rgba(255,255,255,.14);
  --card2: rgba(255,255,255,.20);
  --stroke: rgba(255,255,255,.26);

  --text: rgba(255,255,255,.94);
  --muted: rgba(255,255,255,.78);

  --accent1:#b9fff6;
  --accent2:#ffd7fb;

  --shadow: 0 18px 60px rgba(0,0,0,.42);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: "Nunito", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color:var(--text);
  overflow:hidden;

  background:
    radial-gradient(900px 560px at 18% 10%, var(--glow1), transparent 65%),
    radial-gradient(900px 560px at 92% 18%, var(--glow2), transparent 65%),
    radial-gradient(900px 560px at 50% 92%, var(--glow3), transparent 70%),
    linear-gradient(135deg, var(--bgA), var(--bgB));
}

#space{position:fixed; inset:0; width:100%; height:100%; display:block; z-index:0;}

.topbar{
  position:relative; z-index:3;
  display:flex; align-items:center; justify-content:space-between;
  padding: 18px 22px;
}
.brand{display:flex; align-items:center; gap:12px; user-select:none}
.logo{
  width:42px; height:42px; border-radius:16px;
  display:grid; place-items:center;
  background: linear-gradient(135deg, rgba(255,255,255,.18), rgba(255,255,255,.10));
  border:1px solid rgba(255,255,255,.22);
  box-shadow: 0 14px 36px rgba(0,0,0,.28);
  font-size:20px;
}
.brandTitle{font-weight:800; letter-spacing:.3px; font-size:20px}
.brandTag{font-weight:700; font-size:12px; color: var(--muted); margin-top:2px}

.actions{display:flex; gap:10px; align-items:center}

.stage{
  position:relative; z-index:2;
  height: calc(100% - 86px);
  display:grid; place-items:center;
  padding: 16px;
}

.card{
  position:relative;
  width:min(1040px, 92vw);
  height: min(76vh, 740px);
  padding: 24px 26px 22px;
  border-radius: 26px;
  background: linear-gradient(180deg, var(--card2), var(--card));
  border:1px solid var(--stroke);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  overflow:hidden;
}

.cardGlow{
  position:absolute; inset:-2px;
  border-radius: 28px;
  background:
    radial-gradient(700px 260px at 35% 0%, rgba(185,255,246,.26), transparent 60%),
    radial-gradient(520px 240px at 85% 10%, rgba(255,215,251,.22), transparent 55%),
    radial-gradient(620px 300px at 22% 100%, rgba(255,245,200,.18), transparent 60%);
  pointer-events:none;
  opacity:.95;
}

.cardHeader h1{
  margin:0 0 6px;
  font-size: clamp(26px, 3.0vw, 42px);
  line-height:1.05;
}
.accent{
  background: linear-gradient(90deg, var(--accent1), var(--accent2));
  -webkit-background-clip:text;
  background-clip:text;
  color:transparent;
}
.subtitle{
  margin:0 0 14px;
  color: var(--muted);
  font-weight:700;
  font-size: 14px;
}

/* slightly smaller baseline + auto-fit will fine tune */
.introText{
  font-size: 16.5px;
  line-height: 1.42;
  font-weight: 700;
  color: rgba(255,255,255,.92);
  height: calc(100% - 132px);
  overflow:hidden;
  padding-right: 6px;
}
.introText p{margin:0 0 9px;}

.ctaRow{
  position:absolute;
  left: 26px; right: 26px; bottom: 18px;
  display:flex; gap:12px; align-items:center; flex-wrap:wrap;
}

.btn{
  display:inline-flex; align-items:center; justify-content:center;
  text-decoration:none;
  border:0; cursor:pointer;
  border-radius: 14px;
  padding: 10px 14px;
  font-weight: 800;
  letter-spacing:.2px;
  color: rgba(255,255,255,.96);
  transition: transform .12s ease, filter .12s ease, background .18s ease, border-color .18s ease;
  user-select:none;
}
.btn:active{transform: translateY(1px) scale(.99)}
.btn:hover{filter: brightness(1.08)}
.btnBig{padding: 12px 18px; font-size: 15px}
.btnPrimary{
  background: linear-gradient(135deg, rgba(109,91,255,.95), rgba(37,215,255,.86));
  box-shadow: 0 16px 34px rgba(0,0,0,.28);
}
.btnSoft{
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.26);
}

.floaty{ animation: float 8.5s ease-in-out infinite; }
@keyframes float{
  0%{ transform: translateY(0px) }
  50%{ transform: translateY(-10px) }
  100%{ transform: translateY(0px) }
}

@media (max-width: 560px){
  .brandTag{display:none}
  .card{padding: 18px 16px 18px; height: min(78vh, 760px)}
  .ctaRow{left:16px; right:16px}
}



/* --- v15: Clean centered layout + registration module --- */

/* Center header */
.cardHeader{
  text-align: center;
}

/* Center intro text */
#introText{
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

/* Center CTA buttons */
.ctaRow{
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 20px;
}


/* --- v15 forms --- */
.formWrap{
  margin-top: 18px;
  display:flex;
  flex-direction: column;
  align-items: center;
  justify-content:center;
  gap: 14px;
}
.formGrid{
  width: min(760px, 92%);
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.field{display:flex; flex-direction:column; gap:8px;}
.field.full{grid-column: 1 / -1;}
label{font-weight:800; font-size:12px; letter-spacing:.2px; color: rgba(255,255,255,.84);}
input{
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.26);
  background: rgba(10,12,30,.26);
  color: rgba(255,255,255,.94);
  font: inherit;
  outline: none;
  box-shadow: 0 10px 26px rgba(0,0,0,.18) inset;
}
input:focus{
  border-color: rgba(185,255,246,.65);
  box-shadow: 0 0 0 3px rgba(185,255,246,.14);
}
.help{font-size:12px; font-weight:800; color: rgba(255,255,255,.66); margin-top:2px;}
.actionsRow{
  display:flex;
  gap: 12px;
  flex-wrap:wrap;
  justify-content:center;
  margin-top: 6px;
}
.msgArea{margin-top:10px; text-align:center; width:min(760px, 92%);}
.msg{
  display:inline-block;
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.12);
  box-shadow: 0 18px 52px rgba(0,0,0,.25);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  font-weight: 800;
  color: rgba(255,255,255,.90);
  max-width: min(760px, 92%);
}
.msg.ok{ border-color: rgba(185,255,246,.55); }
.msg.err{ border-color: rgba(255,170,190,.60); }
@media (max-width: 720px){
  .formGrid{grid-template-columns: 1fr;}
}


/* --- Admin Toggle (Ctrl+Shift+F8) --- */
.admin-only{display:none !important;}
body.admin-on .admin-only{display:inline-flex !important;}


/* v18: UI fixes */
/* Buttons nebeneinander (Register/Login Aktionen) */
.actionsRow.actionsInline{ 
  flex-wrap: nowrap;
}
.actionsRow.actionsInline > .btn{
  flex: 1 1 0;
  min-width: 220px;
  max-width: 360px;
}
@media (max-width: 620px){
  .actionsRow.actionsInline{ flex-wrap: wrap; }
  .actionsRow.actionsInline > .btn{ min-width: 160px; }
}

/* Meldungen wirklich unter den Buttons */
.msgArea{
  grid-column: 1 / -1;
  width: 100%;
  margin-top: 12px;
  display:flex;
  justify-content:center;
}
.msgArea .msg{
  width: min(760px, 100%);
  text-align: left;
}

html.admin-mode .admin-only{display:inline-flex !important;}


/* v19_layout_fix form controls */
input, select, textarea{
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.formRow, .formGrid{min-width:0;}



/* v19_ui_fix viewport + scroll safety */
:root{
  --stage-pad-top: 90px;
  --stage-pad-bottom: 40px;
}

/* Keep the glass card inside the viewport */
.stage{
  padding-top: var(--stage-pad-top);
  padding-bottom: var(--stage-pad-bottom);
}

.card{
  width: min(980px, calc(100vw - 48px));
  max-height: calc(100vh - (var(--stage-pad-top) + var(--stage-pad-bottom)));
  overflow: hidden; /* body will scroll */
}

/* Scroll inside the card if content is taller than the viewport */
.cardBody, form{
  max-height: calc(100vh - (var(--stage-pad-top) + var(--stage-pad-bottom) + 170px));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 10px; /* space for scrollbar */
}

/* Grid/Flex shrink fix (prevents cut-off fields) */
.formGrid, .formRow, .grid, .row{ min-width:0; }
input, select, textarea{
  width:100%;
  max-width:100%;
  min-width:0;
}

/* On smaller screens: collapse 2-column grids */
@media (max-width: 900px){
  .formGrid{
    grid-template-columns: 1fr !important;
  }
}


/* v19_ui_fix2: force single column grids when needed */
.formGrid.oneCol{ grid-template-columns: 1fr !important; }



/* v19_ui_fix3 tableWrap for admin lists */
.tableWrap{
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 14px;
}
.tableWrap table{
  min-width: 920px; /* allow horizontal scroll instead of squishing */
}
.tableWrap th, .tableWrap td{
  white-space: nowrap;
}



/* v19_ui_fix4: widen dashboard window instead of squeezing table */
.card.wide{
  width: min(1400px, calc(100vw - 48px));
}



/* v20 heroCenter: minimal title page (no glass card) */
body.home .stage{ display:flex; align-items:center; justify-content:center; min-height: 75vh; }
body.home .heroCenter{
  text-align:center;
  padding: 24px 18px;
}
body.home .heroTitle{
  font-size: clamp(46px, 6vw, 92px);
  letter-spacing: 1px;
  margin: 0 0 18px 0;
  font-weight: 800;
  background: linear-gradient(90deg, rgba(120,160,255,1), rgba(0,220,255,1));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 10px 40px rgba(0,0,0,0.35);
  animation: floatTitle 5.5s ease-in-out infinite;
}
body.home .heroSub{
  color: rgba(255,255,255,0.90);
  font-size: clamp(16px, 1.6vw, 22px);
  line-height: 1.5;
  margin: 0 0 18px 0;
}
body.home .heroSub p{ margin: 0; }
body.home .heroSub p + p{ margin-top: 16px; } /* "zweimal Absatz" */
@keyframes floatTitle{
  0%,100%{ transform: translateY(0); }
  50%{ transform: translateY(-10px); }
}
body.home .heroActions{ display:flex; gap: 12px; justify-content:center; margin-top: 10px; flex-wrap: wrap; }

/* v20 dashboard: avoid clipped admin table panel */
body.dashboard .cardBody{ overflow: visible; max-height: none; }
.tableWrap{ overflow:auto; max-height: 52vh; padding-bottom: 8px; border-radius: 16px; }
body.dashboard .card{ padding-bottom: 18px; }



/* v21: float everything (subtitle + buttons) */
@keyframes floatSoft{
  0%,100%{ transform: translateY(0); }
  50%{ transform: translateY(-8px); }
}
body.home .heroSub{
  animation: floatSoft 7.6s ease-in-out infinite;
  animation-delay: .25s;
}
body.home .heroActions{
  animation: floatSoft 8.4s ease-in-out infinite;
  animation-delay: .45s;
}
body.home .heroActions .btn{
  will-change: transform;
}

/* v23 Starfield Canvas */
#space{
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

/* Ensure main UI stays above canvas */
.topbar, .center-box, .page-wrap, .content, .modal, .card, .glass, .panel, .dashboard-shell{
  position: relative;
  z-index: 2;
}

/* Admin panel (hidden unless admin-mode) */
.admin-panel{
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: min(360px, calc(100vw - 32px));
  background: rgba(20, 22, 28, .72);
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 18px 40px rgba(0,0,0,.45);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 14px 14px 12px;
  color: rgba(255,255,255,.92);
  display: none;
  z-index: 9999;
}
.admin-panel__title{
  font-weight: 700;
  letter-spacing: .3px;
  margin-bottom: 10px;
}
.admin-panel__row{
  display: grid;
  grid-template-columns: 1fr 1.3fr auto;
  gap: 10px;
  align-items: center;
  margin: 10px 0;
}
.admin-panel__row label{
  font-size: 13px;
  opacity: .9;
}
.admin-panel__row input[type="range"]{
  width: 100%;
}
.admin-panel__val{
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  opacity: .95;
}
.admin-panel__hint{
  margin-top: 8px;
  font-size: 12px;
  opacity: .85;
}
.admin-mode .admin-panel{
  display: block;
}


/* v24: Admin-controlled theme vars */
:root{
  --title-grad-1: rgba(120, 80, 255, 1);
  --title-grad-2: rgba(110, 180, 255, 1);
  --title-grad-3: rgba(0, 220, 255, 1);
  --title-grad-4: rgba(120, 255, 220, 1);
  --hero-offset: -10px;
  --sub-weight: 800;
}

body.home .heroCenter{ transform: translateY(var(--hero-offset)); }

body.home .heroTitle{
  background: linear-gradient(90deg,
    var(--title-grad-1) 0%,
    var(--title-grad-2) 35%,
    var(--title-grad-3) 65%,
    var(--title-grad-4) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

body.home .heroSub{
  font-weight: var(--sub-weight);
  text-shadow: 0 12px 40px rgba(0,0,0,.40);
}

.admin-panel__row--select select{
  width: 100%;
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.16);
  color: rgba(255,255,255,.92);
  border-radius: 10px;
  padding: 8px 10px;
  outline: none;
}

:root{
  --sub-style: bold;
}

body.home .heroSub{
  font-weight: var(--sub-weight);
  font-weight: var(--sub-style);
}



/* v26: Hide Welcome UI to watch starfield (admin controlled) */
:root{
  --ui-hide: 0; /* 0 = show, 1 = hide */
}
body.home .heroCenter{
  transition: opacity .35s ease, transform .35s ease;
}
body.home.ui-hidden .heroCenter{
  opacity: 0;
  pointer-events: none;
  transform: translateY(calc(var(--hero-offset) + 8px));
}

/* v28: subtitle weight + style */
:root{ --sub-weight-effective: 800; }
body.home .heroSub{
  font-weight: var(--sub-weight-effective);
}
