:root {
  --bg-color: #f8fafc;
  --surface: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --accent: #0ea5e9;
  --accent-hover: #0284c7;
  --border: #cbd5e1;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #0f172a;
    --surface: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #38bdf8;
    --border: #334155;
  }
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.5;
}

.app-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.badge {
  display: inline-block;
  background: rgba(14, 165, 233, 0.1);
  color: var(--accent);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 1rem;
}

.header h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.header p {
  color: var(--text-secondary);
}

.converter-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}

.input-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.input-col {
  display: flex;
  flex-direction: column;
}

.input-col label {
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

input[type="number"] {
  background: var(--bg-color);
  border: 2px solid var(--border);
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: bold;
  padding: 0.75rem;
  border-radius: 8px;
  outline: none;
  font-family: 'Inter', sans-serif;
  width: 100%;
  transition: all 0.2s;
  text-align: center;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

.snellen-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-color);
  border: 2px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.2s;
}

.snellen-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

.snellen-numerator {
  padding: 0 0.5rem 0 1rem;
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.snellen-wrapper input {
  border: none;
  background: transparent;
  padding-left: 0.2rem;
  text-align: left;
}
.snellen-wrapper input:focus {
  box-shadow: none;
}

.custom-arrows {
  display: flex;
  flex-direction: column;
  background: transparent;
  border-left: 1px solid var(--border);
  align-self: stretch;
}

.custom-arrows button {
  background: var(--surface);
  border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  padding: 0 0.8rem;
  font-size: 0.7rem;
  color: var(--text-primary);
  height: 50%;
  transition: all 0.2s;
}

.custom-arrows button:last-child {
  border-bottom: none;
}

.custom-arrows button:hover,
.custom-arrows button:active {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  box-shadow: inset 0 0 12px rgba(245, 158, 11, 0.5);
}

.hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.4rem;
  text-align: center;
}

.ruler-visualization {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px dashed var(--border);
}

.custom-slider {
  width: 100%;
  appearance: none;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  outline: none;
  margin-bottom: 0.5rem;
}

.custom-slider::-webkit-slider-thumb {
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #f59e0b;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.6);
}

.ruler-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.profound-loss-info {
  margin-top: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1.5rem;
  border-radius: 12px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02);
}
.profound-loss-info h3 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 1rem;
}
.profound-loss-info ol {
  margin-top: 1rem;
  padding-left: 1.2rem;
}
.profound-loss-info li {
  margin-bottom: 0.5rem;
}
.profound-loss-info strong {
  color: var(--text-primary);
}

.legal-cid-info {
  margin-top: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1.5rem;
  border-radius: 12px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02);
}

.legal-cid-info h3 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.legal-cid-info p {
  margin-bottom: 1.5rem;
}

.cid-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.cid-card {
  background: var(--bg-color);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.cid-card h4, .cid-table h4 {
  color: var(--text-primary);
  margin-bottom: 0.8rem;
  font-size: 0.95rem;
}

.cid-card ul {
  padding-left: 1.2rem;
}

.cid-card li, .cid-table li {
  margin-bottom: 0.5rem;
}

.cid-table {
  background: var(--bg-color);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.cid-table ul {
  list-style: none;
  padding: 0;
}

.cid-table li {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.5rem 0;
  border-bottom: 1px dashed var(--border);
}

.cid-table li:last-child {
  border-bottom: none;
}

.cid-badge {
  background: rgba(14, 165, 233, 0.15);
  color: var(--accent);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: bold;
  font-family: monospace;
  font-size: 0.85rem;
}

.footer-note {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* --- CSS DE REFERÊNCIAS --- */
.references { margin-top: 2rem; padding: 1.5rem; background: rgba(15,23,42,0.05); border-radius: 8px; font-size: 0.9rem; text-align: left; }
.references h3 { margin-top: 0; font-size: 1rem; color: var(--text-primary, #17202a); margin-bottom: 0.5rem; }
.references p { margin-bottom: 1rem; color: var(--text-secondary, #475569); }
.references ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.references li { margin-bottom: 0.5rem; color: var(--text-secondary, #475569); }
.references a { color: #0ea5e9; text-decoration: none; font-weight: bold; }
.references .disclaimer { margin-top: 1rem; font-style: italic; color: #64748b; font-size: 0.85rem; border-top: 1px solid rgba(0,0,0,0.1); padding-top: 0.8rem; }
/* NIGHT_BROAD_v2 */
html[data-theme="night"] .calculator,html[data-theme="night"] .dashboard,html[data-theme="night"] .stat-card,html[data-theme="night"] .stat-box,html[data-theme="night"] .eye-card,html[data-theme="night"] .description-card,html[data-theme="night"] .visual-comparison,html[data-theme="night"] .interpretation,html[data-theme="night"] .math-dropdown,html[data-theme="night"] .references,html[data-theme="night"] details,html[data-theme="night"] .faq-section details,html[data-theme="night"] table,html[data-theme="night"] .protocol-table,html[data-theme="night"] .polar-wrapper,html[data-theme="night"] .dial-container,html[data-theme="night"] .container,html[data-theme="night"] .card,html[data-theme="night"] .section,html[data-theme="night"] .panel,html[data-theme="night"] .result-box,html[data-theme="night"] .info-box{background:rgba(255,255,255,0.04)!important;border-color:rgba(255,255,255,0.12)!important;color:#f8fafc!important}html[data-theme="night"] .btn-s{background:rgba(255,255,255,0.06)!important;color:#f8fafc!important;border-color:rgba(255,255,255,0.18)!important}html[data-theme="night"] .btn-s:hover{background:rgba(246,184,75,0.15)!important;border-color:#f6b84b!important}html[data-theme="night"] th,html[data-theme="night"] td{color:#f8fafc!important;border-color:rgba(255,255,255,0.12)!important}html[data-theme="night"] thead{background:rgba(255,255,255,0.06)!important}
