:root {
  --bg: #060a12;
  --bg-2: #0b1220;
  --panel: #0f172a;
  --panel-soft: #111d37;
  --line: #233354;
  --line-strong: #2f4a7e;
  --text: #e6f2ff;
  --muted: #94a9d6;
  --accent: #38bdf8;
  --accent-2: #8b5cf6;
  --accent-3: #22d3ee;
  --good: #22c55e;
  --bad: #fb7185;
  --warn: #f59e0b;
  --terminal: "Cascadia Code", "Consolas", "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  position: relative;
  background:
    radial-gradient(circle at 12% 20%, rgba(56, 189, 248, 0.18), transparent 32%),
    radial-gradient(circle at 82% 0%, rgba(139, 92, 246, 0.2), transparent 30%),
    radial-gradient(circle at 50% 120%, rgba(34, 211, 238, 0.06), transparent 38%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(115, 151, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(115, 151, 255, 0.05) 1px, transparent 1px);
  background-size: 26px 26px;
  pointer-events: none;
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.04), transparent 12%);
  mix-blend-mode: soft-light;
  pointer-events: none;
  z-index: -1;
}

.hero {
  position: relative;
  padding: max(3rem, env(safe-area-inset-top)) max(1.4rem, env(safe-area-inset-right)) 2.6rem max(1.4rem, env(safe-area-inset-left));
  border-bottom: 1px solid rgba(56, 189, 248, 0.18);
  overflow: hidden;
}

.overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, rgba(56, 189, 248, 0.18), rgba(139, 92, 246, 0.08)),
    repeating-linear-gradient(
      160deg,
      transparent 0 18px,
      rgba(255, 255, 255, 0.02) 18px 20px
    );
  pointer-events: none;
}

.hero-content {
  position: relative;
  max-width: 1080px;
  margin: 0 auto;
}

.hero h1 {
  margin: 0 0 0.3rem;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: 0.4px;
  text-shadow: 0 0 24px rgba(56, 189, 248, 0.35);
}

.hero-meta {
  margin: 0.8rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.meta-pill {
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.09);
  color: #bce9ff;
  border-radius: 999px;
  padding: 0.24rem 0.7rem;
  font-size: 0.76rem;
  font-family: var(--terminal);
  text-transform: lowercase;
}

.hero p {
  margin: 0;
  max-width: 840px;
  color: var(--muted);
  line-height: 1.5;
}

.layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.2rem max(1.2rem, env(safe-area-inset-left)) max(1.2rem, env(safe-area-inset-bottom)) max(1.2rem, env(safe-area-inset-right));
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 1rem;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(9, 15, 30, 0.98)),
    radial-gradient(circle at 100% 0%, rgba(56, 189, 248, 0.08), transparent 30%);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.28);
}

.roles-panel {
  padding: 1rem;
}

.roles-panel h2 {
  margin: 0 0 0.4rem;
}

.helper {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.content-panel {
  padding: 1rem;
}

.role-list {
  display: grid;
  gap: 0.7rem;
  margin-bottom: 1rem;
}

.role-card {
  width: 100%;
  text-align: left;
  padding: 0.8rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.role-card.active {
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35), 0 6px 22px rgba(56, 189, 248, 0.14);
}

.role-card h3 {
  margin: 0 0 0.45rem;
  font-size: 1rem;
}

.role-card p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.role-level-summary {
  border-top: 1px solid rgba(56, 189, 248, 0.22);
  padding-top: 0.95rem;
}

.role-level-summary h3 {
  margin: 0 0 0.75rem;
  font-size: 0.98rem;
}

.role-level-list {
  display: grid;
  gap: 0.6rem;
}

.role-level-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem;
  background: rgba(11, 20, 42, 0.78);
}

.role-level-item h4 {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
}

.role-level-main {
  margin: 0;
  color: #bce9ff;
  font-weight: 700;
}

.role-level-sub {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.role-progress {
  margin-top: 0.45rem;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 169, 214, 0.2);
  border: 1px solid rgba(56, 189, 248, 0.2);
  overflow: hidden;
}

.role-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #22d3ee, #38bdf8, #8b5cf6);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.35);
  transition: width 0.3s ease;
}

.state {
  padding: 1.4rem;
  border-radius: 10px;
  background: rgba(96, 165, 250, 0.08);
  color: var(--muted);
}

.role-header h2 {
  margin: 0;
}

.role-header p {
  margin: 0.3rem 0 1.1rem;
  color: var(--muted);
}

.test-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.9rem;
}

.test-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem;
  background: linear-gradient(180deg, rgba(11, 20, 42, 0.92), rgba(10, 17, 33, 0.92));
  position: relative;
}

.test-card::before {
  content: "</>";
  position: absolute;
  top: 0.56rem;
  right: 0.7rem;
  font-family: var(--terminal);
  font-size: 0.76rem;
  color: rgba(56, 189, 248, 0.45);
}

.test-card h3 {
  margin: 0;
  font-size: 1rem;
}

.badge-row {
  display: flex;
  gap: 0.5rem;
  margin: 0.55rem 0;
  flex-wrap: wrap;
}

.badge {
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.78rem;
  color: var(--text);
  font-family: var(--terminal);
}

