/* ============================================================================
   FINANSLE - Professional Blue Palette (Darker Version)
   ============================================================================ */

/* CENTRALIZED COLOR SYSTEM - Darker Blue Palette */
:root {
  /* Main Colors - Darker Blue Palette */
  --darkest-blue: #1A2332;      /* Even darker background (was #27374D) */
  --dark-blue: #3A4F63;         /* Darker primary boxes (was #526D82) */  
  --light-blue: #6B7A8A;        /* Muted secondary elements (was #9DB2BF) */
  --lightest-blue: #B0BCC8;     /* Dimmed text (was #DDE6ED) */
  
  /* Background Colors */
  --bg-primary: #1A2332;        /* Main background (darkest) */
  --bg-secondary: #3A4F63;      /* Primary boxes (second darkest) */
  --bg-tertiary: #6B7A8A;       /* Secondary boxes (third) */
  --bg-modal: #3A4F63;          /* Modal backgrounds */
  
  /* Text Colors */
  --text-primary: #B0BCC8;      /* All text (dimmed) */
  --text-secondary: #B0BCC8;    /* All text (dimmed) */
  --text-muted: #B0BCC8;        /* All text (dimmed) */
  
  /* UI Colors */
  --border-color: #3A4F63;
  --error-color: #d93939;       /* Slightly darker error */
  --success-color: #6B7A8A;
  --warning-color: #6B7A8A;
  
  /* Narrower Layout Dimensions - Leave space for ads */
  --game-width: 900px;          /* Narrower game width on desktop */
  --chart-width: 860px;         /* Chart area width (game-width minus padding) */
  --chart-height: 280px;        /* Chart height */
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Layout Container - Narrower Fixed Width Game Area */
.container {
  max-width: var(--game-width);
  margin: 0 auto;
  padding: 20px;
  flex: 1;
  background: var(--bg-primary);
  width: 100%;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 4px;
  padding: 4px 0;
}

.logo {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
  letter-spacing: 0.05em;
}

.subtitle {
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 8px;
  font-weight: 400;
}

.subtitle.revealed {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1.5rem;
  margin-bottom: 8px;
  transition: all 0.3s ease;
}

/* Chart Container - Fixed Width */
.chart-container {
  border-radius: 4px;
  padding: 20px;
  margin: 0px auto 16px;
  background: var(--bg-primary);
  width: 100%;
  max-width: var(--chart-width);
  min-height: calc(var(--chart-height) + 60px);
  overflow: visible;
}

.chart-stage {
  width: 100%;
  height: var(--chart-height);
  position: relative;
  border-radius: 12px;
  overflow: hidden;
}

.chart-placeholder {
  color: var(--text-primary);
  font-style: italic;
  text-align: center;
  padding: 40px 0;
}

/* Hint Bar - Fixed Width with Tight Vertical Expansion */
.hint-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;               /* Tighter gaps */
  align-items: flex-start;
  justify-content: center;
  padding: 12px 16px;           /* Tighter padding */
  margin: 0 auto 18px;
  background: var(--bg-secondary);
  border-radius: 4px;
  position: relative;
  width: 100%;
  max-width: var(--chart-width);
  min-height: 44px;             /* Smaller minimum height */
  box-sizing: border-box;
}

/* Individual hint items - Tighter and more compact */
.hint-item {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;                     /* Smaller gap */
  white-space: nowrap;
  font-size: 0.85rem;           /* Slightly smaller font */
  flex: 0 0 auto;
  line-height: 1.3;             /* Tighter line height */
}

.hint-label {
  color: var(--text-primary);
  font-weight: 600;
}

.hint-value {
  color: var(--text-primary);
  font-weight: 600;
}

.hint-value.revealed {
  color: var(--text-primary);
  font-weight: 700;
}

.hint-value.locked {
  color: var(--text-primary);
  opacity: 0.6;
  font-style: italic;
}

/* Search Container - Fixed Width */
.search-container {
  position: relative;
  margin: 0 auto 12px;
  max-width: var(--chart-width);
  width: 100%;
}

.search-input {
  width: 100%;
  padding: 15px 20px;
  font-size: 1.1rem;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: 0.2s;
  outline: none;
  box-sizing: border-box;
}

.search-input:focus {
  border-color: var(--light-blue);
  box-shadow: 0 0 0 3px rgba(107,122,138,.1);
}

.search-input::placeholder {
  color: var(--text-primary);
  opacity: 0.7;
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-modal);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 9999;
  display: none;
}

.autocomplete-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.15s;
  color: var(--text-primary);
}

.autocomplete-item.highlighted {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.autocomplete-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Action Buttons - Fixed Width */
.action-buttons {
  display: flex;
  gap: 12px;
  margin: 8px auto 0;
  max-width: var(--chart-width);
  width: 100%;
}

.btn {
  flex: 1;
  padding: 14px 20px;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  box-sizing: border-box;
}

.btn-primary {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--bg-tertiary);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

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

/* Loading Spinner */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(176,188,200,.3);
  border-radius: 50%;
  border-top-color: var(--light-blue);
  animation: spin 1s linear infinite;
}

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

