/* ============================================================
   Allreview – Dark Theme Design System
   Mobile-first responsive, dopamine-burst UI
   ============================================================ */

/* === Reset & Variables === */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Core Palette */
  --bg-primary: #05050A;
  /* Deeper black for ultra-premium dark mode */
  --bg-secondary: #0C0D14;
  --bg-card: #131420;
  --bg-glass: rgba(19, 20, 32, 0.65);
  --glass-border: rgba(255, 255, 255, 0.05);

  --text-primary: #F8F9FA;
  --text-secondary: #A1A1AA;
  --text-muted: #52525B;

  --accent-fire: #FF3B30;
  --accent-orange: #FF9500;
  --accent-gold: #FFCC00;
  --accent-cyan: #32ADE6;
  --accent-purple: #AF52DE;
  --accent-green: #34C759;

  /* Gradients */
  --grad-fire: linear-gradient(135deg, #FF3B30, #FF9500);
  --grad-neon: linear-gradient(135deg, #AF52DE, #32ADE6);
  --grad-gold: linear-gradient(135deg, #FFCC00, #FF9500);
  --grad-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01));

  /* Shadows */
  --shadow-glow: 0 0 40px rgba(255, 59, 48, 0.35);
  --shadow-card: 0 16px 40px rgba(0, 0, 0, 0.6);
  --shadow-neon: 0 0 30px rgba(175, 82, 222, 0.4);

  /* Typography */
  --font-main: 'Inter', 'Noto Sans KR', system-ui, -apple-system, sans-serif;

  /* Spacing */
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-full: 999px;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

button {
  cursor: pointer;
  border: none;
  font-family: inherit;
}

input,
select,
textarea {
  font-family: inherit;
}

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

/* === Screens === */
.screen {
  display: none;
  min-height: 100dvh;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* ============================================================
   SPLASH SCREEN
   ============================================================ */
#splash-screen {
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #1a1a2e 0%, #0a0a0f 70%);
}

.splash-content {
  text-align: center;
  animation: fadeInUp 0.8s ease-out;
}

.logo-glow {
  margin-bottom: 3rem;
}

.logo {
  font-size: 3rem;
  font-weight: 900;
  background: var(--grad-fire);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 20px rgba(255, 77, 77, 0.5));
  animation: pulse-glow 2s ease-in-out infinite;
}

.tagline {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  letter-spacing: 0.1em;
}

.loader {
  width: 200px;
  height: 4px;
  background: var(--bg-card);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 0 auto;
}

.loader-bar {
  width: 0%;
  height: 100%;
  background: var(--grad-fire);
  border-radius: var(--radius-full);
  animation: load-fill 2s ease-in-out forwards;
}

/* ============================================================
   ONBOARDING SCREEN
   ============================================================ */
#onboarding-screen {
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: radial-gradient(ellipse at top, #1a1a2e 0%, #0a0a0f 70%);
}

.onboard-card {
  width: 100%;
  max-width: 420px;
  text-align: center;
  animation: fadeInUp 0.6s ease-out;
}

.onboard-card h2 {
  font-size: 1.6rem;
  font-weight: 900;
  margin-bottom: 0.5rem;
}

