/* Power Plays Rules - Mobile Landscape Optimized */

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  color: #fff;
  min-height: 100vh;
  min-height: 100dvh;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}


/* Main container - horizontal scroll */
.rules-container {
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  height: 100vh;
  height: 100dvh;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.rules-container::-webkit-scrollbar {
  display: none;
}

/* Each rule card/screen */
.rule-card {
  flex: 0 0 100vw;
  height: 100%;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px 40px;
  position: relative;
}

/* Card styling */
.card-content {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 25px 35px;
  max-width: 90%;
  max-height: 85%;
  overflow-y: auto;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.card-content::-webkit-scrollbar {
  width: 6px;
}

.card-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.card-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

/* Typography */
h1 {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  margin-bottom: 15px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

h2 {
  font-size: clamp(1.3rem, 4vw, 1.8rem);
  margin-bottom: 15px;
  color: #ffd700;
}

h3 {
  font-size: clamp(1rem, 3vw, 1.3rem);
  margin: 12px 0 8px;
  color: #00d4ff;
}

p {
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  line-height: 1.5;
  margin-bottom: 10px;
}

ul, ol {
  font-size: clamp(0.85rem, 2.5vw, 1rem);
  line-height: 1.6;
  padding-left: 20px;
  margin-bottom: 10px;
}

li {
  margin-bottom: 6px;
}

/* Color system cards */
.color-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 15px 0;
}

.color-card {
  padding: 12px 15px;
  border-radius: 12px;
  text-align: center;
  font-weight: bold;
  font-size: clamp(0.8rem, 2vw, 0.95rem);
}

.color-card.blue {
  background: linear-gradient(135deg, #2196F3, #1565C0);
  box-shadow: 0 4px 15px rgba(33, 150, 243, 0.4);
}

.color-card.yellow {
  background: linear-gradient(135deg, #FFC107, #FF9800);
  color: #1a1a2e;
  box-shadow: 0 4px 15px rgba(255, 193, 7, 0.4);
}

.color-card.red {
  background: linear-gradient(135deg, #f44336, #c62828);
  box-shadow: 0 4px 15px rgba(244, 67, 54, 0.4);
}

.color-card.green {
  background: linear-gradient(135deg, #4CAF50, #2E7D32);
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

.color-card.black {
  background: linear-gradient(135deg, #424242, #212121);
  border: 1px solid #666;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.color-card .title {
  display: block;
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  margin-bottom: 4px;
}

.color-card .desc {
  display: block;
  font-weight: normal;
  font-size: clamp(0.7rem, 1.8vw, 0.85rem);
  opacity: 0.9;
}

/* Action cards table */
.action-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0;
}

.action-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  padding: 10px 15px;
  border-radius: 10px;
  font-size: clamp(0.8rem, 2vw, 0.95rem);
}

.action-item .name {
  font-weight: bold;
  color: #ffd700;
}

/* Navigation dots */
.nav-dots {
  position: fixed;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 100;
}

.nav-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: all 0.3s ease;
}

.nav-dot.active {
  background: #ffd700;
  transform: scale(1.2);
}

/* Swipe hint */
.swipe-hint {
  position: fixed;
  bottom: 40px;
  right: 20px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  gap: 5px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* Title card special styling */
.title-card {
  text-align: center;
}

.title-card h1 {
  font-size: clamp(2.5rem, 8vw, 4rem);
  background: linear-gradient(135deg, #ffd700, #ff6b6b, #4ecdc4, #45b7d1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 20px;
}

.title-card .tagline {
  font-size: clamp(1rem, 3vw, 1.3rem);
  opacity: 0.8;
  margin-bottom: 25px;
}

.title-card .start-hint {
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  color: #ffd700;
  animation: pulse 2s infinite;
}

/* Highlight boxes */
.highlight-box {
  background: rgba(255, 215, 0, 0.15);
  border-left: 4px solid #ffd700;
  padding: 12px 15px;
  margin: 12px 0;
  border-radius: 0 10px 10px 0;
  font-size: clamp(0.85rem, 2.2vw, 1rem);
}

.highlight-box.warning {
  background: rgba(244, 67, 54, 0.15);
  border-left-color: #f44336;
}

.highlight-box.success {
  background: rgba(76, 175, 80, 0.15);
  border-left-color: #4CAF50;
}

/* Two column layout for landscape */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Portrait / vertical orientation — iPhone 16 Pro is ~402px wide */
@media screen and (orientation: portrait) {
  .rules-container {
    padding-top: 0;
  }

  .rule-card {
    padding: 40px 12px 30px;
  }

  .card-content {
    max-width: 100%;
    max-height: 92%;
    padding: 20px 18px;
    border-radius: 16px;
  }

  h2 {
    font-size: 1.15rem;
    margin-bottom: 10px;
  }

  h3 {
    font-size: 0.95rem;
    margin: 8px 0 5px;
  }

  p {
    font-size: 0.88rem;
    line-height: 1.45;
    margin-bottom: 8px;
  }

  ul, ol {
    font-size: 0.85rem;
    line-height: 1.45;
    padding-left: 18px;
    margin-bottom: 8px;
  }

  li {
    margin-bottom: 4px;
  }

  /* Stack two-column layout in portrait */
  .two-col {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .color-grid {
    gap: 8px;
    margin: 10px 0;
  }

  .color-card {
    padding: 10px 12px;
  }

  .color-card .title {
    font-size: 0.9rem;
  }

  .color-card .desc {
    font-size: 0.78rem;
  }

  .action-list {
    gap: 6px;
  }

  .action-item {
    padding: 8px 12px;
    font-size: 0.85rem;
  }

  .highlight-box {
    padding: 10px 12px;
    margin: 10px 0;
    font-size: 0.85rem;
  }

  .title-card h1 {
    font-size: clamp(2rem, 10vw, 3rem);
    margin-bottom: 15px;
  }

  .title-card .tagline {
    font-size: 0.95rem;
    margin-bottom: 18px;
  }

  .back-btn {
    top: max(10px, env(safe-area-inset-top, 10px));
    left: 10px;
    padding: 6px 12px;
    font-size: 0.8rem;
  }

  .nav-dots {
    bottom: max(10px, env(safe-area-inset-bottom, 10px));
  }

  .swipe-hint {
    bottom: max(35px, calc(env(safe-area-inset-bottom, 10px) + 25px));
  }

  /* Override inline font-sizes for portrait */
  .card-content p[style*="font-size"] {
    font-size: 1rem !important;
    margin: 12px 0 !important;
  }

  .card-content ul[style*="font-size"] {
    font-size: 0.9rem !important;
  }

  .card-content p[style*="margin-top"] {
    margin-top: 14px !important;
  }
}

/* Back button */
.back-btn {
  position: fixed;
  top: 15px;
  left: 15px;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: bold;
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  text-decoration: none;
  z-index: 200;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.05);
}

@media (max-height: 450px) {
  .back-btn {
    top: 10px;
    left: 10px;
    padding: 6px 14px;
    font-size: 0.85rem;
  }
}

/* iPhone 16 Pro landscape (~393px height) */
@media (max-height: 420px) {
  .back-btn {
    top: 8px;
    left: max(8px, env(safe-area-inset-left, 8px));
    padding: 4px 10px;
    font-size: 0.75rem;
  }

  .rule-card {
    padding: 10px 25px;
  }

  .card-content {
    padding: 10px 18px;
    max-height: 88%;
    border-radius: 14px;
  }

  h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
  }

  h2 {
    font-size: 1rem;
    margin-bottom: 6px;
  }

  h3 {
    font-size: 0.9rem;
    margin: 6px 0 4px;
  }

  p {
    font-size: 0.82rem;
    line-height: 1.35;
    margin-bottom: 4px;
  }

  ul, ol {
    font-size: 0.8rem;
    line-height: 1.35;
    padding-left: 16px;
    margin-bottom: 6px;
  }

  li {
    margin-bottom: 2px;
  }

  .color-grid {
    gap: 5px;
    margin: 6px 0;
  }

  .color-card {
    padding: 5px 8px;
    border-radius: 8px;
  }

  .color-card .title {
    font-size: 0.8rem;
    margin-bottom: 2px;
  }

  .color-card .desc {
    font-size: 0.68rem;
  }

  .action-list {
    gap: 4px;
    margin: 6px 0;
  }

  .action-item {
    padding: 5px 10px;
    font-size: 0.78rem;
    border-radius: 7px;
  }

  .highlight-box {
    padding: 6px 10px;
    margin: 6px 0;
    font-size: 0.78rem;
    border-radius: 0 7px 7px 0;
  }

  .two-col {
    gap: 12px;
  }

  .title-card h1 {
    font-size: 2.2rem;
    margin-bottom: 10px;
  }

  .title-card .tagline {
    font-size: 0.9rem;
    margin-bottom: 12px;
  }

  .title-card .start-hint {
    font-size: 0.85rem;
  }

  .nav-dots {
    bottom: max(6px, env(safe-area-inset-bottom, 6px));
  }

  .nav-dot {
    width: 8px;
    height: 8px;
    gap: 6px;
  }

  .swipe-hint {
    bottom: max(28px, calc(env(safe-area-inset-bottom, 6px) + 22px));
    right: max(12px, env(safe-area-inset-right, 12px));
    font-size: 11px;
  }

  /* Override inline font-sizes on cards 10-12 */
  .card-content p[style*="font-size"] {
    font-size: 0.9rem !important;
    margin: 8px 0 !important;
  }

  .card-content ul[style*="font-size"] {
    font-size: 0.82rem !important;
  }

  .card-content p[style*="margin-top"] {
    margin-top: 10px !important;
  }
}

/* Tighter squeeze for iPhone 16 Pro exact landscape (~393px) */
@media (max-height: 400px) {
  .rule-card {
    padding: 6px 20px;
  }

  .card-content {
    padding: 8px 14px;
    max-height: 90%;
    border-radius: 12px;
    border-width: 1px;
  }

  h2 {
    font-size: 0.95rem;
    margin-bottom: 4px;
  }

  h3 {
    font-size: 0.85rem;
    margin: 4px 0 3px;
  }

  p {
    font-size: 0.78rem;
    line-height: 1.3;
    margin-bottom: 3px;
  }

  ul, ol {
    font-size: 0.76rem;
    line-height: 1.3;
    padding-left: 14px;
    margin-bottom: 4px;
  }

  li {
    margin-bottom: 1px;
  }

  .color-grid {
    gap: 4px;
    margin: 4px 0;
  }

  .color-card {
    padding: 4px 6px;
  }

  .color-card .title {
    font-size: 0.76rem;
    margin-bottom: 1px;
  }

  .color-card .desc {
    font-size: 0.65rem;
  }

  .action-list {
    gap: 3px;
    margin: 4px 0;
  }

  .action-item {
    padding: 4px 8px;
    font-size: 0.75rem;
  }

  .highlight-box {
    padding: 5px 8px;
    margin: 4px 0;
    font-size: 0.75rem;
  }

  .two-col {
    gap: 8px;
  }

  .title-card h1 {
    font-size: 2rem;
    margin-bottom: 6px;
  }

  .title-card .tagline {
    font-size: 0.85rem;
    margin-bottom: 8px;
  }

  /* Override inline font-sizes on cards 10-12 */
  .card-content p[style*="font-size"] {
    font-size: 0.82rem !important;
    margin: 5px 0 !important;
  }

  .card-content ul[style*="font-size"] {
    font-size: 0.78rem !important;
  }

  .card-content p[style*="margin-top"] {
    margin-top: 6px !important;
  }
}
