:root{
  --content-max: 760px;
  --glass: rgba(0,0,0,0.72);
  --glass-2: rgba(0,0,0,0.62);
  --border: rgba(255,255,255,0.12);
}

*{box-sizing:border-box}

html,body{height:100%}

body{
  margin:0;
  font-family:'Raleway',system-ui,-apple-system,'Segoe UI',Arial,sans-serif;
  color:#fff;
  background:#000;
  text-rendering:optimizeLegibility;
}

.bgimg{
  /* Better handling on mobile browsers with dynamic toolbars */
  min-height:100vh;
  min-height:100svh;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  padding:clamp(16px,3.2vw,40px);
  background-position:center;
  background-repeat:no-repeat;
  background-size:cover;
  background-attachment:scroll;
  background-color:#000;

  /* Fallback + modern WebP sources */
  background-image:url('../images/background-1920.jpg');
  background-image:image-set(
    url('../images/background-960.webp') type('image/webp') 1x,
    url('../images/background-1920.webp') type('image/webp') 2x
  );
}

/* Use a higher-res background on very large (QHD/1440p-class) viewports */
@media (min-width:2000px){
  .bgimg{
    background-image:url('../images/background-2560.jpg');
    background-image:image-set(
      url('../images/background-2560.webp') type('image/webp') 1x
    );
  }
}

/*
  Index page layout:
  Keep the logo + CTA buttons + server status vertically centered at all times,
  while the footer stays at the bottom of the viewport.
*/
.page-index .bgimg{justify-content:flex-start;}
.page-index .main{
  flex:1 0 auto;
  justify-content:center;
}
.page-index .footer{margin-top:0;}

/*
  Register page layout:
  Keep the logo + registration panel vertically centered at all times,
  while the footer stays at the bottom of the viewport.
*/
.page-register .bgimg{justify-content:flex-start;}
.page-register .main{
  flex:1 0 auto;
  justify-content:center;
}
.page-register .footer{margin-top:0;}

@supports (height: 100dvh){
  .bgimg{min-height:100dvh}
}

.main{
  width:min(92vw,var(--content-max));
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:clamp(10px,2.2vh,20px);
}

.logo{
  width:clamp(200px,50vw,520px);
  height:auto;
}

.platforms{
  width:clamp(220px,55vw,560px);
  height:auto;
}

.image{
  width:100%;
  display:flex;
  justify-content:center;
  background-color:rgba(0,0,0,0.2);
  padding:clamp(6px,1.2vh,10px) clamp(8px,1.8vw,16px);
}

hr{
  width:min(60%,420px);
  border:0;
  border-top:1px solid rgba(255,255,255,0.35);
  margin:0;
}

.cta{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:12px;
}

.button{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
  color:#fff;
  background:var(--glass);
  border:1px solid rgba(255,255,255,0.10);
  border-radius:10px;
  padding:14px 22px;
  min-width:min(280px,90vw);
  font-size:clamp(0.85rem,1.6vw,1rem);
  letter-spacing:0.02em;
  cursor:pointer;
  box-shadow:0 10px 20px rgba(0,0,0,0.35);
  backdrop-filter:blur(4px);
  -webkit-backdrop-filter:blur(4px);
  transition:transform 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.form-actions .button{
  min-width: 0;
  flex: 1 1 0;   /* more deterministic 50/50 split */
}
.button:hover{background:rgba(0,0,0,0.84);border-color:rgba(255,255,255,0.18);transform:translateY(-1px)}
.button:active{transform:translateY(0)}
.button:focus-visible{outline:2px solid rgba(255,255,255,0.85);outline-offset:3px}

/* Status pills (online/offline) */
.status-wrap{
  width:100%;
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:10px;
}

.status{
  flex:1 1 220px;
  max-width:360px;
  padding:12px 14px;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--glass-2);
  box-shadow:0 10px 20px rgba(0,0,0,0.28);
}

.status--ok{border-color:rgba(60, 179, 113, 0.32); background:rgba(60, 179, 113, 0.18)}
.status--bad{border-color:rgba(255, 0, 0, 0.28); background:rgba(255, 0, 0, 0.14)}

/* Simple panel for the registration form */
.panel{
  width:100%;
  text-align:left;
  border:1px solid var(--border);
  border-radius:16px;
  background:var(--glass);
  padding:18px 18px 16px;
  box-shadow:0 14px 30px rgba(0,0,0,0.40);
}

.panel h2{
  font-size:1.05rem;
  margin:0 0 12px;
}

.form-row{margin:0 0 12px}

/* Form actions: keep buttons on the same row when space allows */
.form-actions{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  align-items:stretch;
}

.form-actions .button{
  /* Override the global min-width so two actions can fit side-by-side */
  min-width:0;
  flex:1 1 180px;
}

label{display:block;margin:0 0 6px;opacity:0.92}

input[type="text"],
input[type="password"],
select{
  width:100%;
  padding:12px 12px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,0.14);
  background:rgba(255,255,255,0.06);
  color:#fff;
  outline:none;
}

input::placeholder{color:rgba(255,255,255,0.65)}

input:focus,
select:focus{
  border-color:rgba(255,255,255,0.32);
  box-shadow:0 0 0 3px rgba(255,255,255,0.10);
}

select option{color:#000}

.helper{
  font-size:0.82rem;
  color:rgba(255,255,255,0.78);
  margin-top:8px;
}

.alert{
  margin:0 0 12px;
  padding:10px 12px;
  border-radius:10px;
  border:1px solid var(--border);
  /* Default background (overridden for ok/bad variants) */
  background:rgba(0,0,0,0.40);
}

/*
  Registration feedback messages
  The register page uses #alert_message with these modifier classes.
  Requirement: success = full green background, error = full red background.
*/
.alert--ok{
  border-color:rgba(60, 179, 113, 0.65);
  background:rgba(60, 179, 113, 0.85);
}

.alert--bad{
  border-color:rgba(255, 0, 0, 0.65);
  background:rgba(255, 0, 0, 0.78);
}

/*
  Hard override for cases where other stylesheets override `.alert`.
  We target the actual element used on the register page for maximum specificity.
*/
#alert_message.alert--ok{
  background-color:rgba(60, 179, 113, 0.85) !important;
  border-color:rgba(60, 179, 113, 0.65) !important;
  color:#fff;
}

#alert_message.alert--bad{
  background-color:rgba(255, 0, 0, 0.78) !important;
  border-color:rgba(255, 0, 0, 0.65) !important;
  color:#fff;
}

.footer{
  margin-top:auto;
  padding-top:18px;
  padding-bottom:max(0px,env(safe-area-inset-bottom));
  font-size:clamp(0.75rem,1.2vw,0.9rem);
  opacity:0.92;
}

@media (max-height: 430px) and (orientation: landscape){
  .bgimg{padding:clamp(10px,2.2vw,18px)}
  .main{gap:10px}
  .logo{width:clamp(160px,28vw,340px)}
  .platforms{width:clamp(180px,30vw,360px)}
  .image{padding:4px 10px}
  .button{padding:10px 18px;min-width:min(240px,44vw);font-size:0.82rem}
  .footer{padding-top:10px}
}

@media (max-width: 360px){
  .button{min-width:min(260px,92vw)}
}

@media (prefers-reduced-motion: reduce){
  .button{transition:none}
}

.fade-in{
  animation:fadeIn 420ms ease-out both;
}

@keyframes fadeIn{
  from{opacity:0;transform:translateY(6px)}
  to{opacity:1;transform:translateY(0)}
}
