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

/* Modal Styles */
.modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background-color: #fff;
  padding: 2rem;
  border-radius: 8px;
  width: 300px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  text-align: center;
}

.close-modal {
  float: right;
  font-size: 1.5rem;
  cursor: pointer;
}

#login-form input {
  width: 100%;
  padding: 10px;
  margin: 10px 0;
  box-sizing: border-box;
}

.btn-primary, .btn-secondary {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

.btn-primary { background-color: #007bff; color: white; }
.btn-secondary { background-color: #6c757d; color: white; }

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #1a1a2e;
  color: #eee;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 2rem 1rem;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url("bg.jpg") center/cover no-repeat;
  opacity: 0.15;
  z-index: -1;
}

.container {
  max-width: 600px;
  width: 100%;
}

h1 {
  text-align: center;
  margin-bottom: 1rem;
  font-size: 1.8rem;
}

/* Tabs */
#tab-bar {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid #333;
}

.tab-btn {
  flex: 1;
  padding: 0.6rem 1rem;
  border: none;
  background: transparent;
  color: #666;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: #aaa;
}

.tab-btn.active {
  color: #e94560;
  border-bottom-color: #e94560;
}

.tab-panel.hidden {
  display: none;
}

/* Form */
#game-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

#game-form input,
#game-form select {
  flex: 1 1 45%;
  padding: 0.6rem 0.8rem;
  border: 1px solid #333;
  border-radius: 6px;
  background: #16213e;
  color: #eee;
  font-size: 0.95rem;
}

#game-form button {
  flex: 1 1 100%;
  padding: 0.6rem;
  border: none;
  border-radius: 6px;
  background: #e94560;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

#game-form button:hover {
  background: #c73650;
}

/* Search bar */
#search {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid #333;
  border-radius: 6px;
  background: #16213e;
  color: #eee;
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

#search::placeholder {
  color: #666;
}

#search:focus {
  outline: none;
  border-color: #e94560;
}

/* Filter bar */
#filter-bar {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.35rem 0.75rem;
  border: 1px solid #333;
  border-radius: 20px;
  background: transparent;
  color: #aaa;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.filter-btn.active,
.filter-btn:hover {
  background: #e94560;
  color: #fff;
  border-color: #e94560;
}

/* Import/Export bar */
#io-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.io-dropdown {
  position: relative;
}

#export-btn,
#import-btn {
  padding: 0.4rem 0.9rem;
  border: 1px solid #333;
  border-radius: 6px;
  background: #16213e;
  color: #aaa;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

#export-btn:hover,
#import-btn:hover {
  border-color: #e94560;
  color: #e94560;
}

.io-menu {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 0.3rem;
  background: #16213e;
  border: 1px solid #333;
  border-radius: 6px;
  overflow: hidden;
  z-index: 50;
}

.io-menu.hidden {
  display: none;
}

.io-menu button {
  display: block;
  width: 100%;
  padding: 0.4rem 1.2rem;
  border: none;
  background: transparent;
  color: #aaa;
  font-size: 0.85rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}

.io-menu button:hover {
  background: #e94560;
  color: #fff;
}

/* Game list */
#game-list {
  list-style: none;
}

.game-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #16213e;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  transition: transform 0.15s;
}

.game-item:hover {
  transform: translateX(4px);
}

.game-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.game-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.game-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f3460;
  font-size: 1.2rem;
}

.game-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.game-title {
  font-weight: 600;
  font-size: 1.05rem;
}

.game-platform {
  font-size: 0.8rem;
  color: #888;
}

.game-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge.Backlog   { background: #0f3460; color: #7ec8e3; }
.status-badge.Playing   { background: #1a5632; color: #6bcf7f; }
.status-badge.Completed { background: #4a3f00; color: #f0d000; }
.status-badge.Dropped   { background: #4a1a1a; color: #e07070; }

.delete-btn {
  background: none;
  border: none;
  color: #666;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.2rem;
  transition: color 0.2s;
}

.delete-btn:hover {
  color: #e94560;
}

#empty-msg {
  text-align: center;
  color: #555;
  margin-top: 2rem;
}

.hidden {
  display: none;
}

/* Modal */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

#modal-overlay.hidden {
  display: none;
}

#modal {
  background: #16213e;
  border-radius: 12px;
  padding: 2rem;
  max-width: 480px;
  width: 100%;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

#modal-close {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  background: none;
  border: none;
  color: #666;
  font-size: 1.3rem;
  cursor: pointer;
  transition: color 0.2s;
}

#modal-close:hover {
  color: #e94560;
}

