/* MTG NFC Card Viewer - Styles */
/* Minimal, high-contrast, large text for readability */

:root {
  --bg: #000;
  --fg: #fff;
  --muted: #cbd5e1;
  --accent: #0ea5a4;
  --border: #333;
  --dark-bg: #050505;
}

html,
body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  line-height: 1.4;
}

.wrap {
  max-width: 900px;
  margin: 12px auto;
  padding: 12px;
}

h1 {
  font-size: 1.6rem;
  margin: 0 0 8px;
}

p.lead {
  color: var(--muted);
  margin: 0 0 12px;
}

label {
  display: block;
  margin: 10px 0 6px;
  font-weight: 600;
}

input[type="search"] {
  width: 100%;
  padding: 10px;
  font-size: 1.05rem;
  border-radius: 6px;
  border: 2px solid var(--border);
  background: var(--dark-bg);
  color: var(--fg);
  box-sizing: border-box;
}

.controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

button {
  background: #111;
  color: var(--fg);
  border: 2px solid var(--border);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

button:hover {
  border-color: var(--muted);
}

button.primary {
  background: var(--accent);
  color: #000;
  border: none;
  font-weight: 600;
}

button.primary:hover {
  opacity: 0.9;
}

button:focus,
input:focus {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

.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;
}

.card-region {
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  background: var(--dark-bg);
  border: 2px solid #222;
}

.card-line {
  margin: 6px 0;
  font-size: 1.05rem;
}

.meta {
  color: var(--muted);
  font-size: 0.95rem;
}

.small {
  font-size: 0.95rem;
}

.key-help {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

footer {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.modal.open {
  display: flex;
}

.modal-content {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 2px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.3rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--fg);
  font-size: 1.8rem;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: var(--accent);
}

.modal-body {
  padding: 16px;
}

.camera-preview {
  width: 100%;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
  aspect-ratio: 4 / 3;
}

#videoElement {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.camera-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.camera-controls button {
  flex: 1;
  min-width: 120px;
}

.parse-result {
  padding: 16px;
  background: var(--dark-bg);
  border: 2px solid var(--border);
  border-radius: 8px;
  margin-top: 12px;
}

.parse-result h3 {
  margin: 0 0 12px;
  font-size: 1.1rem;
}

#parsedCardInfo {
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.parse-result-line {
  margin: 6px 0;
  padding: 4px;
}

.result-controls {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.result-controls button {
  flex: 1;
  min-height: 40px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .wrap {
    margin: 8px auto;
    padding: 8px;
  }

  h1 {
    font-size: 1.4rem;
  }

  button {
    padding: 10px 14px;
    font-size: 1rem;
    min-height: 44px; /* Touch target minimum */
    flex: 1;
    min-width: 100px;
  }

  .controls {
    gap: 6px;
  }

  input[type="search"] {
    padding: 12px;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .card-line {
    font-size: 1rem;
  }

  p.lead {
    font-size: 0.95rem;
  }

  .key-help {
    font-size: 0.85rem;
  }

  footer {
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .wrap {
    padding: 6px;
    margin: 6px auto;
  }

  h1 {
    font-size: 1.3rem;
    margin: 0 0 6px;
  }

  button {
    padding: 10px 12px;
    font-size: 0.95rem;
  }

  .controls {
    gap: 4px;
  }

  .card-region {
    padding: 10px;
  }

  .card-line {
    margin: 4px 0;
    font-size: 0.95rem;
  }

  label {
    font-size: 0.95rem;
  }

  .key-help,
  footer {
    font-size: 0.8rem;
  }
}
