  :root {
    --panel:     #23133a;
    --border:    #3a1c63;
    --accent:    #883CF0;
    --accent2:   #7c5cfc;
    --accent3:   #b33ff3;
    --warn:      #ffb84d;
    --danger:    #ff4f6e;
    --text:      #e0e6f0;
    --muted:     #d6d6d6;
    --code-bg:   #0f0818;
  }

  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  html { scroll-behavior: smooth; }

  .msa-training-guide {
    background: #191127;
    color: var(--text);
    position: relative;
    font-weight: 300;
    min-height: 100vh;
    overflow-x: hidden;
    height: 100vh;
    overflow-y: auto;
  }

  .msa-training-guide::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
      linear-gradient(rgba(0,212,255,.025) 1px, transparent 1px),
      linear-gradient(90deg, rgba(0,212,255,.025) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
    z-index: 0;
  }

  .msa-training-guide header {
    position: relative; z-index: 1;
    border-bottom: 1px solid var(--border);
    background: #180f26;
    backdrop-filter: blur(12px);
    padding: 0 2rem;
  }

  .header-inner {
    max-width: 1200px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    gap: 1.5rem; padding: 1.2rem 0; flex-wrap: wrap;
  }

  .brand { display: flex; align-items: center; gap: .75rem; }

  .brand-icon {
    width: 40px; height: 40px; flex-shrink: 0;
    background: linear-gradient(135deg, #3a1c63, #684895);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.15rem;
  }

  .brand-text strong { font-size: .95rem; font-weight: 700; display: block; }
  .brand-text span {
    font-size: .7rem; color: var(--muted);
    
    text-transform: uppercase; 
  }

  .badge-row { display: flex; gap: .45rem; flex-wrap: wrap; }
  .badge {
    font-size: .67rem; 
    text-transform: uppercase; 
    padding: .22rem .55rem; border-radius: 4px; border: 1px solid;
  }
  .badge-blue   { border-color: var(--accent);  color: var(--accent);  background: #3a1c63; }
  .badge-purple { border-color: var(--accent2); color: var(--accent2); background: rgba(124,92,252,.07); }
  .badge-green  { border-color: var(--accent3); color: var(--accent3); background: #1f1232; }

  .hero {
    position: relative; z-index: 1;
    padding: 4rem 2rem 3rem; text-align: center; overflow: hidden;
  }

  .hero::after {
    content: '';
    position: absolute; top: -80px; left: 50%; transform: translateX(-50%);
    width: 700px; height: 350px;
    background: radial-gradient(ellipse, rgba(124,92,252,.15) 0%, transparent 70%);
    pointer-events: none;
  }

  .hero-eyebrow {
     font-size: .73rem;
    text-transform: uppercase; 
    color: var(--accent); margin-bottom: 1rem;
  }

  .hero h1 {
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 700; line-height: 1.12;  margin-bottom: 1.2rem;
  }
  .hero h1 span { color: var(--accent); }

  .hero-sub {
    max-width: 620px; margin: 0 auto 2rem;
    font-size: 1rem; line-height: 1.7; color: #d8dbe1;
  }

  .progress-bar-wrap {
    max-width: 460px; margin: 0 auto;
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 99px; padding: .3rem .45rem;
    display: flex; align-items: center; gap: .7rem;
  }
  .progress-bar-wrap span {
     font-size: .68rem;
    color: var(--muted); white-space: nowrap;
  }
  .progress-track {
    flex: 1; height: 6px; background: #282035;
    border-radius: 99px; overflow: hidden;
  }
  .progress-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--accent2), var(--accent));
    border-radius: 99px; transition: width .5s ease;
  }

  .tab-nav {
    position: sticky; top: 0; z-index: 1;
    background: #180f26; backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border); padding: 0 2rem;
  }
  .tab-nav-inner {
    max-width: 1200px; margin: 0 auto;
    display: flex; overflow-x: auto; scrollbar-width: none;
  }
  .tab-nav-inner::-webkit-scrollbar { display: none; }

  .tab-btn {
    flex-shrink: 0; background: none; border: none;
    padding: .95rem 1.3rem; color: var(--muted);
     font-size: .85rem;
    cursor: pointer; position: relative;
    transition: color .2s;
    display: flex; align-items: center; gap: .4rem; white-space: nowrap;
  }
  .tab-btn::after {
    content: ''; position: absolute;
    bottom: 0; left: 0; right: 0; height: 2px;
    background: var(--accent); transform: scaleX(0); transition: transform .2s;
  }
  .tab-btn.active { color: var(--text); }
  .tab-btn.active::after { transform: scaleX(1); }
  .tab-btn:hover { color: var(--text); }
  .tab-num {
     font-size: .67rem;
    background: var(--border); padding: .1rem .38rem; border-radius: 3px;
  }
  .tab-btn.active .tab-num { background: #291a3e; color: var(--accent); }

  .content {
    max-width: 1200px; margin: 0 auto;
    padding: 2.5rem 2rem 5rem; position: relative;
  }

  .tab-panel { display: none; }
  .tab-panel.active { display: block; animation: fadeUp .3s ease; }
  @keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .section-header {
    display: flex; align-items: flex-start; gap: 1.2rem;
    margin-bottom: 2rem; padding-bottom: 1.4rem;
    border-bottom: 1px solid var(--border);
  }
  .section-icon {
    width: 50px; height: 50px; flex-shrink: 0; border-radius: 11px;
    display: flex; align-items: center; justify-content: center; font-size: 1.4rem;
  }
  .section-icon.blue   { background: #1f1232;  border: 1px solid #3a1c63; }
  .section-icon.purple { background: rgba(124,92,252,.1); border: 1px solid rgba(124,92,252,.2); }
  .section-icon.green  { background: rgba(0,229,160,.1);  border: 1px solid rgba(0,229,160,.2); }
  .section-icon.warn   { background: rgba(255,184,77,.1); border: 1px solid rgba(255,184,77,.2); }
  .section-meta h2 { font-size: 1.45rem; font-weight: 700;  margin-bottom: .3rem; }
  .section-meta p  { color: var(--muted); font-size: .875rem; line-height: 1.5; }

  .cards { display: grid; gap: 1rem; margin-bottom: 1.5rem; }
  .cards-2 { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
  .cards-3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

  .card {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 12px; padding: 1.35rem;
    transition: border-color .2s, transform .2s;
  }
  .card:hover { border-color: #5e309d; transform: translateY(-2px); }
  .card-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .85rem; }
  .card-icon { font-size: 1.15rem; }
  .card h3 { font-size: .925rem; font-weight: 600; }
  .card p { font-size: .865rem; line-height: 1.65; color: #d6dae1; }
  .card ul { list-style: none; display: flex; flex-direction: column; gap: .38rem; }
  .card ul li {
    font-size: .845rem; color: #8494b0;
    padding-left: 1.2rem; position: relative; line-height: 1.5;
  }
  .card ul li::before { content: '→'; position: absolute; left: 0; color: var(--accent); font-size: .75rem; }

  .callout {
    border-radius: 10px; padding: 1rem 1.25rem; margin-bottom: 1.2rem;
    display: flex; gap: .85rem; align-items: flex-start;
  }
  .callout-icon { font-size: 1.05rem; flex-shrink: 0; margin-top: .05rem; }
  .callout p { font-size: .865rem; line-height: 1.65; }
  .callout p strong { font-weight: 600; display: block; margin-bottom: .2rem; }
  .callout.info   { background: #1f1232;  border: 1px solid #3a1c63; }
  .callout.good   { background: #1f1232;  border: 1px solid #3a1c63; }
  .callout.warn   { background: rgba(255,184,77,.06); border: 1px solid rgba(255,184,77,.17); }
  .callout.tip    { background: rgba(124,92,252,.06); border: 1px solid rgba(124,92,252,.17); }

  .code-block {
    background: var(--code-bg); border: 1px solid var(--border);
    border-radius: 10px; margin-bottom: 1.2rem; overflow: hidden;
  }
  .code-header {
    background: rgba(255,255,255,.03); border-bottom: 1px solid var(--border);
    padding: .55rem 1rem;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  }
  .code-lang {
     font-size: .68rem;
    text-transform: uppercase;  color: var(--accent);
  }
  .copy-btn {
    background: var(--border); border: none; border-radius: 4px;
    color: var(--muted); 
    font-size: .67rem; padding: .22rem .55rem; cursor: pointer;
    transition: background .2s, color .2s;
  }
  .copy-btn:hover { background: var(--accent2); color: #fff; }
  .copy-btn.copied { background: var(--accent3); color: #000; }

  pre {
    padding: 1.15rem 1.2rem; overflow-x: auto;
    
    font-size: .81rem; line-height: 1.8; color: #c9d8f0;
  }
  .kw  { color: #7c9eff; }
  .fn  { color: var(--accent); }
  .str { color: var(--accent3); }
  .cm  { color: #4a5578; font-style: italic; }
  .var { color: var(--warn); }
  .flag{ color: #ff8fa3; }

  .table-wrap {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 12px; overflow: hidden; margin-bottom: 1.5rem;
  }
  .comparison-table { width: 100%; border-collapse: collapse; font-size: .865rem; }
  .comparison-table th {
    background: #23133a; padding: .75rem 1rem; text-align: left;
    font-weight: 600; font-size: .76rem; text-transform: uppercase;
     color: var(--muted); border-bottom: 2px solid var(--border);
  }
  .comparison-table td {
    padding: .82rem 1rem; border-bottom: 1px solid #5e309d;
    vertical-align: top; line-height: 1.5; color: #e7e9ed;
  }
  .comparison-table tr:last-child td { border-bottom: none; }
  .comparison-table tr:hover td { background: #1f1232; }
  .comparison-table td:first-child { color: var(--text); font-weight: 500; }
  .yes { color: var(--accent3); font-weight: 600; }
  .no  { color: var(--danger);  font-weight: 600; }
  .na  { color: var(--muted); }

  .steps { display: flex; flex-direction: column; gap: .7rem; margin-bottom: 1.5rem; }
  .step {
    display: flex; gap: .95rem; align-items: flex-start;
    padding: 1.05rem 1.2rem;
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 10px; cursor: pointer; transition: border-color .2s;
  }
  .step:hover { border-color: #23133a9f; }
  .step-num {
    width: 27px; height: 27px; flex-shrink: 0; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent2), var(--accent));
    display: flex; align-items: center; justify-content: center;
     font-size: .73rem; font-weight: 600; color: #fff;
  }
  .step-body h4 { font-size: .905rem; font-weight: 600; margin-bottom: .22rem; }
  .step-body p  { font-size: .845rem; color: var(--muted); line-height: 1.55; }
  .step-detail {
    display: none; margin-top: .7rem; padding-top: .7rem;
    border-top: 1px solid var(--border);
  }
  .step.expanded .step-detail { display: block; }

  .reason-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
    gap: 1rem; margin-bottom: 1.5rem;
  }
  .reason-card {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 12px; padding: 1.35rem;
    position: relative; overflow: hidden; transition: transform .2s;
  }
  .reason-card::before {
    content: ''; position: absolute;
    top: 0; left: 0; right: 0; height: 3px;
  }
  .rc-blue::before   { background: linear-gradient(90deg, var(--accent), var(--accent2)); }
  .rc-green::before  { background: linear-gradient(90deg, var(--accent3), var(--accent)); }
  .rc-purple::before { background: linear-gradient(90deg, var(--accent2), #ff6bcd); }
  .rc-warn::before   { background: linear-gradient(90deg, var(--warn), var(--danger)); }
  .reason-card:hover { transform: translateY(-3px); }
  .reason-num {
     font-size: 2.2rem;
    font-weight: 600; color: rgba(255,255,255,.06); line-height: 1; margin-bottom: .4rem;
  }
  .reason-card h3 { font-size: .925rem; font-weight: 600; margin-bottom: .45rem; }
  .reason-card p  { font-size: .845rem; color: var(--muted); line-height: 1.65; }

  .divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
    margin: 2rem 0;
  }

  .quiz-q {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 12px; padding: 1.45rem; margin-bottom: 1.2rem;
  }
  .quiz-q h3 { font-size: .975rem; font-weight: 600; margin-bottom: .95rem; line-height: 1.5; }
  .quiz-q h3 span {
     font-size: .72rem;
    background: #1f1232; color: var(--accent);
    padding: .1rem .42rem; border-radius: 4px; margin-right: .45rem;
  }
  .quiz-options { display: flex; flex-direction: column; gap: .48rem; }
  .quiz-option {
    display: flex; align-items: center; gap: .7rem;
    padding: .72rem 1rem;
    background: #1f1232; border: 1px solid var(--border);
    border-radius: 8px; cursor: pointer;
    transition: border-color .15s, background .15s; font-size: .865rem;
  }
  .quiz-option:hover { border-color: var(--accent2); background: #2a1647; }
  .quiz-option input[type=radio] { accent-color: var(--accent2); flex-shrink: 0; }
  .quiz-option.correct { border-color: #77b255;
    background: #77b25520;
    color: #60c090; }
  .quiz-option.wrong   { border-color: #dc143c;
    background: #dc143c2b;
    color:#ff7a90;}
  .quiz-feedback {
    margin-top: .7rem; padding: .65rem 1rem; border-radius: 8px;
    font-size: .845rem; display: none;
  }
  .quiz-feedback.show { display: block; }
  .quiz-feedback.correct { background: #77b25520;
    border: 1px solid #77b255;
    color: #60c090; }
  .quiz-feedback.wrong   { background: #dc143c2b;
    border: 1px solid #dc143c;
    color: #ff7a90; }
  .quiz-submit {
    background: linear-gradient(135deg, var(--accent2), var(--accent));
    border: none; border-radius: 8px; color: #fff;
     font-weight: 600; font-size: .86rem;
    padding: .62rem 1.45rem; cursor: pointer; margin-top: .7rem; transition: opacity .2s;
  }
  .quiz-submit:hover { opacity: .85; }

  .score-display {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 12px; padding: 1.5rem;
    text-align: center; margin-top: 1.5rem;
  }
  .score-display h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: .45rem; }
  .score-display p  { color: var(--muted); font-size: .875rem; }

  @media (max-width: 640px) {
    .header-inner { flex-direction: column; align-items: flex-start; }
    .hero { padding: 2.5rem 1.25rem 2rem; }
    .content { padding: 1.5rem 1.25rem 3rem; }
    .cards-2, .cards-3, .reason-grid { grid-template-columns: 1fr; }
  }

  ::-webkit-scrollbar { width: 4px; }
  ::-webkit-scrollbar-track { background: #873cf015; }
  ::-webkit-scrollbar-thumb { background: #873cf015; border-radius: 4px; }