#modal-title {
  font-size: 1.4rem;
  margin-bottom: 0.25rem;
  padding-right: 2rem;
}

.modal-sub {
  color: #888;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

#modal .status-badge {
  display: inline-block;
  margin-bottom: 1.25rem;
}

#wiki-lookup-btn {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #333;
  border-radius: 6px;
  background: #0f3460;
  color: #7ec8e3;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 0.5rem;
  transition: all 0.2s;
}

#wiki-lookup-btn:hover {
  background: #1a5632;
  color: #6bcf7f;
  border-color: #1a5632;
}

#wiki-lookup-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#wiki-status {
  font-size: 0.8rem;
  text-align: center;
  margin-bottom: 0.5rem;
}

#wiki-status.hidden {
  display: none;
}

#cover-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

#cover-preview {
  width: 100%;
  max-width: 200px;
  border-radius: 8px;
  object-fit: cover;
}

#cover-preview.hidden {
  display: none;
}

#cover-label {
  display: inline-block;
  padding: 0.45rem 1rem;
  border: 1px dashed #555;
  border-radius: 6px;
  color: #aaa;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

#cover-label:hover {
  border-color: #e94560;
  color: #e94560;
}

#cover-label.hidden {
  display: none;
}

#cover-remove {
  background: none;
  border: none;
  color: #666;
  font-size: 0.8rem;
  cursor: pointer;
  transition: color 0.2s;
}

#cover-remove:hover {
  color: #e94560;
}

#cover-remove.hidden {
  display: none;
}

#cover-error {
  color: #e94560;
  font-size: 0.8rem;
}

#cover-error.hidden {
  display: none;
}

#detail-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

#detail-form label {
  font-size: 0.8rem;
  color: #aaa;
  margin-top: 0.4rem;
}

#detail-form input,
#detail-form textarea {
  padding: 0.55rem 0.75rem;
  border: 1px solid #333;
  border-radius: 6px;
  background: #1a1a2e;
  color: #eee;
  font-size: 0.95rem;
  font-family: inherit;
}

#detail-form input:focus,
#detail-form textarea:focus {
  outline: none;
  border-color: #e94560;
}

#detail-form button {
  margin-top: 0.75rem;
  padding: 0.6rem;
  border: none;
  border-radius: 6px;
  background: #e94560;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

#detail-form button:hover {
  background: #c73650;
}

.game-item {
  cursor: pointer;
}

.has-details {
  border-left: 3px solid #e94560;
}

/* News / Articles */
#write-article-btn {
  width: 100%;
  padding: 0.6rem;
  border: none;
  border-radius: 6px;
  background: #e94560;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 1rem;
  transition: background 0.2s;
}

#write-article-btn:hover {
  background: #c73650;
}

#article-editor {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

#article-editor.hidden {
  display: none;
}

#article-title,
#article-author {
  padding: 0.6rem 0.8rem;
  border: 1px solid #333;
  border-radius: 6px;
  background: #16213e;
  color: #eee;
  font-size: 0.95rem;
}

#article-title:focus,
#article-author:focus,
#article-body:focus {
  outline: none;
  border-color: #e94560;
}

#article-body {
  padding: 0.6rem 0.8rem;
  border: 1px solid #333;
  border-radius: 6px;
  background: #16213e;
  color: #eee;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
}

#editor-actions {
  display: flex;
  gap: 0.5rem;
}

#publish-btn {
  flex: 1;
  padding: 0.6rem;
  border: none;
  border-radius: 6px;
  background: #e94560;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

#publish-btn:hover {
  background: #c73650;
}

.secondary-btn {
  flex: 1;
  padding: 0.6rem;
  border: 1px solid #333;
  border-radius: 6px;
  background: transparent;
  color: #aaa;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.secondary-btn:hover {
  border-color: #e94560;
  color: #e94560;
}

.article-card {
  background: #16213e;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: transform 0.15s;
}

.article-card:hover {
  transform: translateX(4px);
}

.article-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.article-card .article-meta {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 0.5rem;
}

.article-card .article-preview {
  font-size: 0.9rem;
  color: #aaa;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#no-articles {
  text-align: center;
  color: #555;
  margin-top: 2rem;
}

#no-articles.hidden {
  display: none;
}

/* Article Detail */
#article-detail {
  background: #16213e;
  border-radius: 8px;
  padding: 1.5rem;
}

#article-detail.hidden {
  display: none;
}

#back-to-list {
  background: none;
  border: none;
  color: #7ec8e3;
  font-size: 0.9rem;
  cursor: pointer;
  margin-bottom: 1rem;
  padding: 0;
  transition: color 0.2s;
}

