:root {
  /* Zalgiris Green Theme */
  --bg-dark: #002b1c;
  --bg-mid: #004F30;
  --bg-light: #006747;
  --text-main: #ffffff;
  --text-muted: #a8b3ac;
  --accent-gold: #F05A28; /* Zalgiris Orange */
  --accent-blue: #009EE0;
  --card-bg: rgba(17, 33, 27, 0.7);
  --card-border: rgba(29, 46, 39, 0.8);
  --success: #00d2ff;
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --glass-bg: rgba(13, 26, 21, 0.9);
  --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
  font-family: var(--font-body);
  background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-mid) 50%, var(--bg-light) 100%);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  background-attachment: fixed;
}

/* Typography */
h1, h2, h3, h4, .esc-logo-svg text, .esc-logo-mini text {
  font-family: var(--font-heading);
}

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

/* Buttons */
button {
  font-family: var(--font-heading);
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 0.3s ease;
  border-radius: 8px;
  font-weight: 600;
}

.btn-primary {
  background: linear-gradient(90deg, var(--bg-mid), var(--bg-light));
  border: 1px solid var(--accent-gold);
  color: white;
  padding: 12px 24px;
  font-size: 1.1rem;
  box-shadow: 0 4px 15px rgba(0, 103, 71, 0.4);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 103, 71, 0.6);
  background: linear-gradient(90deg, var(--bg-light), var(--bg-mid));
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  padding: 10px 20px;
  border: 1px solid var(--card-border);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 40px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  position: relative;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}
.modal-overlay.active .modal-card {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: 20px; right: 20px;
  background: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  padding: 5px;
}
.modal-close:hover {
  color: white;
}

/* Setup Modal Specifics */
.modal-logo { text-align: center; margin-bottom: 30px; }
.esc-logo-mini svg { width: 150px; height: auto; }
.modal-subtitle { color: var(--accent-gold); font-size: 0.9rem; letter-spacing: 2px; text-transform: uppercase; margin-top: 10px; }
.modal-title { text-align: center; margin-bottom: 30px; font-size: 2rem; background: linear-gradient(90deg, #fff, #a8b3ac); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.form-group { margin-bottom: 25px; }
.form-group label { display: block; margin-bottom: 10px; font-weight: 600; color: #ddd; font-family: var(--font-heading); font-size: 1.1rem; }
.hint-text { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 15px; }

.rater-count-picker { display: flex; align-items: center; justify-content: center; gap: 20px; background: rgba(0,0,0,0.3); padding: 15px; border-radius: 12px; }
.count-btn { width: 40px; height: 40px; border-radius: 50%; background: var(--card-border); color: white; font-size: 1.2rem; display: flex; align-items: center; justify-content: center; }
.count-btn:hover { background: var(--bg-light); }
#rater-count-display { font-size: 1.5rem; font-weight: bold; width: 30px; text-align: center; font-family: var(--font-heading); }

#rater-inputs { display: flex; flex-direction: column; gap: 10px; }
.rater-input-wrapper input {
  width: 100%;
  padding: 12px 15px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--card-border);
  color: white;
  border-radius: 8px;
  font-family: var(--font-body);
  transition: border-color 0.3s;
}
.rater-input-wrapper input:focus { border-color: var(--accent-gold); outline: none; }

.category-toggles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.category-toggle {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--card-border);
  padding: 12px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
.category-toggle.active {
  background: rgba(0, 103, 71, 0.4);
  border-color: var(--accent-gold);
}
.cat-icon { font-size: 1.2rem; }
.start-btn { width: 100%; margin-top: 20px; font-size: 1.2rem; padding: 15px; }

/* Header */
.site-header {
  padding: 20px 40px;
  background: rgba(0, 43, 28, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px; }
.esc-logo-container { display: flex; flex-direction: column; }
.esc-logo-svg { height: 60px; width: auto; }
.header-tagline { font-family: var(--font-heading); font-size: 0.8rem; color: var(--accent-gold); letter-spacing: 2px; text-transform: uppercase; margin-left: 65px; margin-top: -5px; }

.header-controls { display: flex; flex-direction: column; align-items: flex-end; gap: 15px; }
.header-actions { display: flex; gap: 10px; }

/* Main Content */
.main-content { padding: 40px; max-width: 1400px; margin: 0 auto; }

.filter-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; flex-wrap: wrap; gap: 20px; }
#search-input {
  padding: 12px 20px;
  border-radius: 30px;
  border: 1px solid var(--card-border);
  background: rgba(0,0,0,0.3);
  color: white;
  width: 300px;
  font-family: var(--font-body);
}
#search-input:focus { outline: none; border-color: var(--accent-gold); }

/* Country Grid - Changed for side-by-side */
.country-grid { display: flex; flex-direction: column; gap: 40px; }

.country-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 30px;
  position: relative;
  transition: all 0.3s ease;
  overflow: hidden;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 30px;
}
.country-card::before {
  content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 4px;
  background: linear-gradient(90deg, transparent, transparent);
  transition: all 0.3s ease;
}
.country-card:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0,0,0,0.4); border-color: rgba(255,255,255,0.2); }
.country-card:hover::before { background: linear-gradient(90deg, var(--accent-gold), var(--bg-light)); }

