/*
 * Rules pages (content/rules/*.md). Everything is scoped under .rules, the wrapper the page
 * puts around the rendered Markdown, because the content uses short generic class names.
 */

.rules { max-width: 960px; margin: 0 auto; font-size: 15px; line-height: 1.7; }
.rules-head { padding: 56px 0 0; }
.rules-head .badge { margin-bottom: 20px; }
.rules-head h1 { font-size: clamp(34px, 6vw, 60px); }
.rules-head .subtitle { margin-top: 18px; max-width: 680px; font-size: 16px; }
.rules .c-accent { color: var(--accent); }
.rules .c-warn { color: var(--warn); }
.rules .c-danger { color: var(--danger); }

.rules h2 span { background: linear-gradient(135deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.rules .toc { margin: 32px 0 56px; padding-bottom: 44px; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 8px; }
.rules .toc a { font-family: var(--mono); font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 99px; padding: 5px 12px; transition: all .2s; }
.rules .toc a:hover { color: var(--accent); border-color: var(--accent); }
.rules section { margin-bottom: 72px; scroll-margin-top: 80px; }
.rules .section-label { font-family: var(--mono); font-size: 10px; color: var(--accent); letter-spacing: 0.2em; text-transform: uppercase; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.rules .section-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.rules h2 { font-family: var(--mono); font-size: clamp(20px, 3vw, 28px); font-weight: 700; margin-bottom: 24px; line-height: 1.25; }
.rules p { margin-bottom: 14px; color: var(--dim); }
.rules i.t { font-family: var(--mono); font-style: normal; font-size: 12px; color: var(--accent); opacity: .8; }
.rules .card { background: rgba(17,24,39,0.7); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); border: 1px solid var(--border); border-radius: 10px; padding: 22px 26px; margin-bottom: 16px; position: relative; overflow: hidden; }
.rules .card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.rules .card.purple::before { background: var(--accent2); }
.rules .card-title { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--accent); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 10px; }
.rules .card.purple .card-title { color: var(--violet); }
.rules .card ol { margin: 0 0 0 20px; color: var(--dim); }
.rules .card li { margin-bottom: 6px; }
.rules .card p:last-child { margin-bottom: 0; }
.rules .legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin: 18px 0 0; }
.rules .legend div { background: rgba(17,24,39,0.7); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; font-size: 13px; color: var(--dim); line-height: 1.55; }
.rules .legend b { display: block; font-family: var(--mono); font-size: 12px; margin-bottom: 4px; }
.rules .chip { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; position: relative; top: 1px; }
.rules .chip.p { background: var(--accent); box-shadow: 0 0 0 3px rgba(0,212,255,.15); }
.rules .chip.f { background: var(--warn); border-radius: 2px; }
.rules .chip.d { background: repeating-linear-gradient(45deg, rgba(239,68,68,.6) 0 3px, transparent 3px 6px); border: 1px solid rgba(239,68,68,.5); border-radius: 2px; }
.rules .phase { margin: 0 0 30px; }
.rules .phase-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 12px; padding: 0 0 10px; }
.rules .phase-num { font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--accent); border: 1px solid rgba(0,212,255,.5); background: rgba(0,212,255,.08); border-radius: 99px; padding: 1px 9px; flex: none; }
.rules .phase-name { font-family: var(--mono); font-weight: 700; font-size: 18px; margin: 0; }
.rules .phase-en { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.rules .steps { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: rgba(17,24,39,0.7); }
.rules .step { display: grid; grid-template-columns: 54px 54px 1fr; border-bottom: 1px solid var(--border); position: relative; transition: background .2s; }
.rules .step:last-child { border-bottom: 0; }
.rules .step:hover { background: rgba(26,34,54,.7); }
.rules .closed { position: absolute; left: 0; width: 108px; top: 0; bottom: 0; pointer-events: none; z-index: 0; background: repeating-linear-gradient(45deg, rgba(239,68,68,.13) 0 5px, transparent 5px 11px); border-right: 1px solid var(--border); }
.rules .lane { display: flex; flex-direction: column; padding: 16px 0; border-right: 1px solid var(--border); position: relative; }
.rules .lane::after { content: ""; position: absolute; top: 16px; bottom: 16px; left: 50%; width: 1px; background: var(--border); transform: translateX(-.5px); z-index: 0; }
.rules .slot { height: 34px; display: flex; align-items: center; justify-content: center; position: relative; z-index: 1; }
.rules .dot { width: 21px; height: 21px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 10px; font-weight: 700; font-style: normal; background: var(--bg); border: 1.5px solid var(--border); line-height: 1; }
.rules .dot.p { border-color: var(--accent); background: var(--accent); color: var(--bg); box-shadow: 0 0 0 4px rgba(0,212,255,.12); }
.rules .dot.f { border-color: var(--warn); background: var(--warn); color: var(--bg); border-radius: 4px; }
.rules .lanes-head { display: grid; grid-template-columns: 54px 54px 1fr; font-family: var(--mono); font-size: 10px; letter-spacing: .12em; color: var(--muted); border-bottom: 1px solid var(--border); background: rgba(26,34,54,.6); }
.rules .lanes-head span { text-align: center; padding: 6px 0; border-right: 1px solid var(--border); }
.rules .lanes-head span:last-child { text-align: left; padding-left: 18px; border-right: 0; }
.rules .body { padding: 14px 18px 16px; }
.rules .step-title { font-family: var(--mono); font-weight: 700; font-size: 14px; margin: 0 0 3px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; color: var(--text); }
.rules .ref { font-family: var(--mono); font-size: 10px; color: var(--muted); font-weight: 400; }
.rules .en { font-family: var(--mono); font-size: 11px; font-weight: 400; color: var(--accent); opacity: .75; }
.rules .step p { margin: 6px 0 0; font-size: 14px; }
.rules .tag { display: inline-block; font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; padding: 2px 9px; border-radius: 99px; border: 1px solid; margin-top: 10px; margin-right: 6px; }
.rules .tag.ok { color: var(--accent); border-color: rgba(0,212,255,.4); background: rgba(0,212,255,.05); }
.rules .tag.no { color: var(--danger); border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.05); }
.rules .tag.sorc { color: var(--warn); border-color: rgba(245,158,11,.4); background: rgba(245,158,11,.05); }
.rules .step.hot { background: linear-gradient(90deg, rgba(124,58,237,.14), transparent 60%); }
.rules .step.hot .body { box-shadow: inset 2px 0 0 var(--violet); }
.rules .flag { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--violet); display: block; margin-bottom: 4px; }
.rules .seq { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.rules .seq li { counter-increment: s; position: relative; padding: 0 0 12px 30px; border-left: 1px solid var(--border); margin-left: 10px; color: var(--dim); font-size: 14px; }
.rules .seq li:last-child { border-left-color: transparent; padding-bottom: 0; }
.rules .seq li::before { content: counter(s); position: absolute; left: -11px; top: 1px; width: 22px; height: 22px; border-radius: 99px; background: rgba(0,212,255,.1); border: 1px solid rgba(0,212,255,.4); color: var(--accent); font-family: var(--mono); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.rules .cb { background: rgba(7,13,23,0.85); border: 1px solid var(--border); border-radius: 10px; box-shadow: inset 3px 0 0 var(--accent2); padding: 18px 22px; font-family: var(--mono); font-size: 12.5px; line-height: 1.8; overflow-x: auto; white-space: pre; color: var(--dim); margin: 16px 0; }
.rules .cb b { color: var(--accent); font-weight: 700; }
.rules .cb u { color: var(--warn); text-decoration: none; }
.rules .cb s { color: var(--violet); text-decoration: none; }
.rules .note { border-left: 2px solid var(--border); padding-left: 14px; margin: 14px 0 0; font-size: 14px; }
.rules h3.sub { font-family: var(--mono); font-size: 14px; color: var(--accent); margin: 28px 0 4px; }
.rules .summary-box { background: linear-gradient(135deg, rgba(0,212,255,0.08), rgba(124,58,237,0.08)); border: 1px solid rgba(0,212,255,0.2); border-radius: 10px; padding: 32px; margin-top: 48px; text-align: center; }
.rules .summary-box h3 { font-family: var(--mono); font-size: 20px; color: var(--accent); margin-bottom: 12px; }
.rules .summary-box p { color: var(--dim); margin: 0 auto; max-width: 620px; }
.rules .foot { margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--border); font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: .05em; }
.rules .filter { position: sticky; top: 56px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 12px 14px; margin: 0 0 28px; background: rgba(10,14,23,0.92); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border: 1px solid var(--border); border-radius: 10px; }
.rules .filter input { flex: 1 1 220px; min-width: 0; font-family: var(--mono); font-size: 13px; color: var(--text); background: var(--surface2); border: 1px solid var(--border); border-radius: 99px; padding: 7px 14px; outline: none; }
.rules .filter input:focus { border-color: var(--accent); }
.rules .filter .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rules .fchip { font-family: var(--mono); font-size: 11px; padding: 4px 11px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface2); color: var(--muted); cursor: pointer; }
.rules .fchip:hover { color: var(--text); }
.rules .fchip.on { color: var(--accent); border-color: rgba(0,212,255,0.5); background: rgba(0,212,255,0.08); }
.rules .filter .count { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-left: auto; }
.rules .kwgroup { margin: 0 0 44px; scroll-margin-top: 140px; }
.rules .kwgroup > p { font-size: 14px; margin: 0 0 6px; }
.rules .kwlist { margin: 12px 0 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: rgba(17,24,39,0.7); }
.rules .kw { display: grid; grid-template-columns: minmax(150px, 210px) 1fr; border-bottom: 1px solid var(--border); transition: background .2s; }
.rules .kw:last-child { border-bottom: 0; }
.rules .kw:hover { background: rgba(26,34,54,.7); }
.rules .kw dt { font-family: var(--mono); font-size: 12.5px; font-weight: 700; color: var(--accent); padding: 10px 14px; }
.rules .kw dd { margin: 0; font-size: 14px; color: var(--dim); padding: 10px 16px 10px 0; line-height: 1.6; }
.rules .kw dd em { color: var(--warn); font-style: normal; }
.rules .set { display: inline-block; font-family: var(--mono); font-size: 9.5px; font-weight: 400; letter-spacing: .06em; padding: 0 7px; margin: 0 4px 0 0; border-radius: 99px; border: 1px solid rgba(124,58,237,.5); color: var(--violet); background: rgba(124,58,237,.08); vertical-align: 1px; }
.rules .aw { display: inline-block; font-family: var(--mono); font-size: 9.5px; letter-spacing: .06em; padding: 0 7px; border-radius: 99px; border: 1px solid var(--border); color: var(--muted); vertical-align: 1px; }
.rules .kwgroup.hide, .rules .kw.hide { display: none; }
.rules .empty { display: none; font-family: var(--mono); font-size: 13px; color: var(--muted); text-align: center; padding: 30px 0; }
.rules .empty.show { display: block; }
.rules .callout { display: flex; gap: 14px; padding: 16px 20px; border: 1px solid rgba(0,212,255,0.3); background: rgba(0,212,255,0.05); border-radius: 10px; margin: 0 0 28px; font-size: 14px; color: var(--dim); }
.rules .callout-icon { font-size: 18px; flex-shrink: 0; }

@media (max-width: 560px) {
  .rules .step, .rules .lanes-head { grid-template-columns: 38px 38px 1fr; }
  .rules .lane { padding: 14px 0; }
  .rules .slot { height: 30px; }
  .rules .dot { width: 19px; height: 19px; font-size: 9px; }
  .rules .body { padding: 12px 12px 14px; }
  .rules .closed { width: 76px; }
  .rules .card { padding: 18px 18px; }
  .rules .kw { grid-template-columns: 1fr; }
  .rules .kw dt { padding: 10px 14px 0; }
  .rules .kw dd { padding: 2px 14px 10px; }
  .rules .filter { top: 50px; }
}

@media print {
  .rules .steps, .rules .card, .rules .legend div { background: #fff; }
  .rules .filter { display: none; }
  .rules .kwlist { background: #fff; }
}
