/* Variable Definitions & Reset */
:root {
  --bg-color: #0b0c0f;
  /* Deepest Cinematic Black */
  --card-bg: #151619;
  /* Dark Charcoal Card */
  --card-border: #2a2c33;
  /* Subtle Border */
  --text-primary: #ffffff;
  /* Pure White */
  --text-secondary: #a3a3a3;
  /* Light Gray */
  --accent-color: #3b82f6;
  /* Blue 500 (Preserved) */
  --accent-hover: #60a5fa;
  /* Blue 400 */
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  --transition-speed: 0.3s;
  /* Slightly smoother transition */
  --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 15px rgba(0, 0, 0, 0.5);
  /* Deeper shadows */
  --radius: 12px;
  /* More modern radius */
}

html {
  scroll-behavior: smooth;
  height: 100%;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.25;
}

p {
  color: var(--text-secondary);
}

a {
  text-decoration: none;
  color: inherit;
  transition: color var(--transition-speed);
}

/* Layout Utilities */
.container {
  max-width: 1000px;
  /* Readability focus */
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
}

.hero {
  text-align: center;
  padding: 3rem 0;
  animation: fadeIn 0.4s ease-out;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--text-primary);
}

.hero h1 i {
  color: var(--accent-color);
}

.sub-title {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

.grid-title {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 2rem 0 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
}

/* Device Grid */
.device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem;
  padding-bottom: 3rem;
}

.device-card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  transition: all var(--transition-speed);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.device-card:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: var(--accent-color);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
}



.device-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: var(--text-secondary);
  transition: color var(--transition-speed);
}

.device-icon svg {
  width: 1em;
  height: 1em;
  fill: currentColor;
}

.device-icon .roku-svg {
  width: auto;
  height: 0.8em;
}

.device-card:hover .device-icon {
  color: var(--accent-color);
}

.device-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* App Selection Grid (Landing) */
.app-selection-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin: 2rem auto;
  max-width: 800px;
}

.app-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 2.5rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-speed);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-shadow: var(--shadow-sm);
  min-height: 200px;
}

.app-card:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: var(--accent-color);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
}

.app-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  color: var(--accent-color);
}

.guide-header svg {
  width: 1em;
  height: 1em;
  fill: currentColor;
}

.app-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.app-tag {
  font-size: 0.875rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  background: var(--card-bg);
  color: var(--text-secondary);
  font-weight: 500;
}

/* Guide Section */
.guide-header {
  text-align: center;
  margin-bottom: 3rem;
}

.guide-header i {
  font-size: 4rem;
  color: var(--accent-color);
  display: block;
  margin-bottom: 1rem;
}

.guide-header h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.guide-header .sub-header {
  font-size: 1.125rem;
  color: var(--text-secondary);
}

/* Steps */
.step-card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 1.5rem;
  display: grid;
  grid-template-columns: 50px 1fr;
  grid-template-areas:
    "number title"
    "number desc"
    "number map"
    "video video";
  gap: 0 1.5rem;
  box-shadow: var(--shadow-sm);
}

.step-card:hover {
  box-shadow: var(--shadow-md);
}

.step-number {
  grid-area: number;
  width: 40px;
  height: 40px;
  background-color: var(--accent-color);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
  margin-top: 0.25rem;
}

.step-title {
  grid-area: title;
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  align-self: center;
}

.step-desc {
  grid-area: desc;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.breadcrumb-map {
  grid-area: map;
  font-size: 0.875rem;
  color: var(--text-secondary);
  background: var(--card-bg);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-family: monospace;
}

.breadcrumb-map i {
  color: var(--text-secondary);
  font-size: 0.75rem;
}

/* Details & Info */
.details-list {
  margin-top: 1rem;
  display: grid;
  gap: 0.75rem;
}

.detail-item {
  background: rgba(255, 255, 255, 0.03);
  padding: 1rem;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
}

.detail-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.detail-value {
  font-family: monospace;
  font-size: 1.125rem;
  color: var(--text-primary);
  font-weight: 500;
}

/* Disclaimer / Warning */
.ibo-disclaimer {
  margin-top: 3rem;
  padding: 1.5rem;
  background-color: rgba(245, 158, 11, 0.1);
  /* Dark transparent yellow */
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius);
  color: var(--text-secondary);
}

.ibo-disclaimer h3 {
  color: var(--warning-color);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

/* Back Link */
.back-link {
  display: inline-flex;
  align-items: center;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  margin-bottom: 2rem;
  transition: all var(--transition-speed);
  background: var(--card-bg);
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  border: 1px solid var(--card-border);
}

.back-link:hover {
  color: var(--text-primary);
  border-color: var(--accent-color);
  transform: translateX(-4px);
}

/* Footer */
footer {
  margin-top: auto;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  border-top: 1px solid var(--card-border);
}

/* Image Container */
.activation-image-container {
  grid-area: video;
  margin-top: 1.5rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--card-border);
}

