:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary-color: #64748b;
  --background-color: #f8fafc;
  --surface-color: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  
  /* Font Size Scale */
  --font-xs: 0.75rem;    /* 12px */
  --font-sm: 0.875rem;    /* 14px */
  --font-base: 1rem;      /* 16px */
  --font-lg: 1.125rem;   /* 18px */
  --font-xl: 1.25rem;    /* 20px */
  --font-2xl: 1.5rem;    /* 24px */
  --font-3xl: 1.875rem;  /* 30px */
  --font-4xl: 2.25rem;   /* 36px */
  --font-5xl: 3rem;      /* 48px */
  
  /* Crossword-specific font sizes (scaled for crossword interface) */
  --crossword-font-xs: 0.5em;
  --crossword-font-sm: 0.75em;
  --crossword-font-base: 1em;
  --crossword-font-lg: 1.25em;
  --crossword-font-xl: 1.5em;
  --crossword-font-2xl: 2em;
  --crossword-font-3xl: 2.5em;
  --crossword-font-4xl: 3em;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  background-color: var(--background-color);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: var(--font-base);
}

#crossword {
  display: flex;
  flex-wrap: wrap;
  padding: min(0.5vw, 3px);
  gap: 1em;
  font-size: min(1vw, 6px);
}

#input {
  position: absolute;

  height: 1px;
  width: 1px;

  z-index: 0;

  caret-color: transparent;
}

#grid-container {
  width: min(99vw, 800px);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

#crossword-grid {
  display: flex;
  flex-direction: column;
}

#grid {
  position: relative;
  max-height: 800px;
  border-left: 1px solid var(--text-primary);
  border-top: 1px solid var(--text-primary);
  background-color: var(--text-primary);
  font-size: var(--crossword-font-4xl);
}

#header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-sm);
  border-bottom: 1px solid var(--border-color);
  gap: var(--spacing-sm);
}

#home-button, #info-button {
  font-size: 6em;
  color: var(--primary-color);
  cursor: pointer;
  padding: var(--spacing-sm);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease-in-out;
  text-decoration: none;
}

#header i:hover {
  background-color: var(--primary-color);
  color: white;
  transform: scale(1.1);
}

#info-button.active {
  background-color: var(--primary-color);
  color: white;
  transform: scale(1.1);
}

#info-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--surface-color);
  border-left: 1px solid var(--text-primary);
  border-top: 1px solid var(--text-primary);
  border-right: 1px solid var(--text-primary);
  border-bottom: 1px solid var(--text-primary);
  padding: var(--spacing-lg);
  aspect-ratio : 1 / 1;
}

.info-panel-content {
  max-width: 600px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xl);
}

.info-title {
  font-size: var(--crossword-font-4xl);
  color: var(--primary-color);
  text-align: center;
  margin-bottom: var(--spacing-xl);
  font-weight: 600;
}

.info-details {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-md);
  background-color: var(--background-color);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.info-label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: var(--crossword-font-xl);
}

.info-value {
  color: var(--text-secondary);
  font-size: var(--crossword-font-xl);
}

.info-link {
  color: var(--primary-color);
  text-decoration: none;
  font-size: var(--crossword-font-xl);
}

.info-link:hover {
  text-decoration: underline;
}

.info-section-title {
  font-size: var(--crossword-font-lg);
  color: var(--primary-color);
  margin: var(--spacing-lg) 0 var(--spacing-md) 0;
  font-weight: 600;
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: var(--spacing-xs);
}

.instructions {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
}

.instruction-item {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-xs);
  margin: 0;
}

.instruction-label {
  color: var(--primary-color);
  font-weight: bold;
  flex-shrink: 0;
}

.instruction-text {
  color: var(--text-primary);
  font-size: var(--crossword-font-xl);
  line-height: 1.4;
}

.team-buttons {
  display: flex;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.team-button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-sm);
  font-size: var(--crossword-font-xl);
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.team-button:hover {
  background-color: var(--text-primary);
  transform: translateY(-1px);
}

.share-section {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
  width: 100%;
}

.share-input {
  flex: 1;
  padding: var(--spacing-sm);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: var(--crossword-font-xl);
  background-color: var(--background-color);
  color: var(--text-primary);
}

.copy-button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-sm);
  font-size: var(--crossword-font-xl);
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  white-space: nowrap;
}

.copy-button:hover {
  background-color: var(--text-primary);
  transform: translateY(-1px);
}

.info-compact {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
}

.info-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.info-compact-label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: var(--crossword-font-xl);
}

.info-compact-value {
  color: var(--text-secondary);
  font-size: var(--crossword-font-xl);
  margin-right: var(--spacing-md);
}

#current-clue,
#current-clue-duplicate {
  position: sticky;
  top: 0;
  width: fit-content;
  align-self: center;
  z-index: 2;
  background-color: var(--surface-color);
  text-align: center;
  font-size: var(--crossword-font-4xl);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: var(--spacing-sm);
}

.cell {
  aspect-ratio: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--text-primary);
  border-bottom: 1px solid var(--text-primary);
}

.white {
  background-color: var(--surface-color);
}

.black {
  background-color: var(--text-primary);
}

.cell-number {
  position: absolute;
  font-size: var(--crossword-font-xs);
  top: 0;
  left: 0.1em;
}

.cell-selected {
  outline: 3px solid var(--primary-color);
  outline-offset: -1px;
  z-index: 1;
  background-color: #eff6ff !important;
}

.cell-highlighted {
  background-color: #fef3c7 !important;
}



