*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0d0d0d;
  --bg2: #161616;
  --bg3: #1e1e1e;
  --red: #ff6b6b;
  --red-dim: #cc3333;
  --text: #e0e0e0;
  --text-dim: #888;
  --border: #2a2a2a;
  --radius: 8px;
}

html { scroll-behavior: smooth; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; display: flex; flex-direction: column; }

/* Header */
.header { position: sticky; top: 0; z-index: 100; background: var(--bg2); border-bottom: 1px solid var(--border); }
.header__inner { max-width: 1000px; margin: 0 auto; padding: 0 1rem; display: flex; align-items: center; gap: 1.5rem; height: 56px; }
.logo { color: var(--red); text-decoration: none; font-weight: 700; font-size: 1.1rem; white-space: nowrap; }

/* Tabs */
.tabs { display: flex; gap: 0.25rem; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { background: none; border: none; color: var(--text-dim); padding: 0.5rem 1rem; font-size: 0.9rem; cursor: pointer; white-space: nowrap; border-bottom: 2px solid transparent; transition: color 0.2s, border-color 0.2s, background 0.2s; font-family: inherit; border-radius: var(--radius) var(--radius) 0 0; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--red); border-bottom: 3px solid var(--red); background: rgba(255, 107, 107, 0.08); }
.tab:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }

/* Menu toggle (mobile) */
.menu-toggle { display: none; background: none; border: none; cursor: pointer; padding: 0.5rem; flex-direction: column; gap: 4px; }
.menu-toggle span { display: block; width: 22px; height: 2px; background: var(--text); transition: 0.2s; }

/* Main */
.main { flex: 1; max-width: 1000px; margin: 0 auto; padding: 2rem 1rem; width: 100%; }

/* Game section */
.game { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.game__header { margin-bottom: 2rem; }
.game__title { font-size: 2rem; color: var(--red); margin-bottom: 0.5rem; }
.game__intro { font-size: 1.05rem; color: var(--text-dim); line-height: 1.7; }

.game__meta { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 2rem; align-items: stretch; }
.meta-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; }
.meta-card__label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--red); margin-bottom: 0.25rem; font-weight: 600; }
.meta-card__text { font-size: 0.95rem; }

/* Content blocks */
.block { margin-bottom: 2rem; }
.block__title { font-size: 1.15rem; color: var(--red); margin-bottom: 0.75rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); cursor: pointer; user-select: none; display: flex; justify-content: space-between; align-items: center; }
.block__title::after { content: '▾'; font-size: 0.9rem; transition: transform 0.2s; }
.block__title.collapsed::after { transform: rotate(-90deg); }
.block__content { overflow: hidden; transition: max-height 0.3s ease; }
.block__content.collapsed { max-height: 0 !important; overflow: hidden; }
.block__text { margin-bottom: 0.5rem; }
.block__list { padding: 0; }
.block__list li { padding: 0.4rem 0 0.4rem 2rem; position: relative; }
.block__list li::before { position: absolute; left: 0; color: var(--red); font-weight: bold; }
.block__list--numbered { list-style: none; counter-reset: rule-counter; }
.block__list--numbered li { counter-increment: rule-counter; }
.block__list--numbered li::before { content: counter(rule-counter) '.'; }
.block__list--bulleted { list-style: none; }
.block__list--bulleted li::before { content: '▸'; }

/* Win/Lose */
.result { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 2rem; }
.result__card { background: var(--bg2); border-radius: var(--radius); padding: 1.25rem; border: 1px solid var(--border); }
.result__card--win { border-color: #2d5a2d; }
.result__card--lose { border-color: #5a2d2d; }
.result__card h3 { font-size: 0.95rem; margin-bottom: 0.75rem; }
.result__card--win h3 { color: #6cbf6c; }
.result__card--lose h3 { color: var(--red); }
.result__card p, .result__card li { font-size: 0.9rem; }
.result__card ul { list-style: none; padding: 0; }
.result__card li { padding: 0.25rem 0 0.25rem 1.25rem; position: relative; }
.result__card--win li::before { content: '✓'; position: absolute; left: 0; color: #6cbf6c; }
.result__card--lose li::before { content: '✗'; position: absolute; left: 0; color: var(--red); }

/* Back to top */
.back-to-top { position: fixed; bottom: 2rem; right: 2rem; width: 44px; height: 44px; border-radius: 50%; background: var(--red); color: var(--bg); border: none; font-size: 1.3rem; cursor: pointer; opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s, transform 0.2s; z-index: 200; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0,0,0,0.4); }
.back-to-top.visible { opacity: 1; visibility: visible; }
.back-to-top:hover { transform: scale(1.1); }

/* Footer */
.footer { text-align: center; padding: 1.5rem 1rem; color: var(--text-dim); font-size: 0.8rem; border-top: 1px solid var(--border); margin-top: auto; }

/* Mobile */
@media (max-width: 640px) {
  .menu-toggle { display: flex; }
  .tabs { display: none; flex-direction: column; position: absolute; top: 56px; left: 0; right: 0; background: var(--bg2); border-bottom: 1px solid var(--border); padding: 0.5rem; }
  .tabs.open { display: flex; }
  .tab { text-align: left; padding: 0.75rem 1rem; border-bottom: none; border-left: 2px solid transparent; border-radius: 0; }
  .tab.active { border-left-color: var(--red); border-bottom-color: transparent; }
  .game__meta { grid-template-columns: 1fr; }
  .result { grid-template-columns: 1fr; }
  .game__title { font-size: 1.5rem; }
}

/* Print */
@media print {
  .header, .footer, .back-to-top { display: none !important; }
  body { background: #fff; color: #000; }
  .main { max-width: 100%; }
  .meta-card, .result__card, .block { border-color: #ccc; }
  .meta-card, .result__card { background: #fff; }
  .block__content.collapsed { max-height: none !important; }
  .block__title::after { display: none; }
}
