:root{
  --bg-color:#1c1b29;
  --bg-color-2:#151421;
  --text-color:#d4d4ff;
  --muted-color:#aeb3d9;
  --highlight-color:#4f86f7;
  --highlight-hover:#3a6dc9;
  --card-bg-color:#2a2738;
  --card-bg-color-2:#312d44;
  --border-color:#393552;
  --shadow:0 8px 24px rgba(0,0,0,0.28);
  --shadow-soft:0 4px 14px rgba(0,0,0,0.22);
}

html.light-theme{
  --bg-color:#f5f6fb;
  --bg-color-2:#e8eaf3;
  --text-color:#1c1b29;
  --muted-color:#5c607a;
  --highlight-color:#4f86f7;
  --highlight-hover:#3a6dc9;
  --card-bg-color:#ffffff;
  --card-bg-color-2:#f1f2f8;
  --border-color:#d6d9e6;
  --shadow:0 8px 20px rgba(0,0,0,0.08);
  --shadow-soft:0 4px 14px rgba(0,0,0,0.10);
}


*,
*::before,
*::after{
  box-sizing:border-box;
}

html,
body{
  width:100%;
  max-width:100%;
  overflow-x:hidden;
}

@supports (overflow:clip){
  html,
  body{
    overflow-x:clip;
  }
}

body{
  margin:0;
  font-family:Arial, sans-serif;
  background:linear-gradient(180deg, var(--bg-color), var(--bg-color-2));
  color:var(--text-color);
  line-height:1.5;
}

img,
svg,
video,
canvas{
  max-width:100%;
  height:auto;
}

/* Header */
header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:12px 20px;
  background:linear-gradient(180deg, var(--card-bg-color), var(--card-bg-color-2));
  border-bottom:1px solid var(--border-color);
  box-shadow:var(--shadow);
  min-width:0;
}

header > *{
  min-width:0;
}

.logo{
  height:48px;
  width:auto;
}

.header-links{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
  align-items:center;
}

