/* Content pages — Rules, HowToPlay, Rankings, Terms, Privacy, Tips */

/* Allow scrolling on these pages (lobby.css sets overflow:hidden globally) */
html:has(.rules-page),
html:has(.how-to-play-page),
html:has(.rankings-page),
html:has(.terms-page),
html:has(.privacy-page),
html:has(.tips-page),
html:has(.completed-games-page) {
  height: auto;
  overflow: auto;
}

body:has(.rules-page),
body:has(.how-to-play-page),
body:has(.rankings-page),
body:has(.terms-page),
body:has(.privacy-page),
body:has(.tips-page),
body:has(.completed-games-page) {
  height: auto;
  overflow: visible;
}

/* ── Page root ────────────────────────────────────────────────────────────── */

.rules-page, .how-to-play-page, .rankings-page, .terms-page, .privacy-page, .tips-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: #1a5c30;
  background-image: url("/assets/boards/board-1-1d85e151.jpg");
  background-repeat: repeat;
  background-size: auto;
  background-attachment: fixed;
  padding: 2rem 1.5rem 0;
  padding-top: calc(52px + 2rem);
  color: rgba(255, 255, 255, 0.85);
  overflow-y: auto;
  box-sizing: border-box;
}

/* ── Page headers ─────────────────────────────────────────────────────────── */

.rules-header, .howtoplay-header, .rankings-header,
.terms-header, .privacy-header, .tips-header {
  max-width: 900px;
  margin: 0 auto 1.5rem;
}

.rules-header h1, .howtoplay-header h1, .rankings-header h1,
.terms-header h1, .privacy-header h1, .tips-header h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* ── Shared card surface ──────────────────────────────────────────────────── */