/* Attempts Tracker - Fixed Width */
.attempts-tracker {
  text-align: center;
  margin: 12px auto 8px;
  max-width: var(--chart-width);
  width: 100%;
}

.attempts-text {
  color: var(--text-primary);
  margin-bottom: 10px;
}

.attempts-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.attempt-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border-color);
  transition: 0.2s;
}

.attempt-dot.used {
  background: var(--error-color);
}

.attempt-dot.current {
  background: var(--light-blue);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.7; }
}

/* Detailed Clue Cards */
.clues-section {
  margin-bottom: 20px;
  max-width: var(--chart-width);
  margin-left: auto;
  margin-right: auto;
}

.clue-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  margin-bottom: 12px;
  overflow: hidden;
  transition: 0.3s;
  transform: translateY(20px);
  opacity: 0;
}

.clue-card.revealed {
  transform: translateY(0);
  opacity: 1;
}

.clue-card.locked {
  opacity: 0.6;
  filter: blur(2px);
}

.clue-header {
  padding: 16px 20px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
}

.clue-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-primary);
  color: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8rem;
}

.clue-title {
  font-weight: 600;
  color: var(--text-primary);
}

.clue-content {
  padding: 20px;
}

.clue-value {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-primary);
}

/* ============================================================================
   MODAL STYLES - EVEN DARKER
   ============================================================================ */

/* Modal overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0; 
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

/* Modal content box - Now using even darker blue */
.modal {
  background: #14202B;              /* Even darker than --darkest-blue */
  border-radius: 4px;
  padding: 25px;
  max-width: 450px;
  width: 100%;
  text-align: center;
  border: 1px solid #2A3F54;       /* Darker border */
  max-height: 85vh;
  overflow: hidden;
  position: relative;
}

/* Modal close button */
.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  width: auto;
  height: auto;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 1;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-primary);
  transform: scale(1.1);
}

.modal-close:active {
  transform: scale(0.95);
}

/* Modal title */
.modal-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 15px;
  color: var(--text-primary);
}

/* Modal content text */
.modal-content {
  margin-bottom: 15px;
  line-height: 1.4;
  color: var(--text-primary);
  font-size: 1.05rem;
}

/* Company info section - Using darker colors */
.company-info {
  background: #2A3F54;             /* Darker than --dark-blue */
  border-radius: 4px;
  padding: 15px;
  margin: 15px 0;
  text-align: left;
  border: 1px solid #4A5F73;      /* Darker border */
}

/* Company name */
.company-name {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 15px;
  text-align: center;
}

/* Company details grid */
.company-details {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  font-size: 0.95rem;
}

/* Individual detail items */
.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #2A3F54;
}

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

.detail-label {
  color: var(--text-primary);
  font-weight: 500;
}

.detail-value {
  color: var(--text-primary);
  font-weight: 600;
}

/* Stats section - Using darker colors */
.stats-section {
  margin-top: 15px;
  background: #2A3F54;             /* Darker than --dark-blue */
  border-radius: 4px;
  padding: 15px;
  border: 1px solid #4A5F73;      /* Darker border */
}

.stats-title {
  font-weight: 600;
  margin-bottom: 15px;
  text-align: center;
  color: var(--text-primary);
  font-size: 1.1rem;
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  text-align: center;
}

/* Stats grid items - Using darker colors */
.stat-item {
  padding: 10px 6px;
  background: #4A5F73;            /* Darker than --light-blue */
  border-radius: 4px;
  border: 1px solid #6B7A8A;     /* Darker border */
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-primary);
  display: block;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-primary);
  font-weight: 500;
}

/* Share button - Using darker colors */
.share-button {
  background: #2A3F54;            /* Darker than --dark-blue */
  color: var(--text-primary);
  border: none;
  padding: 12px 24px;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 15px;
  transition: all 0.2s ease;
  font-size: 1rem;
  width: 100%;
}

.share-button:hover {
  background: #4A5F73;            /* Darker hover */
  color: var(--text-primary);
  transform: translateY(-1px);
}

/* ============================================================================
   RESPONSIVE STYLES - PROPORTIONAL SCALING
   ============================================================================ */

/* Large Desktop (1400px+) - Standard narrow layout */
@media (min-width: 1400px) {
  :root {
    --game-width: 900px;
    --chart-width: 860px;
    --chart-height: 280px;
  }
}

/* Medium Desktop (1200px - 1399px) - Slightly smaller */
@media (min-width: 1200px) and (max-width: 1399px) {
  :root {
    --game-width: 850px;
    --chart-width: 810px;
    --chart-height: 270px;
  }
}

