@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Foundation */
  --bg: #090c10;
  --card: rgba(21, 27, 35, 0.7);
  --card-hover: rgba(30, 38, 48, 0.8);

  /* Accents */
  --accent: #58a6ff;
  --accent-glow: rgba(88, 166, 255, 0.4);
  --success: #238636;
  --success-glow: rgba(35, 134, 54, 0.4);
  --danger: #da3633;
  --warning: #d29922;

  /* Text */
  --text-main: #f0f6fc;
  --text-dim: #8b949e;
  --text-bright: #ffffff;

  /* Metrics */
  --nav-height: 75px;
  --appbar-height: 65px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;

  /* Effects */
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shine: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0) 100%);
  --shadow-main: 0 10px 40px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  font-family: 'Outfit', sans-serif;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  /* Refractive Background */
  background: radial-gradient(circle at 0% 0%, rgba(88, 166, 255, 0.1) 0%, transparent 40%),
    radial-gradient(circle at 100% 100%, rgba(35, 134, 54, 0.05) 0%, transparent 40%),
    var(--bg);
  line-height: 1.5;
}

/* Layout */
.wrap {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: calc(var(--nav-height) + 20px);
}

/* AppBar (Sleek Top Bar) */
.app-bar {
  height: var(--appbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(9, 12, 16, 0.7);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--glass-border);
}

.logo {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 1px;
  background: linear-gradient(90deg, #fff, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.profile-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.05);
  padding: 6px 14px 6px 6px;
  border-radius: 30px;
  border: 1px solid var(--glass-border);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 0.65rem;
  font-weight: 800;
}

.admin-badge {
  background: rgba(218, 54, 51, 0.2);
  color: #ff7b72;
  border: 1px solid rgba(218, 54, 51, 0.35);
}

.profile-pill:active {
  transform: scale(0.95);
  background: rgba(255, 255, 255, 0.1);
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #1f6feb);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  box-shadow: 0 0 15px var(--accent-glow);
}

.username {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-bright);
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 15px;
  left: 20px;
  right: 20px;
  height: var(--nav-height);
  background: rgba(21, 27, 35, 0.85);
  backdrop-filter: blur(25px) saturate(150%);
  border-radius: 28px;
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 10px;
  box-shadow: var(--shadow-main);
  z-index: 1000;
}

.nav-item {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
  padding: 10px;
  color: var(--text-dim);
  transition: all 0.3s ease;
  cursor: pointer;
}

.nav-item i {
  font-size: 1.5rem;
  transition: transform 0.3s ease;
}

.nav-item.active {
  color: var(--accent);
}

.nav-item.active i {
  transform: translateY(-3px);
  text-shadow: 0 0 20px var(--accent-glow);
}

.nav-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0;
  transform: translateY(5px);
  transition: all 0.3s ease;
}

.nav-item.active .nav-label {
  opacity: 1;
  transform: translateY(0);
}

/* Bento Grid & Content */
.content {
  flex: 1;
  padding: 25px 20px;
}

.screen {
  animation: screenEnter 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes screenEnter {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.hero-card {
  background: linear-gradient(135deg, rgba(88, 166, 255, 0.15) 0%, rgba(31, 111, 235, 0.05) 100%);
  border-radius: var(--radius-lg);
  padding: 30px;
  border: 1px solid var(--accent);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), inset 0 0 40px rgba(88, 166, 255, 0.1);
  margin-bottom: 30px;
  position: relative;
  overflow: hidden;
}

.hero-card::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.03) 0%, transparent 50%);
  pointer-events: none;
}

.btn-launch {
  width: 100%;
  background: var(--text-bright);
  color: var(--bg);
  border: none;
  padding: 18px;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: 0 10px 25px rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-launch:active {
  transform: scale(0.97);
  filter: brightness(0.9);
}

/* List Sections */
.section-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding: 0 5px;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-bright);
}

.badge-count {
  background: var(--accent);
  color: white;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 800;
}

.glass-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.glass-card {
  background: var(--card);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-md);
  padding: 20px;
  border: 1px solid var(--glass-border);
  margin-bottom: 15px;
}

