/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

body {
  background: radial-gradient(ellipse at 30% 20%, #0d2040 0%, #0a1628 40%, #060d1a 100%);
  min-height: 100vh;
  color: #e2e8f0;
}

/* ===== Layout ===== */
.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 60px 24px 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

/* ===== Language Switcher ===== */
.lang-switcher {
  position: absolute;
  top: 24px;
  inset-inline-end: 24px;
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 4px;
}

.lang-btn {
  background: transparent;
  border: none;
  color: #7090b0;
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.lang-btn:hover {
  color: #c0d4e8;
}

.lang-btn.active {
  background: rgba(100,160,255,0.2);
  color: #90c0ff;
}

html[dir="rtl"] body {
  font-family: 'Segoe UI', Tahoma, system-ui, sans-serif;
}

html[dir="rtl"] .server-select-title,
html[dir="rtl"] .steps-section h3,
html[dir="rtl"] .walkthrough-heading,
html[dir="rtl"] .config-label,
html[dir="rtl"] .os-tab-btn {
  text-transform: none;
  letter-spacing: 0;
}

/* ===== Header / Hero ===== */
.hero {
  text-align: center;
  margin-bottom: 56px;
}

.logo-wrap {
  margin-bottom: 20px;
}

.logo-link {
  display: inline-block;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.15s;
}

.logo-link:hover {
  opacity: 0.85;
  transform: scale(1.05);
}

.logo-link:focus-visible {
  outline: 2px solid rgba(144, 184, 240, 0.6);
  outline-offset: 4px;
  border-radius: 12px;
}

.logo-svg {
  width: 48px;
  height: 48px;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 12px;
}

.hero .tagline {
  font-size: 1rem;
  color: #7a8fa8;
  letter-spacing: 0.08em;
}

.hero .tagline span {
  margin: 0 8px;
  color: #4a6080;
}

/* ===== Server Selection Screen ===== */
#server-select {
  width: 100%;
}

.server-select-title {
  text-align: center;
  font-size: 0.85rem;
  color: #4a6080;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 28px;
}

.server-group-label {
  font-size: 0.78rem;
  color: #5a7090;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 14px;
}

.server-group-label:not(:first-of-type) {
  margin-top: 32px;
}

.server-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  width: 100%;
}

@media (max-width: 560px) {
  .server-grid { grid-template-columns: 1fr; }
}

.server-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 20px;
  padding: 44px 32px 36px;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  user-select: none;
}

.server-card:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.15);
  transform: translateY(-3px);
}

.server-card:active {
  transform: translateY(0px);
}

.server-icon {
  font-size: 3rem;
  line-height: 1;
  filter: grayscale(0.2);
}

.server-card h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.server-card .server-desc {
  font-size: 0.88rem;
  color: #6b82a0;
}

.server-badge {
  display: inline-block;
  background: rgba(100, 160, 255, 0.18);
  color: #90b8f0;
  border-radius: 999px;
  padding: 5px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border: 1px solid rgba(100,160,255,0.25);
}

.server-badge--alt {
  background: rgba(100, 160, 255, 0.18);
  color: #90b8f0;
  border-color: rgba(100,160,255,0.25);
}

/* ===== Guide Screen ===== */
#guide-screen {
  width: 100%;
  display: none;
}

#guide-screen.visible {
  display: block;
}

/* Back button + status */
.guide-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 12px;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #a0b4cc;
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-back:hover {
  background: rgba(255,255,255,0.1);
  color: #ffffff;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(0,200,100,0.12);
  border: 1px solid rgba(0,200,100,0.25);
  color: #4dd99a;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Guide header */
.guide-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}

.guide-server-icon {
  font-size: 2.2rem;
}

.guide-header h2 {
  font-size: 1.8rem;
  font-weight: 700;
  color: #ffffff;
}

.guide-header .guide-badge {
  display: inline-block;
  background: rgba(100,160,255,0.18);
  color: #90b8f0;
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid rgba(100,160,255,0.25);
  margin-top: 4px;
}