/* Video Container (Responsive 16:9) */
.video-container {
  grid-area: video;
  margin-top: 1.5rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--card-border);
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.video-label {
  color: var(--accent-color);
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
  grid-area: video;
  /* Ensure it stays with video in grid areas if simple flow doesn't handle it, though mostly it's in flow */
}

/* Tip Box */
.tip-box {
  background: var(--card-bg);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border-left: 3px solid var(--accent-color);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.tip-box strong {
  color: var(--text-primary);
}

/* Highlights */
.highlight-var {
  color: var(--danger-color);
  font-weight: 600;
}

.highlight-success {
  color: var(--success-color);
  font-weight: 600;
}

.activation-image {
  width: 100%;
  height: auto;
  display: block;
}

/* Cleanup Utilities */
.video-section {
  grid-area: video;
  margin-top: 1rem;
}

.clean-list {
  list-style: none;
  padding: 0;
}

.list-icon {
  color: var(--accent-color);
  margin-right: 0.5rem;
}

.info-link-inline {
  color: var(--accent-color);
  font-size: 0.9rem;
  text-decoration: underline;
  display: inline-block;
  margin-top: 1rem;
}

.icon-windows {
  color: #0078D6;
}

.icon-apple {
  color: #333333;
}

.icon-linux {
  color: #FCC624;
}

.mt-3 {
  margin-top: 3rem;
}

.mb-2 {
  margin-bottom: 2rem;
}

.text-center {
  text-align: center;
}

/* Utilities */
.hidden {
  display: none !important;
}

.app-view {
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 2rem;
  }

  .grid-title {
    margin-top: 1rem;
  }

  .step-card {
    grid-template-columns: 1fr;
    grid-template-areas:
      "number"
      "title"
      "desc"
      "map"
      "video";
    gap: 0.5rem;
    padding: 1.5rem;
  }

  .step-number {
    margin-bottom: 0.5rem;
  }

  .app-selection-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

/* --- UI Standardization Components --- */

/* Warning Box */
.warning-box {
  background-color: rgba(59, 130, 246, 0.1);
  /* Dark transparent blue */
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-left: 4px solid var(--accent-color);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.warning-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--accent-color);
  margin-bottom: 0.75rem;
}

.warning-title i {
  color: var(--accent-color);
}

.warning-text {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

.warning-text strong {
  color: var(--text-primary);
}

/* Code Container & Copy Button */
.code-container {
  background-color: #525252;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border-color);
}

.code-display {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.05em;
}

.copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--text-secondary);
  transition: all 0.2s;
  position: relative;
  border-radius: 4px;
}

.copy-btn:hover {
  color: var(--accent-color);
  background-color: rgba(255, 255, 255, 0.1);
}

.copy-tooltip {
  position: absolute;
  top: -35px;
  right: 0;
  background: var(--text-primary);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  white-space: nowrap;
}

/* Highlight / Variablized Text */
.highlight-var {
  color: var(--danger-color);
  font-weight: 600;
  font-family: monospace;
}

.highlight-success {
  color: var(--success-color);
  font-weight: 600;
  font-family: monospace;
}

/* Info Content Box */
.info-content-box {
  background-color: rgba(59, 130, 246, 0.1);
  /* Dark transparent blue */
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

/* URL Visualizer */
.url-visualizer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-family: monospace;
  font-size: 0.9rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  word-break: break-all;
  line-height: 2.5;
  margin-top: 1rem;
}

.highlight-group {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
}

.highlight-box {
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-color);
  font-weight: 600;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.highlight-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 4px;
  font-family: var(--font-sans);
}

/* Hostname Grid */
.hostname-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.hostname-item {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 0.75rem;
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: monospace;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.hostname-copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--accent-color);
  margin-left: 0.5rem;
}

.vpn-btn {
  display: inline-block;
  background: #ef4444;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s;
}

.vpn-btn:hover {
  background: #dc2626;
}

.vpn-btn.is-outline {
  background: transparent;
  border: 1px solid var(--accent-color);
  color: var(--accent-color);
}

.vpn-btn.is-outline:hover {
  background: var(--accent-color);
  color: white;
}

/* M3U Generator Styles */
.generator-box {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 1rem;
  margin-bottom: 2rem;
}

.gen-group {
  margin-bottom: 1rem;
}

.gen-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.gen-input,
.gen-select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  transition: box-shadow 0.2s, border-color 0.2s;
}

.gen-input:focus,
.gen-select:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.gen-btn {
  background-color: var(--accent-color);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: 1rem;
  width: 100%;
  transition: background-color 0.2s;
}

.gen-btn:hover {
  background-color: var(--accent-hover);
}

.gen-result-box {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  display: none;
  /* Hidden by default */
}

.gen-result-box.active {
  display: block;
  animation: fadeIn 0.3s ease-out;
}