/* maipad Portal - Common Styles */

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

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-card: #21262d;
  --border-color: #30363d;
  --text-primary: #c9d1d9;
  --text-secondary: #8b949e;
  --accent-blue: #58a6ff;
  --accent-purple: #a371f7;
  --accent-pink: #f778ba;
  --accent-green: #3fb950;
  --accent-yellow: #d29922;
  --accent-orange: #db6d28;
}

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
}

/* Header */
.header {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, #1a1f29 100%);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(45deg, var(--accent-pink), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.last-updated {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-btn {
  display: inline-block;
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  color: white;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: opacity 0.2s, transform 0.2s;
}

.header-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* Hero (Home page) */
.hero {
  text-align: center;
  padding: 80px 24px;
}

.hero .logo {
  font-size: 3.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent-pink), var(--accent-purple), var(--accent-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {

  0%,
  100% {
    filter: brightness(1);
  }

  50% {
    filter: brightness(1.2);
  }
}

.tagline {
  font-size: 1.2rem;
  color: var(--text-secondary);
}

/* Cards Container (Home page) */
.cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

.portal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 32px 24px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.portal-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  transition: height 0.3s ease;
}

.portal-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  border-color: transparent;
}

.card-portal::before {
  background: linear-gradient(90deg, var(--accent-pink), var(--accent-purple));
}

.card-admin::before {
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-green));
}

.card-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  display: block;
}

.card-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.card-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.card-arrow {
  position: absolute;
  bottom: 24px;
  right: 24px;
  font-size: 1.5rem;
  opacity: 0;
  transform: translateX(-10px);
  transition: all 0.3s ease;
}

.portal-card:hover .card-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* Tabs */
.tabs {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  flex-wrap: wrap;
}

.tab-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s;
  font-family: inherit;
}

.tab-btn:hover {
  border-color: var(--accent-blue);
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: white;
}

/* Main Content */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Score Cards */
.scores-grid {
  display: flex;
  flex-direction: column;
}

/* Filter UI */
.score-filters {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.filter-row input[type="text"] {
  flex: 1;
  min-width: 200px;
  padding: 10px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.95rem;
}

.filter-row input[type="text"]:focus {
  outline: none;
  border-color: var(--accent-blue);
}

.filter-row select {
  padding: 10px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.95rem;
  cursor: pointer;
  min-width: 140px;
}

.filter-row select:focus {
  outline: none;
  border-color: var(--accent-blue);
}

.filter-clear {
  padding: 10px 16px;
  background: var(--accent-pink);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: opacity 0.2s;
}

.filter-clear:hover {
  opacity: 0.8;
}

@media (max-width: 600px) {
  .filter-row {
    flex-direction: column;
  }

  .filter-row input[type="text"],
  .filter-row select {
    width: 100%;
  }
}

.score-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.score-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}


.score-image {
  width: 100%;
  height: 80px;
  overflow: hidden;
}