.guide-header .guide-badge.premium {
  background: rgba(100,160,255,0.18);
  color: #90b8f0;
  border-color: rgba(100,160,255,0.25);
}

.guide-subtitle {
  font-size: 0.9rem;
  color: #5a7090;
  margin-bottom: 24px;
  margin-inline-start: 76px;
}

.guide-subtitle .value-text--hosts {
  justify-content: flex-start;
}

.user-portal-box {
  margin-bottom: 28px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.tab-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: #7090b0;
  padding: 8px 20px;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tab-btn:hover {
  background: rgba(255,255,255,0.09);
  color: #c0d4e8;
}

.tab-btn.active {
  background: rgba(100,160,255,0.2);
  border-color: rgba(100,160,255,0.4);
  color: #90c0ff;
}

/* Config box */
.config-box {
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 24px;
}

.config-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  gap: 16px;
  flex-wrap: wrap;
}

.config-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.config-row:first-child {
  padding-top: 0;
}

.config-label {
  font-size: 0.8rem;
  color: #4a6080;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  min-width: 120px;
  padding-top: 2px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.config-value {
  font-size: 0.95rem;
  color: #d0e4f8;
  font-family: 'Courier New', Courier, monospace;
  text-align: end;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.config-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.copy-btn,
.show-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  color: #7090b0;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

.show-btn:hover {
  background: rgba(255,255,255,0.12);
  color: #c0d4e8;
}

.copy-btn:hover {
  background: rgba(255,255,255,0.12);
  color: #c0d4e8;
}

.copy-btn.copied {
  color: #4dd99a;
  border-color: rgba(0,200,100,0.3);
}

/* Steps */
.steps-section {
  margin-top: 28px;
}

.steps-section h3 {
  font-size: 0.85rem;
  color: #4a6080;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  margin-bottom: 16px;
}

.step {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  align-items: flex-start;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(100,160,255,0.15);
  border: 1px solid rgba(100,160,255,0.3);
  color: #80b0f0;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.step-text {
  font-size: 0.92rem;
  color: #8aa8c8;
  line-height: 1.6;
}

.step-text strong {
  color: #c8ddf0;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #90b8f0;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin: 20px 0 8px;
  padding-top: 4px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.section-heading:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.dl-link {
  color: #90b8f0;
  text-decoration: none;
  word-break: break-all;
}

.dl-link:hover {
  text-decoration: underline;
  color: #b0d0ff;
}

.dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(100,160,255,0.15);
  border: 1px solid rgba(100,160,255,0.35);
  color: #90c0ff;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  text-decoration: none;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.dl-btn:hover {
  background: rgba(100,160,255,0.25);
  color: #b0d8ff;
  border-color: rgba(100,160,255,0.5);
}

.value-text {
  word-break: normal;
  overflow-wrap: anywhere;
  line-height: 1.5;
  min-width: 0;
}

.value-text--url {
  font-family: 'Courier New', Courier, monospace;
}

.value-text--hosts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.host-chip {
  display: inline-block;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.88rem;
  white-space: nowrap;
}

.secret-value {
  min-width: 0;
  flex: 1 1 auto;
}

.masked-value {
  letter-spacing: 0.15em;
  color: #5a7090;
  user-select: none;
}

.revealed-value {
  color: #d0e4f8;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.walkthrough-section {
  margin-top: 28px;
  padding: 24px;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
}

.walkthrough-heading {
  font-size: 0.85rem;
  color: #90b8f0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  margin-bottom: 16px;
  text-align: center;
}

.os-tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.os-tab-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: #7090b0;
  padding: 7px 18px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

.os-tab-btn:hover {
  background: rgba(255,255,255,0.09);
  color: #c0d4e8;
}

.os-tab-btn.active {
  background: rgba(100,160,255,0.2);
  border-color: rgba(100,160,255,0.4);
  color: #90c0ff;
}

.os-panel {
  animation: fadeIn 0.2s ease;
}

.os-panel .video-wrap {
  margin-top: 24px;
}

.step-note .step-num {
  background: rgba(255,200,80,0.12);
  border-color: rgba(255,200,80,0.3);
  color: #e0c060;
  font-size: 1rem;
}

.step-note .step-text {
  color: #9ab0c8;
  font-size: 0.88rem;
}

.video-wrap {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  line-height: 0;
  background: #060d1a;
}

.video-preview {
  position: relative;
  width: 100%;
}

.guide-video-thumb {
  width: 100%;
  height: auto;
  display: block;
  vertical-align: top;
  pointer-events: none;
  background: #060d1a;
}

.video-poster {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(10,18,32,0.15) 0%, rgba(10,18,32,0.55) 100%);
  cursor: pointer;
  z-index: 1;
}

.video-play-btn {
  background: rgba(0,0,0,0.45);
  border: 2px solid rgba(255,255,255,0.25);
  border-radius: 50%;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #ffffff;
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
  padding: 0;
}

.video-play-btn:hover {
  transform: scale(1.08);
  background: rgba(100,160,255,0.35);
  border-color: rgba(144,192,255,0.5);
}

.play-icon {
  width: 64px;
  height: 64px;
}

.guide-video-main {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: top;
  background: #060d1a;
}

/* Footer */
.footer {
  margin-top: 72px;
  text-align: center;
  font-size: 0.8rem;
  color: #2a3a50;
}

/* Transition */
.fade-in {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Icons ===== */
.icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.75;
}

.config-label .icon {
  width: 13px;
  height: 13px;
  opacity: 0.55;
}

.section-heading .icon {
  opacity: 0.7;
}

.dl-btn .icon,
.copy-btn .icon,
.show-btn .icon {
  opacity: 0.9;
}

@media (max-width: 640px) {
  .page {
    padding: 48px 16px 64px;
  }

  .lang-switcher {
    top: 16px;
    inset-inline-end: 16px;
  }

  .guide-subtitle {
    margin-inline-start: 0;
    margin-bottom: 20px;
  }

  .guide-subtitle .value-text--hosts {
    justify-content: flex-start;
  }

  .config-box {
    padding: 20px 16px;
  }

  .config-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .config-label {
    min-width: 0;
  }

  .config-value {
    text-align: start;
    justify-content: flex-start;
    flex-direction: column;
    align-items: stretch;
  }

  .value-text--hosts {
    justify-content: flex-start;
  }

  .config-actions {
    align-self: flex-start;
    flex-wrap: wrap;
  }

  .host-chip {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .dl-btn {
    align-self: flex-start;
  }

  .tab-btn {
    padding: 8px 14px;
    font-size: 0.82rem;
  }
}

/* ===== Server Password Gate ===== */
.server-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(6, 13, 26, 0.82);
  backdrop-filter: blur(6px);
}

.server-gate[hidden] {
  display: none !important;
}

.server-gate-dialog {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 32px 28px 28px;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
}

.server-gate-icon {
  font-size: 2.6rem;
  line-height: 1;
  margin-bottom: 12px;
}

.server-gate-dialog h2 {
  font-size: 1.45rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 8px;
}

.server-gate-subtitle {
  font-size: 0.92rem;
  color: #6b82a0;
  line-height: 1.5;
  margin-bottom: 22px;
}

.server-gate-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.server-gate-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.25);
  color: #e2e8f0;
  font-size: 0.95rem;
}

.server-gate-input:focus {
  outline: none;
  border-color: rgba(100, 160, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(100, 160, 255, 0.15);
}

.server-gate-error {
  font-size: 0.85rem;
  color: #f08a8a;
  text-align: start;
}

.server-gate-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 4px;
}

.gate-cancel-btn,
.gate-submit-btn {
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.gate-cancel-btn {
  background: rgba(255, 255, 255, 0.06);
  color: #90a8c0;
}

.gate-cancel-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.gate-submit-btn {
  background: rgba(100, 160, 255, 0.22);
  color: #c8ddf0;
  border: 1px solid rgba(100, 160, 255, 0.35);
}

.gate-submit-btn:hover {
  background: rgba(100, 160, 255, 0.32);
}