.hint {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.country-select-wrapper,
.nickname-wrapper {
  margin-bottom: 1.2rem;
}

.select-input,
.text-input {
  width: 100%;
  padding: 0.9rem 1.2rem;
  font-size: 1rem;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.select-input:focus,
.text-input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
}

.select-input option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
  width: 100%;
  padding: 1.2rem 2.5rem;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #fff;
  background: var(--grad-neon);
  border-radius: var(--radius-md);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 4px 15px rgba(175, 82, 222, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.02);
  box-shadow: var(--shadow-neon);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-primary:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.btn-fire {
  padding: 1rem 2.2rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  background: var(--grad-fire);
  border-radius: var(--radius-full);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 4px 15px rgba(255, 59, 48, 0.3);
  animation: fire-pulse 3s ease-in-out infinite;
}

.btn-fire:hover {
  transform: scale(1.06) translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.btn-fire:active {
  transform: scale(0.98);
}

.btn-ghost {
  width: 100%;
  padding: 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.btn-ghost:hover {
  color: var(--text-primary);
  border-color: var(--accent-cyan);
  background: rgba(50, 173, 230, 0.05);
}

.icon-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: rotate(5deg) scale(1.05);
}

/* ============================================================
   GLASS CARD
   ============================================================ */
.glass-card {
  background: var(--grad-glass);
  background-color: var(--bg-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-card);
}

/* ============================================================
   KEYWORD BOARD
   ============================================================ */
.board-header {
  text-align: center;
  margin-bottom: 2rem;
}

.highlight-text {
  color: var(--accent-cyan);
  font-weight: 800;
  font-size: 1.1rem;
}

.board-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.board-actions {
  display: flex;
  justify-content: flex-end;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* ============================================================
   GLASS CARD
   ============================================================ */
.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-card);
}

/* ============================================================
   TOP BAR
   ============================================================ */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.2rem;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.brand {
  font-size: 1.2rem;
  font-weight: 900;
  background: var(--grad-fire);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.user-badge {
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 0.3rem 0.8rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-full);
}

/* ============================================================
   TAB NAVIGATION
   ============================================================ */
.tab-nav {
  display: flex;
  gap: 4px;
  padding: 0.5rem 1rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.tab-btn {
  flex: 1;
  padding: 0.7rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background 0.2s;
}

.tab-btn.active {
  color: var(--text-primary);
  background: var(--bg-card);
}

.tab-panel {
  display: none;
  padding: 1rem;
  flex: 1;
}

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

/* ============================================================
   KEYWORD BAR
   ============================================================ */
.keyword-bar {
  margin-bottom: 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.keyword-bar::-webkit-scrollbar {
  display: none;
}

.keyword-scroll {
  display: flex;
  gap: 0.5rem;
  padding: 0.25rem 0;
}

.keyword-chip {
  flex-shrink: 0;
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.keyword-chip:hover {
  border-color: var(--accent-purple);
  color: var(--text-primary);
}

.keyword-chip.active {
  background: var(--grad-neon);
  color: #fff;
  border-color: transparent;
}

/* ============================================================
   ARENA – 1v1 MATCH
   ============================================================ */
.arena {
  text-align: center;
}

.round-badge {
  display: inline-block;
  padding: 0.4rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-gold);
  background: rgba(255, 215, 0, 0.1);
  border: 1px solid rgba(255, 215, 0, 0.25);
  border-radius: var(--radius-full);
  margin-bottom: 1rem;
  animation: badge-glow 2s ease-in-out infinite;
}

.match-container {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}

.contender {
  flex: 1;
  cursor: pointer;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid transparent;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
}

.contender:hover {
  transform: scale(1.03);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.25);
}

.contender:active {
  transform: scale(0.98);
}

.contender.winner-flash {
  border-color: var(--accent-gold);
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.4);
  animation: winner-pop 0.5s ease-out;
}

.contender.loser-fade {
  opacity: 0.3;
  filter: grayscale(1);
  transform: scale(0.95);
}

.img-frame {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--bg-secondary);
}

.img-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.contender:hover .img-frame img {
  transform: scale(1.08);
}

.contender-info {
  padding: 0.6rem 0.5rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  justify-content: center;
}

.vs-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
}