.badge.level {
  border-color: rgba(167, 139, 250, 0.5);
  color: #d8cbff;
}

.badge.score {
  border-color: rgba(52, 211, 153, 0.5);
  color: #b7f7df;
}

.test-card p {
  margin: 0.3rem 0 0.8rem;
  color: var(--muted);
  font-size: 0.88rem;
}

button.primary,
button.secondary {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.85rem;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

button.primary {
  background: linear-gradient(135deg, #0ea5e9, #8b5cf6);
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 22px rgba(56, 189, 248, 0.25);
}

button.secondary {
  background: rgba(17, 26, 47, 0.84);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.test-header h2,
.result h2 {
  margin: 0;
}

.test-header p,
.result p {
  margin: 0.5rem 0 0.9rem;
  color: var(--muted);
}

.progress {
  margin-bottom: 0.9rem;
  font-size: 0.88rem;
  color: #88a8dc;
  font-family: var(--terminal);
  letter-spacing: 0.25px;
}

.question {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem;
  background:
    linear-gradient(180deg, rgba(16, 28, 54, 0.9), rgba(9, 17, 33, 0.92)),
    radial-gradient(circle at 0% 0%, rgba(56, 189, 248, 0.06), transparent 40%);
}

.question h3 {
  margin: 0 0 0.25rem;
}

.question p {
  margin: 0.5rem 0 0.9rem;
}

.options {
  display: grid;
  gap: 0.45rem;
}

.option-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.45rem 0.5rem;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: rgba(8, 13, 24, 0.42);
}

.option-item:hover {
  border-color: rgba(56, 189, 248, 0.44);
  background: rgba(13, 22, 40, 0.85);
}

.nav-row {
  margin-top: 0.9rem;
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.result-box {
  margin: 0.9rem 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem;
  background:
    linear-gradient(180deg, rgba(11, 20, 42, 0.92), rgba(8, 16, 30, 0.94));
}

.result-box strong {
  color: #cde0ff;
}

.review-list {
  display: grid;
  gap: 0.8rem;
}

.review-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem;
  background: rgba(15, 25, 48, 0.85);
}

.review-card.good {
  border-color: rgba(52, 211, 153, 0.5);
}

.review-card.bad {
  border-color: rgba(251, 113, 133, 0.7);
  box-shadow: inset 0 0 0 1px rgba(251, 113, 133, 0.15);
}

.review-card h4 {
  margin: 0 0 0.35rem;
}

.review-card p {
  margin: 0.3rem 0;
  color: var(--muted);
}

.review-card ul {
  margin: 0.25rem 0 0.5rem 1rem;
}

.review-card a {
  color: #7dd3fc;
  overflow-wrap: anywhere;
}

button:focus-visible,
.role-card:focus-visible,
.option-item:focus-within,
a:focus-visible {
  outline: 3px solid var(--accent-3);
  outline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
  .role-card:hover,
  button.primary:hover,
  button.secondary:hover {
    transform: translateY(-1px);
  }

  .role-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35), 0 6px 22px rgba(56, 189, 248, 0.14);
  }

  button.primary:hover {
    box-shadow: 0 0 26px rgba(56, 189, 248, 0.35);
  }
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .hero {
    padding: max(1.4rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) 1.25rem max(1rem, env(safe-area-inset-left));
  }

  .hero h1 {
    font-size: clamp(1.8rem, 9vw, 2.35rem);
  }

  .hero-meta {
    gap: 0.4rem;
    margin: 0.65rem 0;
  }

  .meta-pill {
    padding: 0.28rem 0.55rem;
    font-size: 0.7rem;
  }

  .hero p {
    font-size: 0.95rem;
  }

  .layout {
    padding: 0.75rem max(0.75rem, env(safe-area-inset-left)) max(1rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-right));
    gap: 0.75rem;
  }

  .panel {
    border-radius: 12px;
  }

  .roles-panel,
  .content-panel {
    padding: 0.8rem;
  }

  .role-list {
    gap: 0.5rem;
  }

  .role-card {
    padding: 0.7rem;
  }

  .test-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.65rem;
  }

  .test-card {
    padding: 0.8rem;
  }

  .test-card > button {
    width: 100%;
  }

  .test-header p {
    line-height: 1.55;
    overflow-wrap: anywhere;
  }

  .question {
    padding: 0.75rem;
  }

  .question h3,
  .role-header h2,
  .test-header h2,
  .result h2 {
    overflow-wrap: anywhere;
  }

  .option-item {
    align-items: center;
    padding: 0.65rem;
    line-height: 1.4;
  }

  .option-item input {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    margin: 0.1rem 0.15rem 0 0;
    accent-color: var(--accent);
  }

  .nav-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .nav-row button {
    width: 100%;
    padding: 0.6rem 0.45rem;
  }

  #backToRole {
    grid-column: 1 / -1;
  }

  .result-box,
  .review-card {
    padding: 0.75rem;
  }

  .badge-row {
    gap: 0.4rem;
  }

  .badge {
    overflow-wrap: anywhere;
    font-size: 0.72rem;
  }
}

@media (max-width: 360px) {
  .meta-pill {
    font-size: 0.66rem;
  }

  .nav-row {
    grid-template-columns: minmax(0, 1fr);
  }

  #backToRole {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
