/* Main CSS for GBA Online */
:root {
    /* GBA inspired color palette */
    --primary-color: #8b0000;     /* Dark red, inspired by GBA */
    --secondary-color: #1e3a8a;   /* Dark blue, inspired by GBA */
    --accent-color: #16a34a;      /* Green, for CTAs */
    --background-color: #f8fafc;  /* Light background */
    --text-color: #1e293b;        /* Dark text */
    --card-bg-color: #ffffff;     /* White for cards */
    --header-bg-color: #8b0000;   /* Dark red for header */
    --footer-bg-color: #1e293b;   /* Dark slate for footer */
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
}

a {
    text-decoration: none;
    color: var(--primary-color);
}

a:hover {
    text-decoration: underline;
}

/* Header Styles */
header {
    background-color: var(--header-bg-color);
    color: white;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
}

.logo a {
    color: white;
    text-decoration: none;
}

nav ul {
    display: flex;
    list-style: none;
}

nav ul li {
    margin-left: 1.5rem;
}

nav ul li a {
    color: white;
    text-decoration: none;
    transition: color 0.3s;
}

nav ul li a:hover {
    color: #f0f0f0;
}

/* Search Bar */
.search-container {
    margin: 1rem auto;
    max-width: 1200px;
    padding: 0 1rem;
}

.search-bar {
    display: flex;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.search-bar input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    font-size: 1rem;
}

.search-bar button {
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 1rem;
}

/* Main Content */
.main-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.section-title {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

/* ROM Grid */
.rom-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.rom-card {
    background-color: var(--card-bg-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.rom-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.rom-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.rom-card-content {
    padding: 1rem;
}

.rom-card-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.rom-card-description {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.rom-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #888;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

.pagination a {
    display: inline-block;
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: var(--primary-color);
    transition: background-color 0.3s;
}

.pagination a:hover, .pagination a.active {
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
}

/* Footer */
footer {
    background-color: var(--footer-bg-color);
    color: white;
    padding: 2rem 1rem;
    margin-top: 3rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.footer-section h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section ul li a {
    color: #ddd;
    text-decoration: none;
}

.footer-section ul li a:hover {
    color: white;
    text-decoration: underline;
}

.footer-bottom {
    max-width: 1200px;
    margin: 2rem auto 0;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    font-size: 0.9rem;
    color: #aaa;
}

/* ROM Detail Page */
.rom-detail {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}

.rom-detail-image {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.rom-detail-content h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.rom-detail-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.rom-detail-meta-item {
    display: flex;
    flex-direction: column;
}

.rom-detail-meta-label {
    font-size: 0.9rem;
    color: #888;
}

.rom-detail-meta-value {
    font-size: 1rem;
    font-weight: 500;
}

.rom-detail-description {
    margin-bottom: 2rem;
    line-height: 1.8;
}

.rom-detail-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.3s;
}

.btn:hover {
    transform: translateY(-2px);
    text-decoration: none;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
}

.btn-primary:hover {
    background-color: #15803d;
}

.btn-secondary {
    background-color: var(--primary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #7f1d1d;
}

/* Categories */
.categories {
    margin-bottom: 2rem;
}

.category-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.category-tag {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: #f1f5f9;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-color);
    transition: background-color 0.3s;
}

.category-tag:hover {
    background-color: #e2e8f0;
    text-decoration: none;
}

/* Emulator Page */
.emulator-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.emulator-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.emulator-title {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.emulator-back {
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.emulator-screen {
    background-color: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    margin-bottom: 1.5rem;
}

.emulator-controls {
    background-color: var(--card-bg-color);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.emulator-controls h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.control-group {
    margin-bottom: 1rem;
}

.control-group h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.control-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.control-key {
    font-weight: 500;
}

.control-action {
    color: #666;
}

/* Virtual Controls for Mobile */
.virtual-controls {
    display: none;
}

/* Media Queries */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        text-align: center;
    }
    
    nav ul {
        margin-top: 1rem;
        justify-content: center;
    }
    
    nav ul li {
        margin: 0 0.75rem;
    }
    
    .rom-detail {
        grid-template-columns: 1fr;
    }
    
    .rom-detail-image {
        max-width: 300px;
        margin: 0 auto;
    }
    
    .virtual-controls {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
        margin-top: 1.5rem;
    }
    
    .virtual-control-group {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .virtual-btn {
        width: 60px;
        height: 60px;
        border-radius: 50%;
        background-color: rgba(0, 0, 0, 0.5);
        color: white;
        display: flex;
        justify-content: center;
        align-items: center;
        font-weight: bold;
        margin: 0.5rem;
        user-select: none;
    }
    
    .d-pad {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(3, 1fr);
        gap: 0.25rem;
    }
    
    .d-pad .virtual-btn {
        border-radius: 8px;
    }
}

/* Desktop Emulator Layout */
.desktop-layout {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
}

.desktop-layout .emulator-screen {
    flex: 0 0 720px;
}

.desktop-layout .controls-sidebar {
    flex: 0 0 250px;
}

/* Mobile Emulator Layout */
.mobile-layout {
    display: flex;
    flex-direction: column;
}

.mobile-layout .emulator-screen {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
}

/* Special Mode Layout */
.special-layout {
    display: flex;
    justify-content: center;
    align-items: center;
}

.special-layout .emulator-screen {
    flex: 0 0 auto;
}

.special-layout .virtual-controls {
    display: flex;
    position: absolute;
    width: 100%;
    justify-content: space-between;
    padding: 0 1rem;
}

.special-layout .left-controls,
.special-layout .right-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* 语言切换器样式 - 对齐主导航标签 */
.language-switcher {
  position: relative;
  margin-left: 0;
  display: flex;
  align-items: center;
  height: 48px;
}
.lang-btn {
  display: flex;
  align-items: center;
  background: none;
  color: inherit;
  border: none;
  padding: 0 16px;
  height: 48px;
  font: inherit;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s;
  box-sizing: border-box;
}
nav ul > li, .language-switcher {
  height: 48px;
  display: flex;
  align-items: center;
}
.lang-btn:hover, .lang-btn[aria-expanded="true"] {
  background: rgba(255,255,255,0.08);
}
.lang-btn svg {
  margin-left: 6px;
  transition: transform 0.2s;
}
.lang-btn[aria-expanded="true"] svg {
  transform: rotate(180deg);
}
.lang-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  min-width: 160px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.2s;
  z-index: 100;
  padding: 8px 0;
  border: 1px solid #eee;
}
.lang-dropdown[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.lang-dropdown ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}
.lang-option {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  color: #222;
  text-decoration: none;
  font-size: 1rem;
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}
.lang-option:hover, .lang-option.active {
  background: #f0f4fa;
  color: #1976d2;
}
.lang-icon {
  margin-right: 8px;
  font-size: 1.2em;
}
@media (max-width: 768px) {
  .language-switcher {
    margin: 10px 0 0;
    width: 100%;
    justify-content: center;
  }
  .lang-btn {
    width: 100%;
    justify-content: center;
    height: 44px;
  }
  .lang-dropdown {
    width: 100%;
    position: static;
    margin-top: 5px;
    box-shadow: none;
    border: 1px solid #eee;
  }
  .lang-dropdown ul {
    max-height: 300px;
    overflow-y: auto;
  }
}