.score-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.score-content {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.score-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.score-date {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.score-level {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
}

.score-song {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.4;
}

.score-creator {
  font-size: 0.9rem;
  color: var(--accent-blue);
  margin-bottom: 8px;
}

.score-difficulty {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.score-comment {
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.score-link {
  display: inline-block;
  background: var(--accent-green);
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  transition: opacity 0.2s;
}

.score-link:hover {
  opacity: 0.8;
}

/* Pagination */
.pagination-info {
  display: block;
  width: 100%;
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.scores-grid-inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
  padding: 16px 0;
}

.page-btn {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  border: none;
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.2s;
}

.page-btn:hover {
  opacity: 0.8;
}

.page-info {
  font-weight: 600;
  color: var(--text-primary);
}

/* Rankings */
.rankings-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.ranking-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
}

.ranking-section.full-width {
  grid-column: 1 / -1;
  max-width: 500px;
}

.ranking-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.ranking-list {
  list-style: none;
}

.ranking-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.ranking-item:last-child {
  border-bottom: none;
}

.rank-number {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.9rem;
  margin-right: 12px;
}

.rank-1 {
  background: linear-gradient(135deg, #ffd700, #ffaa00);
  color: #333;
}

.rank-2 {
  background: linear-gradient(135deg, #c0c0c0, #a0a0a0);
  color: #333;
}

.rank-3 {
  background: linear-gradient(135deg, #cd7f32, #b87333);
  color: white;
}

.rank-other {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.rank-name {
  flex: 1;
  font-weight: 500;
}

.rank-points {
  font-weight: 700;
  color: var(--accent-yellow);
}

/* Challenge Track */
.ct-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ct-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 16px;
  align-items: center;
}

.ct-card.has-image {
  grid-template-columns: 80px 80px 1fr auto;
}

.ct-image {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.ct-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 600px) {
  .ct-card {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .ct-card.has-image {
    grid-template-columns: 1fr;
  }

  .ct-image {
    width: 120px;
    height: 120px;
    margin: 0 auto 12px;
  }
}

.ct-date {
  text-align: center;
}

.ct-date-day {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-pink);
}

.ct-date-dow {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.ct-info h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.ct-info p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.ct-level {
  background: linear-gradient(135deg, var(--accent-orange), var(--accent-yellow));
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1.1rem;
}

.ct-life {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--accent-green);
}

.ct-rankers {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.ct-rankers span {
  color: var(--accent-blue);
}

.ct-download {
  display: inline-block;
  margin-top: 10px;
  background: var(--accent-green);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  transition: opacity 0.2s;
}

.ct-download:hover {
  opacity: 0.8;
}

/* Footer */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 16px;
  text-align: center;
}

.refresh-btn {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  border: none;
  color: white;
  padding: 10px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  margin-bottom: 12px;
  font-family: inherit;
  transition: opacity 0.2s;
}

.refresh-btn:hover {
  opacity: 0.8;
}

.refresh-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.copyright {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.version {
  margin-top: 8px;
  font-size: 0.75rem;
  opacity: 0.6;
}

/* Loading */
.loading {
  text-align: center;
  padding: 60px 20px;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-color);
  border-top-color: var(--accent-pink);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

/* Particles (Home page) */
.particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: -1;
}

.particle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--accent-purple);
  border-radius: 50%;
  opacity: 0.3;
  animation: float 15s infinite;
}

.particle:nth-child(1) {
  left: 10%;
  animation-delay: 0s;
  animation-duration: 20s;
}

.particle:nth-child(2) {
  left: 20%;
  animation-delay: 2s;
  animation-duration: 18s;
  background: var(--accent-pink);
}

.particle:nth-child(3) {
  left: 30%;
  animation-delay: 4s;
  animation-duration: 22s;
}

.particle:nth-child(4) {
  left: 40%;
  animation-delay: 1s;
  animation-duration: 16s;
  background: var(--accent-blue);
}

.particle:nth-child(5) {
  left: 50%;
  animation-delay: 3s;
  animation-duration: 19s;
}

.particle:nth-child(6) {
  left: 60%;
  animation-delay: 5s;
  animation-duration: 21s;
  background: var(--accent-pink);
}

.particle:nth-child(7) {
  left: 70%;
  animation-delay: 2s;
  animation-duration: 17s;
}

.particle:nth-child(8) {
  left: 80%;
  animation-delay: 4s;
  animation-duration: 23s;
  background: var(--accent-blue);
}

.particle:nth-child(9) {
  left: 90%;
  animation-delay: 1s;
  animation-duration: 18s;
}

@keyframes float {
  0% {
    transform: translateY(100vh) rotate(0deg);
    opacity: 0;
  }

  10% {
    opacity: 0.3;
  }

  90% {
    opacity: 0.3;
  }

  100% {
    transform: translateY(-100vh) rotate(720deg);
    opacity: 0;
  }
}

/* Season Selector */
.season-selector {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.season-selector label {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.season-selector select {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s;
}

.season-selector select:hover {
  border-color: var(--accent-blue);
}

.season-selector select:focus {
  outline: none;
  border-color: var(--accent-purple);
}