#back-to-list:hover {
  color: #e94560;
}

#detail-article-title {
  font-size: 1.5rem;
  margin-bottom: 0.35rem;
}

#detail-article-meta {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 1.25rem;
}

#detail-article-body {
  font-size: 0.95rem;
  line-height: 1.7;
  color: #ccc;
  white-space: pre-wrap;
  margin-bottom: 1.5rem;
}

.delete-article {
  background: none;
  border: 1px solid #4a1a1a;
  border-radius: 6px;
  color: #e07070;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.delete-article:hover {
  background: #4a1a1a;
  color: #fff;
}

/* Shared content styles (Guides, Music) */
.content-input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid #333;
  border-radius: 6px;
  background: #16213e;
  color: #eee;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.content-input:focus,
.content-textarea:focus {
  outline: none;
  border-color: #e94560;
}

.content-textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid #333;
  border-radius: 6px;
  background: #16213e;
  color: #eee;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 0.5rem;
}

.editor-actions {
  display: flex;
  gap: 0.5rem;
}

.publish-btn {
  flex: 1;
  padding: 0.6rem;
  border: none;
  border-radius: 6px;
  background: #e94560;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.publish-btn:hover {
  background: #c73650;
}

.back-btn {
  background: none;
  border: none;
  color: #7ec8e3;
  font-size: 0.9rem;
  cursor: pointer;
  margin-bottom: 1rem;
  padding: 0;
  transition: color 0.2s;
}

.back-btn:hover {
  color: #e94560;
}

#write-guide-btn,
#add-music-btn {
  width: 100%;
  padding: 0.6rem;
  border: none;
  border-radius: 6px;
  background: #e94560;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 1rem;
  transition: background 0.2s;
}

#write-guide-btn:hover,
#add-music-btn:hover {
  background: #c73650;
}

#guide-editor.hidden {
  display: none;
}

#guide-editor {
  display: flex;
  flex-direction: column;
  margin-bottom: 1.5rem;
}

.guide-card {
  background: #16213e;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: transform 0.15s;
}

.guide-card:hover {
  transform: translateX(4px);
}

.guide-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.guide-card .guide-meta {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 0.5rem;
}

.guide-card .guide-game-tag {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  background: #0f3460;
  color: #7ec8e3;
  margin-bottom: 0.4rem;
}

.guide-card .guide-preview {
  font-size: 0.9rem;
  color: #aaa;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#guide-detail {
  background: #16213e;
  border-radius: 8px;
  padding: 1.5rem;
}

#guide-detail.hidden {
  display: none;
}

#detail-guide-title {
  font-size: 1.5rem;
  margin-bottom: 0.35rem;
}

#detail-guide-meta {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 1.25rem;
}

#detail-guide-body {
  font-size: 0.95rem;
  line-height: 1.7;
  color: #ccc;
  white-space: pre-wrap;
  margin-bottom: 1.5rem;
}

/* Music */
#music-form {
  margin-bottom: 1rem;
}

#music-list {
  list-style: none;
}

.music-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #16213e;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  transition: transform 0.15s;
}

.music-item:hover {
  transform: translateX(4px);
}

.music-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.music-title {
  font-weight: 600;
  font-size: 1rem;
}

.music-artist {
  font-size: 0.85rem;
  color: #888;
}

.music-game-tag {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
  background: #0f3460;
  color: #7ec8e3;
  margin-top: 0.2rem;
  width: fit-content;
}

.music-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.music-link {
  font-size: 0.8rem;
  color: #7ec8e3;
  text-decoration: none;
  padding: 0.2rem 0.6rem;
  border: 1px solid #333;
  border-radius: 4px;
  transition: all 0.2s;
}

.music-link:hover {
  border-color: #7ec8e3;
  background: #0f3460;
}

#no-guides.hidden,
#no-music.hidden {
  display: none;
}

#no-guides,
#no-music {
  text-align: center;
  color: #555;
  margin-top: 2rem;
}
\#auth-section {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

#auth-section .btn-primary,
#auth-section .btn-secondary {
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
}

/* Article/Guide Image Preview */
#article-image-preview, #guide-image-preview {
  max-width: 200px;
  border-radius: 8px;
  margin-bottom: 5px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Detail View Images */
#detail-article-image, #detail-guide-image {
  max-width: 100%;
  border-radius: 8px;
  margin-bottom: 1rem;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Card Images */
.article-card img, .guide-card img {
  float: left;
  margin-right: 15px;
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
}