.vs-badge span {
  font-size: 1.1rem;
  font-weight: 900;
  background: var(--grad-fire);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Progress */
.progress-bar-wrap {
  height: 4px;
  background: var(--bg-card);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 0 auto 0.4rem;
  max-width: 300px;
}

.progress-fill {
  height: 100%;
  background: var(--grad-neon);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
  width: 0%;
}

.progress-text {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Upload CTA */
.upload-cta {
  text-align: center;
  padding: 1.2rem 0;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
}

.empty-state p:first-child {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}

/* ============================================================
   HALL OF FAME
   ============================================================ */
.section-title {
  font-size: 1.3rem;
  font-weight: 900;
  margin-bottom: 1.2rem;
}

.hall-list {
  display: grid;
  gap: 1rem;
}

.hall-card {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  align-items: center;
  transition: border-color 0.2s;
}

.hall-card:hover {
  border-color: var(--accent-gold);
}

.hall-thumb {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.hall-info {
  flex: 1;
  min-width: 0;
}

.hall-keyword {
  font-size: 0.78rem;
  color: var(--accent-cyan);
  margin-bottom: 0.2rem;
}

.hall-uploader {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.hall-wins {
  font-size: 0.82rem;
  color: var(--accent-gold);
}

/* ============================================================
   MODAL OVERLAY
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.3s ease;
}

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

.modal-content {
  width: 100%;
  max-width: 500px;
  max-height: 90dvh;
  overflow-y: auto;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Winner Modal */
.winner-title {
  font-size: 1.8rem;
  font-weight: 900;
  text-align: center;
  margin-bottom: 1rem;
  background: var(--grad-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.winner-image-wrap {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 0.8rem;
}

.winner-image-wrap img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
}

.win-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 0.3rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-full);
  color: var(--accent-gold);
}

.winner-uploader {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

/* Review Section */
.review-section {
  margin-bottom: 1.5rem;
}

.review-section h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.8rem;
}

.review-textarea {
  width: 100%;
  min-height: 80px;
  padding: 0.9rem;
  font-size: 0.95rem;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  resize: vertical;
  margin-bottom: 0.8rem;
  outline: none;
  transition: border-color 0.3s;
}

.review-textarea:focus {
  border-color: var(--accent-fire);
}

/* Review List */
.best-reviews {
  margin-bottom: 1.5rem;
}

.best-reviews h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.8rem;
}

.review-list {
  display: grid;
  gap: 0.7rem;
}

.review-card {
  padding: 0.8rem 1rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-fire);
}

.review-card.best {
  border-left-color: var(--accent-gold);
  background: rgba(255, 215, 0, 0.06);
}

.review-text {
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.review-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.reaction-bar {
  display: flex;
  gap: 0.5rem;
}

.reaction-btn {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  transition: all 0.2s;
}

.reaction-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  transform: scale(1.08);
}

.reaction-btn.spicy:hover {
  color: var(--accent-fire);
}

.reaction-btn.cider:hover {
  color: var(--accent-cyan);
}

.reaction-btn.angry:hover {
  color: var(--accent-orange);
}

/* Upload Modal */
.upload-modal-inner {
  text-align: center;
}

.upload-preview-wrap {
  margin: 1rem 0;
}

.upload-dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 160px;
  border: 2px dashed rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.95rem;
  transition: border-color 0.2s, color 0.2s;
}

.upload-dropzone:hover {
  border-color: var(--accent-purple);
  color: var(--text-primary);
}

.upload-preview-wrap img {
  max-height: 200px;
  border-radius: var(--radius-md);
  margin: 0 auto;
}

/* ============================================================
   CONFETTI (CSS-only)
   ============================================================ */
.confetti-burst {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: confetti-fall 1.5s ease-out forwards;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

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

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

  to {
    transform: translateY(0);
  }
}

@keyframes load-fill {
  0% {
    width: 0%;
  }

  50% {
    width: 70%;
  }

  100% {
    width: 100%;
  }
}

@keyframes pulse-glow {

  0%,
  100% {
    filter: drop-shadow(0 0 20px rgba(255, 77, 77, 0.5));
  }

  50% {
    filter: drop-shadow(0 0 40px rgba(255, 140, 0, 0.7));
  }
}

@keyframes badge-glow {

  0%,
  100% {
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.2);
  }

  50% {
    box-shadow: 0 0 18px rgba(255, 215, 0, 0.4);
  }
}

@keyframes fire-pulse {

  0%,
  100% {
    box-shadow: 0 0 10px rgba(255, 77, 77, 0.3);
  }

  50% {
    box-shadow: 0 0 25px rgba(255, 77, 77, 0.5);
  }
}

@keyframes winner-pop {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.08);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes confetti-fall {
  0% {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg);
  }

  100% {
    opacity: 0;
    transform: translate(var(--x), 200px) rotate(720deg);
  }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (min-width: 640px) {
  .logo {
    font-size: 4rem;
  }

  .onboard-card {
    padding: 3rem;
  }

  .match-container {
    gap: 1rem;
  }

  .modal-content {
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
  }
}

@media (min-width: 1024px) {
  .tab-panel {
    padding: 2rem 3rem;
  }

  .match-container {
    max-width: 680px;
    margin: 0 auto 1.2rem;
  }

  .hall-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* === Scrollbar === */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 0.8rem 1.5rem;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 2000;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}