.placeholder-text {
  color: var(--text-dim);
  text-align: center;
  padding: 16px 10px;
  margin: 0;
}

.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
}

.spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.btn-primary {
  cursor: pointer;
}

.round-mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.round-mode-btn {
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  padding: 10px 8px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
}

.round-mode-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(88, 166, 255, 0.15);
}

.round-seat-row {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) minmax(90px, 120px) auto;
  gap: 10px;
  align-items: center;
}

.round-seat-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.round-digu-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: #ffd700;
}

.round-entry-controls {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto auto;
  gap: 6px;
  align-items: center;
}

.round-sign-btn {
  width: 34px;
  height: 34px;
}

.round-score-input {
  width: 100%;
  min-width: 96px;
  height: 40px;
  font-size: 1rem;
  font-weight: 800;
}

.round-digu-btn {
  width: 34px;
  height: 34px;
  color: var(--text-dim);
}

.round-calc-btn {
  width: 34px;
  height: 34px;
  color: var(--accent);
}

.round-score-preview {
  grid-column: 1 / -1;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.round-action-btn {
  padding: 10px 12px !important;
  font-size: 0.92rem !important;
  border-radius: 14px !important;
}

.score-counter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.score-counter-result {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.score-stepper {
  display: grid;
  grid-template-columns: repeat(4, 36px) 72px repeat(4, 36px);
  gap: 4px;
  align-items: center;
}

.step-btn {
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  font-weight: 700;
  cursor: pointer;
}

.step-btn:active {
  transform: scale(0.96);
  border-color: var(--accent);
}

.base-input {
  height: 36px;
  text-align: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  color: var(--text-main);
  font-weight: 700;
  width: 72px;
}

.card-token-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.card-token-btn {
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.game-card {
  background: var(--card);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-md);
  padding: 20px;
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.game-card:active {
  border-color: var(--accent);
  background: var(--card-hover);
}

.card-main .title {
  display: block;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-bright);
  margin-bottom: 4px;
}

.card-main .meta {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 500;
}

.status-pill {
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.status-pill.active {
  background: rgba(35, 134, 54, 0.2);
  color: #3fb950;
  border: 1px solid rgba(63, 185, 80, 0.3);
}

.status-pill.finished {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
}

/* Modals Modern */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(15px);
  display: flex;
  align-items: flex-end;
  z-index: 7000;
}

.modal-content {
  width: 100%;
  background: var(--bg);
  border-top: 1px solid var(--glass-border);
  border-radius: 35px 35px 0 0;
  padding: 30px 25px;
  padding-bottom: calc(30px + env(safe-area-inset-bottom));
  animation: slideUp 0.4s cubic-bezier(0.1, 0.9, 0.2, 1);
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

.form-group {
  margin-bottom: 25px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

input[type="text"] {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  color: var(--text-bright);
  font-size: 1rem;
  outline: none;
  transition: all 0.2s ease;
}

input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
}

/* Profile Styles */
.profile-hero {
  text-align: center;
  padding: 40px 0;
}

.avatar-large {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #1f6feb);
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 800;
  box-shadow: 0 15px 40px var(--accent-glow);
}

/* Dynamic Management */
.seat-setup-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
}

.seat-input-group {
  flex: 1;
}

.reorder-btns {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.btn-reorder {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-dim);
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.7rem;
}

.btn-reorder:active {
  color: var(--accent);
  border-color: var(--accent);
}

.copy-id-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(88, 166, 255, 0.1);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 6px 14px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.copy-id-btn:active {
  background: var(--accent);
  color: white;
}

.btn-swap {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--glass-border);
  color: var(--text-dim);
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.8rem;
}

.btn-swap:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.handle-found-badge {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--success);
  color: white;
  font-size: 0.6rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 800;
  pointer-events: none;
}

/* Utilities */
.hidden {
  display: none !important;
}

.text-accent {
  color: var(--accent);
}

.badge-admin {
  background: var(--danger);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.6rem;
  font-weight: 800;
}
