/**
 * 333jili Layout Styles
 * All classes use pg47- prefix for namespace isolation
 */

/* CSS Variables */
:root {
  --pg47-primary: #8B7355;
  --pg47-secondary: #20B2AA;
  --pg47-accent: #90EE90;
  --pg47-dark: #212F3D;
  --pg47-light: #F5F5F5;
  --pg47-white: #FFFFFF;
  --pg47-text-dark: #212F3D;
  --pg47-text-light: #FFFFFF;
  --pg47-border: #E0E0E0;
  --pg47-shadow: rgba(0, 0, 0, 0.1);
  --app-height: 100vh;
}

/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 62.5%;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 1.4rem;
  line-height: 1.5;
  color: var(--pg47-text-dark);
  background: var(--pg47-light);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Container */
.pg47-container {
  max-width: 430px;
  margin: 0 auto;
  background: var(--pg47-white);
  min-height: 100vh;
  position: relative;
}

.pg47-wrapper {
  padding: 0;
}

/* Header */
.pg47-header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: 56px;
  background: var(--pg47-dark);
  color: var(--pg47-text-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 1000;
  box-shadow: 0 2px 8px var(--pg47-shadow);
}

.pg47-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--pg47-text-light);
}

.pg47-logo-icon {
  width: 28px;
  height: 28px;
  border-radius: 4px;
}

.pg47-logo-text {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--pg47-accent);
}

.pg47-header-actions {
  display: flex;
  gap: 8px;
}

.pg47-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

.pg47-btn-register {
  background: var(--pg47-accent);
  color: var(--pg47-dark);
}

.pg47-btn-register:hover {
  background: #7FD67F;
  transform: scale(1.05);
}

.pg47-btn-login {
  background: var(--pg47-secondary);
  color: var(--pg47-text-light);
}

.pg47-btn-login:hover {
  background: #1A9A93;
  transform: scale(1.05);
}

.pg47-menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  color: var(--pg47-text-light);
  cursor: pointer;
  font-size: 2rem;
}

/* Mobile Menu */
.pg47-mobile-menu {
  position: fixed;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  background: var(--pg47-dark);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  z-index: 9999;
}

.pg47-mobile-menu.pg47-menu-open {
  max-height: 500px;
  overflow-y: auto;
}

.pg47-menu-list {
  list-style: none;
  padding: 12px 0;
}

.pg47-menu-item {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.pg47-menu-link {
  display: block;
  padding: 14px 20px;
  color: var(--pg47-text-light);
  text-decoration: none;
  font-size: 1.4rem;
  transition: background 0.2s ease;
}

.pg47-menu-link:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Main Content */
.pg47-main {
  margin-top: 56px;
  padding-bottom: 80px;
  min-height: calc(var(--app-height) - 56px - 80px);
}

/* Carousel */
.pg47-carousel {
  position: relative;
  width: 100%;
  height: 180px;
  overflow: hidden;
  margin-bottom: 20px;
}

.pg47-carousel-track {
  display: flex;
  transition: transform 0.5s ease;
  height: 100%;
}

.pg47-carousel-slide {
  min-width: 100%;
  height: 100%;
}

.pg47-carousel-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}

/* Section */
.pg47-section {
  padding: 20px 16px;
  margin-bottom: 16px;
}

.pg47-section-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--pg47-primary);
  margin-bottom: 16px;
  text-align: center;
}

/* Game Grid */
.pg47-game-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.pg47-game-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  transition: transform 0.2s ease;
}

.pg47-game-item:hover {
  transform: scale(1.05);
}

.pg47-game-icon {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 4px;
}

.pg47-game-name {
  font-size: 1rem;
  color: var(--pg47-text-dark);
  text-align: center;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

/* Content Card */
.pg47-card {
  background: var(--pg47-white);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px var(--pg47-shadow);
}

.pg47-card-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--pg47-primary);
  margin-bottom: 12px;
}

.pg47-card-content {
  font-size: 1.4rem;
  line-height: 1.6;
  color: var(--pg47-text-dark);
}

.pg47-card-content p {
  margin-bottom: 12px;
}

/* Text Link */
.pg47-text-link {
  color: var(--pg47-secondary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.pg47-text-link:hover {
  color: var(--pg47-primary);
  text-decoration: underline;
}

/* Footer */
.pg47-footer {
  background: var(--pg47-dark);
  color: var(--pg47-text-light);
  padding: 32px 16px 100px;
  text-align: center;
}

.pg47-footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
}

.pg47-footer-link {
  color: var(--pg47-accent);
  text-decoration: none;
  font-size: 1.2rem;
  transition: color 0.2s ease;
}

.pg47-footer-link:hover {
  color: var(--pg47-white);
}

.pg47-partners {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}

.pg47-partner-icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.pg47-copyright {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.7);
}

/* Bottom Navigation */
.pg47-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: 60px;
  background: linear-gradient(135deg, var(--pg47-dark) 0%, #1a2833 100%);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 1000;
  box-shadow: 0 -2px 8px var(--pg47-shadow);
}

.pg47-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  min-height: 60px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.7);
  transition: all 0.3s ease;
  position: relative;
}

.pg47-nav-item:hover {
  color: var(--pg47-accent);
  transform: scale(1.1);
}

.pg47-nav-item.pg47-active {
  color: var(--pg47-accent);
}

.pg47-nav-icon {
  font-size: 2rem;
  margin-bottom: 4px;
}

.pg47-nav-text {
  font-size: 1rem;
  font-weight: 500;
}

/* Utility Classes */
.pg47-text-center {
  text-align: center;
}

.pg47-mb-16 {
  margin-bottom: 16px;
}

.pg47-mt-16 {
  margin-top: 16px;
}

.pg47-highlight {
  color: var(--pg47-secondary);
  font-weight: 700;
}

/* Desktop Specific */
@media (min-width: 769px) {
  .pg47-bottom-nav {
    display: none;
  }

  .pg47-main {
    padding-bottom: 20px;
  }

  .pg47-footer {
    padding-bottom: 32px;
  }
}

/* Mobile Specific */
@media (max-width: 768px) {
  .pg47-mobile-menu {
    width: 100vw;
    max-width: 100vw;
  }
}

/* Loading State */
.pg47-loaded .pg47-main {
  opacity: 1;
  transition: opacity 0.3s ease;
}

/* Responsive Images */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Accessibility */
.pg47-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