.rules-content, .rankings-content, .terms-content,
.privacy-content, .tips-content, .scenario-display,
.scenario-navigator {
  background: rgba(10, 26, 15, 0.92);
  border: 1px solid rgba(126, 207, 154, 0.18);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* ── Containers / layout ──────────────────────────────────────────────────── */

.rules-container, .rankings-container, .terms-container,
.privacy-container, .tips-container {
  max-width: 900px;
  margin: 0 auto;
}

.rules-content, .terms-content, .privacy-content, .tips-content {
  padding: 2rem;
}

/* ── Headings inside cards ────────────────────────────────────────────────── */

.rules-content h2, .terms-content h2, .privacy-content h2, .tips-content h2 {
  color: #7ecf9a;
  font-size: 1.35rem;
  margin: 0 0 0.8rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(126, 207, 154, 0.2);
}

.rules-content h3, .terms-content h3, .privacy-content h3, .tips-content h3 {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.1rem;
  margin: 1.4rem 0 0.5rem;
}

.rules-section {
  margin-bottom: 2.2rem;
}

.rules-section:last-child {
  margin-bottom: 0;
}

/* ── Body text ────────────────────────────────────────────────────────────── */

.rules-content p, .terms-content p, .privacy-content p, .tips-content p {
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.65;
  margin: 0.6rem 0;
}

.rules-content ul, .terms-content ul, .privacy-content ul, .tips-content ul,
.rules-content ol, .terms-content ol, .privacy-content ol, .tips-content ol {
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.75;
  padding-left: 1.5rem;
}

.rules-content li, .terms-content li, .privacy-content li, .tips-content li {
  margin: 0.45rem 0;
}

.rules-content strong, .terms-content strong, .privacy-content strong, .tips-content strong {
  color: rgba(255, 255, 255, 0.95);
  font-weight: 600;
}

/* ── Steps (Rules page) ───────────────────────────────────────────────────── */

.steps-container {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1.5rem;
  margin: 1.2rem 0;
}

.step-selector {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.step-button {
  padding: 0.75rem 1rem;
  text-align: left;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.step-button:hover {
  background: rgba(255, 255, 255, 0.09);
  color: rgba(255, 255, 255, 0.9);
}

.step-button.active {
  background: rgba(126, 207, 154, 0.15);
  border-color: rgba(126, 207, 154, 0.45);
  color: #c8f7e8;
  font-weight: 600;
}

.step-content {
  padding: 1.2rem 1.5rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.step-content h3 {
  color: #7ecf9a;
  margin: 0 0 0.8rem;
}

.step-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.step-indicator {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.85rem;
  font-weight: 500;
}

.example-section {
  margin: 1.2rem 0;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  border-left: 3px solid rgba(126, 207, 154, 0.4);
}

.example-label {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  margin: 0 0 0.8rem;
}

.board-display, .hand-display {
  padding: 1rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  margin: 0.8rem 0;
  overflow-x: auto;
}

.board-display.large {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Shared nav button (Previous / Next) ──────────────────────────────────── */

.btn.btn-small,
button.btn.btn-small {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 7px;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.45rem 0.9rem;
  transition: background 0.15s ease, color 0.15s ease;
  line-height: 1.4;
}

.btn.btn-small:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.btn.btn-small:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ── How-to-Play layout ───────────────────────────────────────────────────── */

.howtoplay-container {
  max-width: 900px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
}

.scenario-navigator {
  padding: 1.4rem;
  height: fit-content;
  position: sticky;
  top: calc(52px + 1rem);
}

.scenario-navigator h2 {
  margin: 0 0 1rem;
  color: #7ecf9a;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.scenario-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.scenario-button {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  color: rgba(255, 255, 255, 0.6);
}

.scenario-button:hover {
  background: rgba(255, 255, 255, 0.09);
  color: rgba(255, 255, 255, 0.9);
}

.scenario-button.active {
  background: rgba(126, 207, 154, 0.15);
  border-color: rgba(126, 207, 154, 0.45);
  color: #c8f7e8;
}

.scenario-number {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.6);
}

.scenario-button.active .scenario-number {
  background: rgba(126, 207, 154, 0.25);
  color: #c8f7e8;
}

.scenario-title {
  font-size: 0.875rem;
  font-weight: 500;
}

.scenario-display {
  padding: 2rem;
}

.scenario-display h3 {
  color: #7ecf9a;
  font-size: 1.3rem;
  margin: 0 0 0.5rem;
}

.scenario-description {
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.6;
  margin: 0 0 1.5rem;
}

.game-view {
  margin: 1.5rem 0;
}

.board-section, .hand-section {
  margin-bottom: 1.2rem;
}

.section-label {
  font-weight: 600;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 0.5rem;
}

.hand-section.empty {
  padding: 1.2rem;
  text-align: center;
  background: rgba(126, 207, 154, 0.06);
  border-radius: 8px;
  border: 1px dashed rgba(126, 207, 154, 0.3);
}

.hand-status {
  color: #7ecf9a;
  font-weight: 600;
  margin: 0;
}

.explanation-box {
  padding: 1.2rem 1.4rem;
  background: rgba(126, 207, 154, 0.07);
  border-left: 3px solid rgba(126, 207, 154, 0.4);
  border-radius: 8px;
  margin: 1.2rem 0;
}

.explanation-box p {
  margin: 0;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.6;
}

/* ── Rankings ─────────────────────────────────────────────────────────────── */

.rankings-content {
  padding: 2rem;
}

.rankings-info {
  margin-bottom: 1.8rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.rankings-info p {
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.6;
  margin: 0;
  font-size: 0.9rem;
}

.rankings-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ranking-item {
  display: flex;
  align-items: flex-start;
  gap: 1.2rem;
  padding: 1.1rem 1.2rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.ranking-item:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(126, 207, 154, 0.2);
}

.ranking-position {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  background: rgba(126, 207, 154, 0.15);
  border: 1px solid rgba(126, 207, 154, 0.3);
  border-radius: 50%;
  color: #7ecf9a;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.ranking-info-group {
  flex: 1;
  min-width: 0;
}

.ranking-name {
  margin: 0 0 0.3rem;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
}

.ranking-stats {
  margin: 0;
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.875rem;
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.ranking-score strong {
  color: #7ecf9a;
  font-size: 1rem;
}

.ranking-record {
  color: rgba(255, 255, 255, 0.3);
}

.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: rgba(255, 255, 255, 0.35);
}

.empty-state p {
  margin: 0;
  font-size: 1rem;
}

.error-message {
  color: #ff8a80;
  padding: 1rem;
  background: rgba(231, 76, 60, 0.12);
  border-radius: 8px;
  border-left: 3px solid rgba(231, 76, 60, 0.5);
}

/* ── Terms / Privacy / Tips footers ──────────────────────────────────────── */

.terms-footer, .privacy-footer, .tips-footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
}

.terms-footer p, .privacy-footer p, .tips-footer p {
  margin: 0.4rem 0;
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.85rem;
}

/* ── Domino visuals (Rules + Tips) ───────────────────────────────────────── */

.rules-domino-chain {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 0.25rem 0;
}

.rules-chain-dot {
  color: rgba(255, 255, 255, 0.25);
  font-size: 0.75rem;
  flex-shrink: 0;
  line-height: 1;
}

.rules-board-end {
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(126, 207, 154, 0.8);
  letter-spacing: 0.03em;
  padding: 0 2px;
  flex-shrink: 0;
  white-space: nowrap;
}

.rules-domino-hand {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  padding: 0.25rem 0;
}

.rules-tile--playable {
  border-color: #7ecf9a;
  box-shadow: 0 0 8px rgba(126, 207, 154, 0.5);
}

.rules-tile--best {
  border-color: #c9a84c;
  box-shadow: 0 0 10px rgba(201, 168, 76, 0.6);
}

.rules-hand-note {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.45);
  text-align: center;
  margin: 0.5rem 0 0;
  font-style: italic;
}

.tips-example {
  margin: 1rem 0 0;
  padding: 0.9rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  border-left: 3px solid rgba(201, 168, 76, 0.4);
}

.tips-example .example-label {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.65);
  margin: 0 0 0.7rem;
  font-size: 0.85rem;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .steps-container {
    grid-template-columns: 1fr;
  }

  .step-selector {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .step-button {
    flex: 1;
    min-width: 120px;
  }

  .howtoplay-container {
    grid-template-columns: 1fr;
  }

  .scenario-navigator {
    position: static;
  }

  .rules-header h1, .howtoplay-header h1, .rankings-header h1,
  .terms-header h1, .privacy-header h1, .tips-header h1 {
    font-size: 1.6rem;
  }
}
