* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: linear-gradient(rgba(15, 23, 42, 0.22), rgba(15, 23, 42, 0.22)), url("assets/bg_tile.png") no-repeat center center;
  background-size: cover;
  background-attachment: fixed;
  background-color: #0f172a;
  color: #f1f5f9;
  min-height: 100vh;
}

.app {
  display: flex;
  min-height: 100vh;
}

/* No separate background on sidebar – body texture shows through, slight darkening only */
.sidebar {
  width: 280px;
  min-width: 280px;
  background: rgba(15, 23, 42, 0.35);
  border-right: 1px solid rgba(212, 175, 55, 0.4);
  padding: 1rem 1.25rem;
  overflow-y: auto;
}

.sidebar::after {
  display: none;
}

.sidebar > * {
  position: relative;
  z-index: 1;
}

.sidebar h3 {
  margin: 0.5rem 0 0.25rem;
  color: #a68b2b;
  font-size: 0.95rem;
  font-weight: 600;
}

.sidebar h3:first-of-type {
  margin-top: 0.25rem;
}

.sidebar label {
  display: block;
  margin-top: 0.5rem;
  margin-bottom: 0.2rem;
  font-size: 0.875rem;
  color: #f1f5f9;
}

.sidebar select {
  width: 100%;
  padding: 0.4rem 0.5rem;
  background: #1e293b;
  color: #f1f5f9;
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 6px;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}

.sidebar select[multiple] {
  min-height: 80px;
}

.sidebar hr {
  margin: 0.75rem 0;
  border: none;
  border-top: 1px solid rgba(212, 175, 55, 0.25);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  margin-bottom: 0.35rem;
}

.checkbox-label input {
  width: auto;
  margin: 0;
}

.btn-reset {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: #d4af37;
  color: #0f172a;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
}

.btn-reset:hover {
  background: #e5c04a;
}

.link-home {
  display: block;
  text-align: center;
  margin-bottom: 0.75rem;
  padding: 0.4rem 0.5rem;
  color: #d4af37;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.link-home:hover {
  color: #e5c04a;
  text-decoration: underline;
}

.control-group.hidden {
  display: none;
}

.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1em;
  height: 1.1em;
  margin-left: 0.2rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #d4af37;
  background: rgba(212, 175, 55, 0.2);
  border: 1px solid rgba(212, 175, 55, 0.5);
  border-radius: 50%;
  cursor: help;
  vertical-align: middle;
}

.help-icon:hover {
  background: rgba(212, 175, 55, 0.35);
  color: #e5c04a;
}

/* Custom multi-line tooltip (replaces native title on hover for readability) */
.custom-tooltip {
  position: fixed;
  z-index: 9999;
  max-width: 280px;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  line-height: 1.4;
  color: #e8e0d0;
  background: rgba(20, 18, 16, 0.95);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 6px;
  white-space: pre-line;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

/* No separate background on main – body texture shows through, no extra layer */
.main {
  flex: 1;
  padding: 1rem 2rem 2rem;
  max-width: 1360px;
  margin: 0 auto;
  position: relative;
}

.main::before {
  display: none;
}

.main > * {
  position: relative;
  z-index: 1;
}

.summary-row {
  margin-bottom: 0.75rem;
}

.ac-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.25rem;
}

.ac-box {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #f1f5f9;
}

.ac-box-icon {
  color: #d4af37;
}

.ac-msg {
  color: #94a3b8;
  font-size: 0.78rem;
  margin-top: 0.25rem;
}

.eq-header-wrap {
  margin-top: -0.5rem;
  margin-bottom: 0.5rem;
}

.eq-header-img {
  width: 100%;
  height: auto;
  display: block;
  margin-bottom: 0.5rem;
}

.banner-link {
  display: block;
  margin-bottom: 1rem;
}

.banner-img {
  width: 100%;
  height: auto;
  display: block;
}

.main h2 {
  color: #f1f5f9;
  font-weight: 600;
  margin: 0.5rem 0 0.25rem;
}

.rec-divider {
  height: 1px;
  background: rgba(212, 175, 55, 0.2);
  margin: 0.25rem 0 0.5rem;
}

.results {
  margin-top: 0.5rem;
}

.rec-card {
  margin-bottom: 0.35rem;
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  background: linear-gradient(180deg, #243548 0%, #1e293b 100%);
  border: 1px solid rgba(212, 175, 55, 0.25);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  color: #e2e8f0;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.rec-card:hover {
  transform: translateY(-2px);
  border-color: rgba(212, 175, 55, 0.45);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.rec-card.rec-card--first {
  background: linear-gradient(180deg, #2a3d52 0%, #243547 100%);
  border: 2px solid rgba(212, 175, 55, 0.7);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), 0 0 24px rgba(212, 175, 55, 0.25);
}

.rec-card.rec-card--first:hover {
  border-color: rgba(212, 175, 55, 0.85);
}

.rec-build-line {
  line-height: 1.4;
  margin-bottom: 0.15rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem;
}

.rec-class-chunk {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.rec-class-icon {
  height: 1.1em;
  width: auto;
  vertical-align: middle;
  object-fit: contain;
}

.rec-class-name {
  font-weight: 600;
  color: #f8fafc;
}

.rec-medal {
  font-size: 1.4rem;
  line-height: 1;
  margin-right: 0.25rem;
  vertical-align: middle;
}

.rec-medal.rec-meta-rank {
  font-size: 1.15rem;
  font-weight: 700;
  margin-right: 0.4rem;
}

.rec-rank {
  font-size: 1rem;
  font-weight: 600;
  color: #cbd5e1;
  margin-right: 0.4rem;
}

.rec-label {
  color: #f8fafc;
  font-size: 1.15rem;
  font-weight: 600;
}

.rec-score-line {
  font-size: 0.9rem;
  font-weight: 600;
  color: #f1f5f9;
  margin: 0 0 0.25rem;
}

.rec-bar-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.2rem;
}

.rec-bar-bg {
  flex: 1;
  height: 10px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.rec-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.2s ease;
}

.rec-pct {
  min-width: 2.5em;
  text-align: right;
  font-size: 0.75rem;
  color: #cbd5e1;
}

.msg {
  color: #94a3b8;
  margin: 0.5rem 0;
}

.msg.warning {
  color: #f59e0b;
}

.msg.error {
  color: #ef4444;
}

.explain-section {
  margin-top: 1rem;
}

.explain-section.hidden {
  display: none;
}

.explain-details {
  margin-bottom: 0.5rem;
  padding: 0.5rem;
  background: rgba(30, 41, 59, 0.98);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 8px;
}

.explain-details summary {
  cursor: pointer;
  font-weight: 600;
  color: #f1f5f9;
}

.explain-details ul {
  margin: 0.35rem 0 0 1.25rem;
  padding: 0;
  color: #e2e8f0;
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .app {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    min-width: 0;
    border-right: none;
    border-bottom: 1px solid rgba(212, 175, 55, 0.4);
  }
  .main {
    padding: 1rem;
  }
}