#clues {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
  font-size: var(--crossword-font-3xl);
  max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    padding: var(--spacing-sm);
}


.clue-title {
  color: var(--primary-color);
  font-weight: 600;
  font-size: var(--crossword-font-lg);
  margin-bottom: var(--spacing-sm);
  padding-bottom: var(--spacing-xs);
  border-bottom: 2px solid var(--border-color);
}

.clue {
  display: flex;
  padding: var(--spacing-sm);
  gap: var(--spacing-sm);
  font-size: var(--crossword-font-xl);
  border-radius: var(--radius-sm);
}

#clue-selected {
  background-color: #fef3c7;
  outline: 1px solid #f59e0b;
}

.clue-filled {
  text-decoration: line-through;
  opacity: 0.6;
}

.clue-number {
  width: 1em;
  text-align: right;
  color: var(--secondary-color);
  font-weight: 600;
  flex-shrink: 0;
}

.buttons {
  display: flex;
  justify-content: center;
  gap: var(--spacing-md);
  flex-wrap: wrap;
}

@keyframes slideInFromRight {
  0% {
    background-position: left bottom;
  }
  100% {
    background-position: right bottom;
  }
}

.button {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-align: center;
  justify-content: center;
  font-size: var(--crossword-font-4xl);
  color: white;
  padding: var(--spacing-sm) var(--spacing-md);
  min-width: 6em;
  height: 2.5em;
}

.button:hover {
  box-shadow: var(--shadow-md);
}

#info {
  text-align: center;
  gap: var(--spacing-sm);
  font-size: var(--crossword-font-3xl);
  color: var(--text-secondary);
  padding: var(--spacing-sm);
  background-color: var(--surface-color);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

#instructions {
  text-align: center;
  gap: var(--spacing-sm);
  font-size: var(--crossword-font-3xl);
  color: var(--text-secondary);
  padding: var(--spacing-sm);
  background-color: var(--surface-color);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.home-icon {
  cursor: pointer;
  color: var(--primary-color);
  margin-right: var(--spacing-sm);
  transition: color 0.2s ease-in-out;
}

.home-icon:hover {
  color: var(--text-primary);
}

.home-icon {
  font-size: var(--crossword-font-sm);
  font-size: var(--font-sm);
}

#username {
  text-align: center;
  font-size: var(--font-2xl);
  color: #696969;
  margin-bottom: 0.5em;
}

/* Home Page Styles */
.home-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-xl);
}

.home-header {
  text-align: center;
  margin-bottom: var(--spacing-2xl);
}

.home-title {
  font-size: var(--font-5xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--spacing-sm);
  letter-spacing: -0.025em;
}

.home-subtitle {
  font-size: var(--font-lg);
  color: var(--text-secondary);
  font-weight: 400;
}

#crosswords {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--spacing-xl);
  margin-top: var(--spacing-xl);
}

.series {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease-in-out;
}

.series:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.header {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-md);
  border-bottom: 2px solid var(--border-color);
}

.header h2 {
  font-size: var(--font-2xl);
  font-weight: 600;
  color: var(--primary-color);
  margin: 0;
  text-transform: capitalize;
}

.links {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  max-height: 400px;
  overflow-y: auto;
  padding-right: var(--spacing-xs);
}

.links::-webkit-scrollbar {
  width: 6px;
}

.links::-webkit-scrollbar-track {
  background: var(--background-color);
  border-radius: var(--radius-sm);
}

.links::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-sm);
}

.links::-webkit-scrollbar-thumb:hover {
  background: var(--secondary-color);
}

.link {
  transition: all 0.15s ease-in-out;
}

.link a {
  display: block;
  padding: var(--spacing-md);
  text-decoration: none;
  color: var(--text-primary);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: all 0.15s ease-in-out;
  font-weight: 500;
  font-size: var(--font-base);
}

.link a:hover {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  transform: translateX(4px);
}

/* Skeleton Loading Styles */
.skeleton {
  background: linear-gradient(90deg, var(--border-color) 25%, #f1f5f9 50%, var(--border-color) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-text {
  height: 1em;
  margin-bottom: var(--spacing-sm);
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-text.medium {
  width: 80%;
}

.skeleton-text.long {
  width: 100%;
}

.skeleton-title {
  height: 1.5em;
  width: 70%;
  margin-bottom: var(--spacing-md);
}

.skeleton-subtitle {
  height: 1.125em;
  width: 50%;
  margin-bottom: var(--spacing-lg);
}

.skeleton-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
}

.skeleton-series-header {
  height: 1.5em;
  width: 40%;
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-md);
  border-bottom: 2px solid var(--border-color);
}

.skeleton-link {
  height: 1em;
  width: 100%;
  margin-bottom: var(--spacing-sm);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
}

/* Loading and Error States */
.loading-state {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  font-size: var(--font-lg);
  color: var(--text-secondary);
  position: relative;
}

.loading-state::after {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top: 2px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: var(--spacing-sm);
}

/* Crossword Loading States */
#crossword .loading-text {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  font-size: var(--font-xl);
  color: var(--text-secondary);
  position: relative;
}

#crossword .loading-text::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-color);
  border-top: 2px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: var(--spacing-sm);
}

.error-state {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  font-size: var(--font-lg);
  color: #dc2626;
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
}

/* Responsive Design */
@media (max-width: 768px) {
  .home-container {
    padding: var(--spacing-lg);
  }
  
  .home-title {
    font-size: var(--font-4xl);
  }
  
  #crosswords {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
  }
  
  .series {
    padding: var(--spacing-md);
  }
}