/* Buttons / links */
.join-link,
.info-link,
.download-btn{
  display:inline-block;
  font-size:0.95rem;
  font-weight:700;
  color:var(--highlight-color);
  text-decoration:none;
  background-color:transparent;
  padding:9px 14px;
  border:2px solid var(--highlight-color);
  border-radius:6px;
  transition:background-color 0.25s ease, color 0.25s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.join-link:hover,
.info-link:hover,
.download-btn:hover{
  background-color:var(--highlight-color);
  color:#ffffff;
  transform:translateY(-1px);
  box-shadow:var(--shadow-soft);
}

/* Heading */
h1{
  text-align:center;
  margin:22px 0 8px;
  padding:0 14px;
  font-size:2rem;
  letter-spacing:1px;
  font-weight:800;
  color:var(--highlight-color);
  text-shadow:0 1px 2px rgba(0,0,0,0.45);
}

/* Title + counter */
.title-row{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  text-align:center;
}

.node-counter{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:0.95rem;
  font-weight:800;
  padding:6px 12px;
  border-radius:999px;
  border:1px solid var(--highlight-color);
  color:var(--highlight-color);
  background:rgba(79,134,247,0.08);
  white-space:nowrap;
}

.node-counter.counter-error{
  opacity:0.75;
  border-style:dashed;
}

/* Main container */
.container{
  max-width:1100px;
  margin:0 auto;
  padding:18px;
  display:flex;
  flex-direction:column;
  gap:14px;
}

/* Cards / nodes */
.node{
  display:flex;
  flex-direction:column;
  padding:14px;
  background:linear-gradient(180deg, var(--card-bg-color), var(--card-bg-color-2));
  border:1px solid var(--border-color);
  border-radius:8px;
  box-shadow:var(--shadow-soft);
  transition:transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.node:hover{
  transform:translateY(-2px);
  box-shadow:var(--shadow);
  border-color:#4b4667;
}

.node.talking{
  border:2px solid var(--highlight-color);
  box-shadow:0 0 18px rgba(79,134,247,0.38);
}

.node-summary{
  display:flex;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}

.node-name{
  font-weight:700;
  color:var(--highlight-color);
}

.node-tgs,
.node-location{
  color:var(--muted-color);
}

.node-time{
  text-align:right;
}

.node-time p{
  margin:6px 0 0;
  font-size:0.9rem;
  color:var(--highlight-color);
}

/* Downloads */
.downloads-table{
  width:100%;
  border-collapse:collapse;
}

.downloads-table th,
.downloads-table td{
  padding:12px 14px;
  border-bottom:1px solid var(--border-color);
}

.downloads-table th{
  color:var(--highlight-color);
  font-weight:700;
  text-align:left;
}

.downloads-table td{
  color:var(--muted-color);
}

/* Footer */
.footer,
footer{
  margin-top:40px;
  padding:24px 16px;
  text-align:center;
  color:var(--muted-color);
  border-top:1px solid var(--border-color);
  background:linear-gradient(180deg, var(--card-bg-color), var(--card-bg-color-2));
  box-shadow:var(--shadow-soft);
  font-size:0.92rem;
}

.footer p,
footer p{
  margin:6px 0;
}

.footer a,
footer a{
  color:var(--highlight-color);
  text-decoration:none;
  font-weight:600;
}

.footer a:hover,
footer a:hover{
  text-decoration:underline;
}

.footer-content{
  max-width:1100px;
  margin:0 auto;
}

/* Login */
.login-container{
  max-width:400px;
  margin:50px auto;
  padding:20px;
  background:linear-gradient(180deg, var(--card-bg-color), var(--card-bg-color-2));
  border-radius:8px;
  border:1px solid var(--border-color);
  box-shadow:var(--shadow-soft);
}

.login-container input{
  width:100%;
  padding:10px;
  margin-bottom:20px;
  background-color:#211f2f;
  color:var(--text-color);
  border:1px solid var(--border-color);
  border-radius:4px;
}

.login-container button{
  width:100%;
  padding:10px;
  background-color:var(--highlight-color);
  color:white;
  border:none;
  border-radius:4px;
  cursor:pointer;
}

.error{
  color:#ff6b6b;
  text-align:center;
}

/* Admin */
.admin-container{
  max-width:1200px;
  margin:20px auto;
  padding:20px;
}

.user-form{
  background:linear-gradient(180deg, var(--card-bg-color), var(--card-bg-color-2));
  padding:20px;
  border-radius:8px;
  margin-bottom:20px;
  border:1px solid var(--border-color);
}

.users-list{
  width:100%;
  border-collapse:collapse;
}

table{
  width:100%;
  border-collapse:collapse;
  background:linear-gradient(180deg, var(--card-bg-color), var(--card-bg-color-2));
}

.users-list th,
.users-list td{
  padding:10px;
  text-align:left;
  border-bottom:1px solid var(--border-color);
}

.users-list th{
  color:var(--highlight-color);
}

.active{
  background-color:#2a2738;
}

.inactive{
  background-color:#555555;
}

.reactivate-button{
  color:#4f86f7;
  font-weight:700;
  text-decoration:none;
  padding:5px 10px;
  border:2px solid #4f86f7;
  border-radius:4px;
  background-color:transparent;
}

.reactivate-button:hover{
  background-color:#4f86f7;
  color:#fff;
}

.action-buttons button{
  margin:0 5px;
  padding:5px 10px;
  border-radius:4px;
  cursor:pointer;
}

.edit-button{
  background-color:#007bff;
  color:white;
  border:none;
}

.delete-button{
  background-color:#dc3545;
  color:white;
  border:none;
}

.deactivate-button{
  color:#ff4f4f;
  font-weight:700;
  text-decoration:none;
  padding:5px 10px;
  border:2px solid #ff4f4f;
  border-radius:4px;
  background-color:transparent;
}

.deactivate-button:hover{
  background-color:#ff4f4f;
  color:#fff;
}

/* Center logo helpers */
.center-logo,
.center-logo-wrapper,
.center-logo-container{
  display:flex;
  justify-content:center;
  align-items:center;
  width:100%;
  margin:20px 0;
}

.center-logo-img{
  max-width:200px;
  height:auto;
}

/* Mobile */
@media (max-width:768px){
  header{
    flex-direction:column;
    text-align:center;
  }

  .header-links{
    justify-content:center;
  }

  .container{
    padding:12px;
  }

  h1{
    font-size:1.65rem;
  }

  .node-summary{
    flex-direction:column;
    align-items:flex-start;
  }

  .node-time{
    text-align:left;
    width:100%;
  }

  .footer,
  footer{
    margin-top:28px;
    padding:20px 14px;
  }
}

.uk-map-container{
  display:flex;
  justify-content:center;
  margin:40px 0 10px;
}

.uk-map-img{
  max-width:400px;
  width:100%;
  height:auto;
  opacity:0.9;
}

body{
  transition: background 0.25s ease, color 0.25s ease;
}

.node,
.login-container,
.user-form,
table{
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}


.stream-select-wrap{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 14px;
  border:1px solid var(--border-color);
  border-radius:999px;
  background:linear-gradient(180deg, var(--card-bg-color), var(--card-bg-color-2));
  box-shadow:var(--shadow-soft);
}

.stream-select-label{
  font-weight:700;
  color:var(--text-color);
  white-space:nowrap;
}

.stream-select-input{
  min-width:240px;
  border:none;
  outline:none;
  background:transparent;
  color:var(--text-color);
  font:inherit;
}

.stream-select-input option{
  background:var(--card-bg-color);
  color:var(--text-color);
}

.global-stream-player{
  max-width:1100px;
  margin:0 auto 14px;
  padding:0 18px;
  display:none;
}

.global-stream-player.show{
  display:block;
}

.global-stream-player-card{
  position:relative;
  display:flex;
  flex-direction:column;
  gap:12px;
  padding:14px 16px;
  border:1px solid var(--border-color);
  border-radius:16px;
  background:linear-gradient(180deg, #181726, #222036);
  box-shadow:var(--shadow-soft);
}

.global-stream-player-head{
  display:flex;
  flex-direction:column;
  gap:4px;
  padding-right:48px;
}

.global-stream-player-title{
  font-weight:800;
  color:var(--highlight-color);
}

.global-stream-player-name{
  font-weight:700;
  color:var(--text-color);
}

.global-stream-audio audio{
  width:100%;
  filter: invert(1) hue-rotate(180deg) saturate(0.75) brightness(0.95);
}

.global-stream-close{
  position:absolute;
  top:12px;
  right:12px;
  border:1px solid var(--highlight-color);
  background:transparent;
  color:var(--highlight-color);
  border-radius:8px;
  padding:5px 10px;
  font:inherit;
  font-weight:800;
  cursor:pointer;
}

.global-stream-close:hover{
  background:var(--highlight-color);
  color:#fff;
}