/* Tablet Landscape (900px - 1199px) */
@media (min-width: 900px) and (max-width: 1199px) {
  :root {
    --game-width: 800px;
    --chart-width: 760px;
    --chart-height: 260px;
  }
  
  .container {
    padding: 18px;
  }
  
  .hint-bar {
    gap: 10px 16px;
    padding: 10px 14px;
  }
  
  .hint-item {
    font-size: 0.82rem;
  }
}

/* Tablet Portrait (640px - 899px) */
@media (min-width: 640px) and (max-width: 899px) {
  :root {
    --game-width: 100%;
    --chart-width: calc(100% - 32px);
    --chart-height: 240px;
  }
  
  .container {
    padding: 16px;
  }
  
  .logo {
    font-size: 2.2rem;
  }
  
  .hint-bar {
    gap: 10px 15px;
    padding: 10px 14px;
    min-height: 40px;
  }
  
  .hint-item {
    font-size: 0.8rem;
    gap: 4px;
  }
  
  .search-input {
    padding: 14px 18px;
    font-size: 1.05rem;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile (639px and below) */
@media (max-width: 639px) {
  :root {
    --game-width: 100%;
    --chart-width: calc(100% - 24px);
    --chart-height: 200px;
  }
  
  .container {
    padding: 12px;
  }
  
  .logo {
    font-size: 2rem;
  }
  
  .search-input {
    padding: 12px 16px;
    font-size: 1rem;
  }
  
  .action-buttons {
    flex-direction: column;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .clues-section {
    display: none !important;
  }
  
  .chart-container {
    padding: 12px;
    margin: 6px auto 12px;
    min-height: calc(var(--chart-height) + 40px);
  }
  
  .hint-bar {
    gap: 8px 12px;
    padding: 8px 10px;
    font-size: 0.8rem;
    margin: 0 auto 12px;
    min-height: 36px;
  }
  
  .hint-item {
    font-size: 0.75rem;
    gap: 3px;
  }
  
  .modal {
    margin: 10px;
    padding: 20px;
    max-width: calc(100vw - 20px);
  }
  
  .modal-title {
    font-size: 1.5rem;
  }
  
  .company-name {
    font-size: 1.1rem;
  }
  
  .stat-value {
    font-size: 1.2rem;
  }
}

/* Hide clue cards on ALL devices */
.clues-section {
  display: none !important;
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

/* Toast notifications */
.toast-error {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--error-color);
  color: var(--text-primary);
  padding: 12px 20px;
  border-radius: 4px;
  font-weight: 600;
  z-index: 10000;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
}

.toast-error.show {
  opacity: 1;
  transform: translateX(0);
}

/* ============================================================================
   ABOUT MODAL STYLES
   ============================================================================ */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 8px;
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus {
  top: 6px;
}

#about-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

#about-modal-overlay.show {
  display: flex;
}

.about-modal {
  background: var(--bg-modal);
  border-radius: 4px;
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  border: 1px solid var(--border-color);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.about-modal-content {
  line-height: 1.6;
  color: var(--text-primary);
}

.about-section {
  margin-bottom: 1.5rem;
}

.about-section:last-child {
  margin-bottom: 0;
}

.about-description {
  font-size: 1rem;
  margin-bottom: 0;
  color: var(--text-primary);
}

.about-modal h3 {
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  margin-top: 0;
}

.how-to-play {
  margin: 0;
  padding-left: 1.2rem;
}

.how-to-play li {
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.how-to-play li:last-child {
  margin-bottom: 0;
}

#about-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s, color 0.2s;
}

#about-modal-close:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

@media (max-width: 640px) {
  .about-modal {
    margin: 1rem;
    padding: 1.5rem;
    max-width: none;
    width: calc(100% - 2rem);
  }

  .about-modal h3 {
    font-size: 1rem;
  }

  .about-description {
    font-size: 0.9rem;
  }
}

.about-modal {
  text-align: left;
}

.about-modal .modal-title {
  text-align: left;
}

.about-modal-content {
  text-align: left;
}

/* ============================================================================
   FEEDBACK BUTTON & MODAL
   ============================================================================ */

.feedback-btn-corner {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.3s ease;
  z-index: 1000;
}

.feedback-btn-corner:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  transform: translateY(-2px);
}

@media (max-width: 768px) {
  .feedback-btn-corner {
    top: 15px;
    right: 15px;
    padding: 6px 12px;
    font-size: 0.8rem;
  }
}

.feedback-modal {
  max-width: 500px;
  width: 90%;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

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

.form-group label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: inherit;
}

.form-group textarea {
  height: 120px;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--light-blue);
  box-shadow: 0 0 0 2px rgba(107,122,138,0.2);
}

.modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

.btn-primary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
}

.btn-primary:hover {
  background: var(--bg-tertiary);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
}

.btn-secondary:hover {
  background: var(--bg-secondary);
}