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

:root {
  --bg: #0d1022;
  --panel: #171b33;
  --panel-2: #1e2342;
  --text: #eef1ff;
  --muted: #9aa5cc;
  --accent: #7aa8ff;
  --accent-2: #b07aff;
  --good: #35c05e;
  --bad: #e5484d;
}

body {
  font-family: 'Segoe UI', 'Trebuchet MS', sans-serif;
  background: radial-gradient(ellipse at top, #141936, var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
}

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

.container {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 20px 120px;
}

/* ---------- Header ---------- */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0;
}

.logo {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, #7aa8ff, #b07aff, #ff7ab8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.admin-link {
  color: var(--muted);
  font-size: 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 7px 14px;
  transition: color 0.15s, border-color 0.15s;
}

.admin-link:hover {
  color: var(--text);
  border-color: var(--accent);
}

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 30px 0 40px;
}

.hero h1 {
  font-size: clamp(32px, 6vw, 54px);
  margin-bottom: 10px;
}

.hero p {
  color: var(--muted);
  font-size: 18px;
}

/* ---------- Sections ---------- */
h2.section-title {
  font-size: 24px;
  margin: 34px 0 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---------- Games grid ---------- */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.game-card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.game-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
  border-color: rgba(255, 255, 255, 0.2);
}

.game-banner {
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 54px;
}

.game-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.game-body h3 {
  font-size: 19px;
  margin-bottom: 6px;
}

.game-body p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  flex: 1;
}

.play-btn {
  margin-top: 14px;
  display: inline-block;
  text-align: center;
  background: linear-gradient(135deg, #4a7dff, #8a4aff);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.6px;
  border-radius: 12px;
  padding: 10px 0;
  transition: filter 0.15s, transform 0.1s;
}

.play-btn:hover {
  filter: brightness(1.15);
  transform: scale(1.02);
}

/* ---------- Music ---------- */
.track-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.track {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 12px 16px;
  transition: border-color 0.15s, background 0.15s;
}

.track.playing {
  border-color: var(--accent);
  background: var(--panel-2);
}

.track-play {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #4a7dff, #8a4aff);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  transition: filter 0.15s, transform 0.1s;
}

.track-play:hover {
  filter: brightness(1.2);
  transform: scale(1.06);
}

.track-name {
  flex: 1;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-size {
  color: var(--muted);
  font-size: 13px;
  flex-shrink: 0;
}

.empty-note {
  color: var(--muted);
  background: var(--panel);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  padding: 22px;
  text-align: center;
}

/* ---------- Player bar ---------- */
#player-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(14, 17, 36, 0.97);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 50;
}

#player-bar.hidden {
  display: none;
}

#player-title {
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 30vw;
}

#player-bar audio {
  flex: 1;
  height: 38px;
}

/* ---------- Admin ---------- */
.admin-card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 24px;
}

.admin-card h2 {
  margin-bottom: 16px;
  font-size: 20px;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

input[type='text'],
input[type='password'],
input[type='color'],
input[type='file'],
textarea {
  background: var(--panel-2);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
}

input[type='text'],
input[type='password'] {
  flex: 1;
  min-width: 140px;
}

input[type='color'] {
  padding: 4px;
  width: 52px;
  height: 42px;
  cursor: pointer;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 60px;
}

button {
  font-family: inherit;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, #4a7dff, #8a4aff);
  color: #fff;
  transition: filter 0.15s;
}

.btn:hover {
  filter: brightness(1.15);
}

.btn.secondary {
  background: var(--panel-2);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn.danger {
  background: var(--bad);
}

.btn.small {
  padding: 6px 12px;
  font-size: 13px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 14.5px;
}

.admin-table th {
  color: var(--muted);
  font-weight: 600;
}

.admin-table td.actions {
  text-align: right;
  white-space: nowrap;
}

.admin-table td.actions .btn {
  margin-left: 6px;
}

.msg {
  margin-top: 10px;
  font-size: 14px;
  min-height: 18px;
}

.msg.ok {
  color: var(--good);
}

.msg.error {
  color: var(--bad);
}

footer {
  margin-top: 50px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  .container {
    padding: 0 16px calc(140px + env(safe-area-inset-bottom));
  }

  header {
    padding: 16px 0;
  }

  .logo {
    font-size: 22px;
  }

  .admin-link {
    padding: 10px 14px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .hero {
    padding: 12px 0 20px;
  }

  .games-grid {
    grid-template-columns: 1fr;
  }

  .play-btn {
    padding: 14px 0;
    font-size: 16px;
    min-height: 48px;
  }

  .track {
    padding: 14px 14px;
  }

  .track-play {
    width: 48px;
    height: 48px;
  }

  #player-bar {
    flex-wrap: wrap;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    gap: 8px 12px;
  }

  #player-title {
    max-width: 100%;
    width: 100%;
  }

  #player-bar audio {
    width: 100%;
    min-width: 0;
  }

  .admin-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .admin-table td.actions {
    white-space: nowrap;
  }

  .admin-table td.actions .btn {
    margin: 4px 0 4px 6px;
    min-height: 40px;
  }

  .btn {
    min-height: 44px;
    padding: 12px 18px;
  }

  input[type='text'],
  input[type='password'],
  textarea,
  input[type='file'] {
    font-size: 16px; /* avoids iOS zoom-on-focus */
  }
}
