/* OpiEye shared design system */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #141420;
  --panel: #111;
  --border: #555;
  --accent: #ff6b7a;
  --text: #fff;
  --text-dim: #ccc;
  --risk-0: #1a0a0a;
  --risk-1: #5c1a1a;
  --risk-2: #991b1b;
  --risk-3: #dc2626;
  --risk-4: #ff3344;
  --green: #22c55e;
  --red: #ef4444;
}

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Toast notifications */
#toast-container {
  position: fixed;
  top: 64px;
  right: 16px;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  max-width: 340px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  pointer-events: auto;
  animation: toast-in 0.25s ease-out;
  line-height: 1.4;
}
.toast.error { border-color: var(--red); color: #ff9999; }
.toast.success { border-color: var(--green); color: #88eea0; }
.toast.fade-out { animation: toast-out 0.3s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { from { opacity: 1; } to { opacity: 0; transform: translateY(-8px); } }

/* Confirmation dialog */
.confirm-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', sans-serif;
}
.confirm-dialog {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  max-width: 340px;
  width: 90%;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}
.confirm-dialog p {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 20px;
  line-height: 1.5;
}
.confirm-dialog .confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.confirm-dialog .confirm-actions button {
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  border: 1px solid var(--border);
}
.confirm-dialog .confirm-cancel {
  background: var(--bg);
  color: var(--text-dim);
}
.confirm-dialog .confirm-ok {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  z-index: 10000;
  font-size: 14px;
  text-decoration: none;
  border-radius: 0 0 4px 0;
}
.skip-link:focus { top: 0; }

/* Header */
#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 1000;
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  text-decoration: none;
  color: inherit;
}
.logo:hover { text-decoration: none; }

.logo-icon {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 4px;
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
}

.subtitle {
  font-size: 13px;
  color: var(--text-dim);
  flex-shrink: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#menu-btn {
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

#menu-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

#menu-btn .menu-label {
  display: inline;
}

@media (max-width: 600px) {
  #menu-btn .menu-label { display: none; }
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.header-controls::-webkit-scrollbar { display: none; }
.header-controls::after {
  content: '';
  flex-shrink: 0;
  width: 12px;
}

/* Buttons */
.btn {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-accent {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  font-weight: 600;
}
.btn-accent:hover { background: #ff8a96; color: #000; }

/* Selects */
select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  cursor: pointer;
  outline: none;
}
select:hover { border-color: var(--accent); }
select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Menu dropdown */
.menu-dropdown {
  display: none;
  position: fixed;
  top: 56px;
  left: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  z-index: 1001;
  min-width: 200px;
  flex-direction: column;
}
.menu-dropdown.open { display: flex; }
.menu-item {
  display: block;
  padding: 12px 20px;
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.menu-item:last-child { border-bottom: none; }
.menu-item:hover { background: var(--bg); text-decoration: none; color: var(--accent); }
.menu-item.active { color: var(--accent); font-weight: 600; }

/* Form elements */
.form-group {
  margin-bottom: 14px;
}
.form-group label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 500;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
}
.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent);
}
.form-group input:focus-visible,
.form-group textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.form-group textarea {
  resize: vertical;
  min-height: 80px;
}
.form-row {
  display: flex;
  gap: 10px;
}
.form-row .form-group {
  flex: 1;
}
.form-note {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 8px;
  line-height: 1.5;
}

/* Page content layout (for standalone pages) */
.page-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 80px 20px 40px;
  line-height: 1.7;
}
.page-content h1 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 16px;
  color: #fff;
}
.page-content h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--accent);
  margin-top: 32px;
  margin-bottom: 12px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.page-content p {
  font-size: 16px;
  margin-bottom: 14px;
  color: var(--text);
}
.page-content ul, .page-content ol {
  padding-left: 20px;
  margin-bottom: 12px;
}
.page-content li {
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--text);
}
.page-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 16px 0;
}
.page-content th, .page-content td {
  padding: 8px 10px;
  border: 1px solid var(--border);
  text-align: left;
}
.page-content th {
  background: var(--bg);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.page-callout {
  background: rgba(255,255,255,0.03);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  margin: 16px 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}
.page-source {
  font-size: 12px;
  color: var(--text-dim);
  word-break: break-all;
}

/* Site footer */
.site-footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
}
.site-footer a { color: var(--accent); }

/* Responsive */
@media (max-width: 1100px) {
  .subtitle { display: none; }
}

@media (max-width: 768px) {
  .btn { padding: 8px 12px; min-height: 44px; font-size: 12px; }
  select { padding: 8px 10px; min-height: 44px; font-size: 12px; }
  .menu-dropdown { right: 0; left: 0; border-radius: 0; }
  .page-content { padding: 72px 16px 32px; }
  .page-content h1 { font-size: 22px; }
  #speed-select { display: none; }
}

@media (max-width: 480px) {
  #header { padding: 0 10px; gap: 6px; }
  .header-controls { gap: 4px; }
  .logo-text { display: none; }
  .page-content { padding: 68px 12px 24px; }
  #memorial-btn { font-size: 11px; padding: 6px 8px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
  .toast.fade-out { animation: none; opacity: 0; }
  .menu-dropdown { transition: none; }
}

*:focus-visible {
  outline-width: 3px;
}