.card-left-info {
  flex: 0 0 280px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.card-header { display: flex; justify-content: flex-start; align-items: center; gap: 20px; margin-bottom: 20px; }
.flag-img { width: 60px; border-radius: 4px; box-shadow: 0 2px 4px rgba(0,0,0,0.3); }

.card-body { flex-grow: 1; }
.country-name { font-family: var(--font-heading); font-size: 2rem; font-weight: 700; margin-bottom: 5px; display: flex; align-items: center; gap: 10px; }
.running-order { font-size: 1rem; color: var(--text-muted); font-weight: 400; }
.artist-name { color: var(--text-muted); font-size: 1rem; margin-bottom: 5px; }
.song-name { font-weight: 600; font-size: 1.3rem; color: var(--accent-gold); font-style: italic; margin-bottom: 15px; }

.links-row { display: flex; gap: 15px; }
.action-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: rgba(255,255,255,0.05);
  border-radius: 20px;
  transition: all 0.2s;
}
.action-link:hover { color: white; background: rgba(255,255,255,0.1); }
.link-icon { fill: currentColor; width: 16px; height: 16px; }

/* Side-by-side Raters Container */
.card-raters-container {
  display: flex;
  flex: 1;
  gap: 15px;
  overflow-x: auto;
  border-left: 1px solid var(--card-border);
  padding-left: 30px;
}

/* Custom Scrollbar for raters container */
.card-raters-container::-webkit-scrollbar { height: 8px; }
.card-raters-container::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); border-radius: 4px; }
.card-raters-container::-webkit-scrollbar-thumb { background: var(--bg-light); border-radius: 4px; }
.card-raters-container::-webkit-scrollbar-thumb:hover { background: var(--accent-gold); }

.rater-column {
  min-width: 180px;
  flex: 1;
  background: rgba(0,0,0,0.2);
  padding: 15px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
}
.rater-name-header {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--accent-gold);
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 8px;
}

.category-slider { margin-bottom: 10px; }
.cat-header { display: flex; justify-content: space-between; margin-bottom: 4px; }
.cat-label { font-size: 0.8rem; color: #ddd; display: flex; align-items: center; gap: 4px; }
.cat-score-val { font-family: var(--font-heading); font-size: 1rem; font-weight: 700; color: white; width: 25px; text-align: right; }

input[type=range] {
  -webkit-appearance: none; width: 100%; background: transparent;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; height: 14px; width: 14px; border-radius: 50%;
  background: #d97757; cursor: pointer; margin-top: -5px;
  box-shadow: 0 0 5px rgba(0,0,0,0.5);
}
input[type=range]::-webkit-slider-runnable-track {
  width: 100%; height: 4px; cursor: pointer; background: var(--card-border); border-radius: 2px;
}
input[type=range]:focus { outline: none; }

.rater-avg {
  margin-top: auto;
  padding-top: 10px;
  text-align: center;
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--success);
}

/* Results Modal */
.results-card { max-width: 800px; }
.results-header { text-align: center; margin-bottom: 30px; }
.results-header h2 { font-size: 2.5rem; background: linear-gradient(90deg, var(--accent-gold), #fff); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.results-tabs { display: flex; justify-content: center; gap: 10px; margin-bottom: 25px; border-bottom: 1px solid var(--card-border); padding-bottom: 15px; }
.rtab { background: transparent; color: var(--text-muted); font-size: 1.1rem; padding: 10px 20px; border-radius: 8px; }
.rtab.active { background: rgba(255,255,255,0.1); color: white; }

.results-list { display: flex; flex-direction: column; gap: 15px; }
.result-item {
  display: flex; align-items: center; background: rgba(0,0,0,0.3); padding: 15px 20px; border-radius: 12px; border: 1px solid var(--card-border);
}
.rank { font-family: var(--font-heading); font-size: 1.5rem; font-weight: 800; width: 40px; color: var(--text-muted); }
.result-item:nth-child(1) .rank { color: #FFD700; font-size: 2rem; }
.result-item:nth-child(2) .rank { color: #C0C0C0; font-size: 1.8rem; }
.result-item:nth-child(3) .rank { color: #CD7F32; font-size: 1.6rem; }

.res-flag { font-size: 2rem; margin-right: 15px; }
.res-info { flex-grow: 1; }
.res-country { font-weight: 700; font-size: 1.2rem; }
.res-song { font-size: 0.9rem; color: var(--text-muted); }
.res-score { font-family: var(--font-heading); font-size: 1.8rem; font-weight: 800; color: var(--success); }

#per-rater-container {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding-bottom: 10px;
}
#per-rater-container::-webkit-scrollbar { height: 8px; }
#per-rater-container::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); border-radius: 4px; }
#per-rater-container::-webkit-scrollbar-thumb { background: var(--bg-light); border-radius: 4px; }

.rater-results-col {
  flex: 1;
  min-width: 250px;
}
.rater-res-title {
  text-align: center;
  color: var(--accent-gold);
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 15px;
  background: rgba(0,0,0,0.3);
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
}
.compact-item {
  padding: 10px 15px;
}

.closest-card { background: rgba(0,0,0,0.3); border: 1px solid var(--card-border); border-radius: 12px; padding: 30px; text-align: center; }
.closest-title { font-size: 1.2rem; color: var(--text-muted); margin-bottom: 10px; }
.closest-name { font-family: var(--font-heading); font-size: 2.5rem; color: var(--accent-gold); font-weight: 800; margin-bottom: 15px; }
.closest-desc { line-height: 1.6; }

/* Responsive */
@media (max-width: 1024px) {
  .country-card { flex-direction: column; align-items: stretch; }
  .card-left-info { flex: none; }
  .card-raters-container { border-left: none; border-top: 1px solid var(--card-border); padding-left: 0; padding-top: 20px; }
}
@media (max-width: 768px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  .header-controls { align-items: flex-start; width: 100%; }
  .esc-logo-svg { height: 50px; }
  .main-content { padding: 20px; }
  #search-input { width: 100%; }
  .country-name { font-size: 1.5rem; flex-direction: column; align-items: flex-start; gap: 5px;}
}
