:root {
  --bg: #ffffff;
  --text: #1a1a2e;
  --accent: #1565c0;
  --accent-light: #e3f2fd;
  --btn-bg: #1565c0;
  --btn-text: #ffffff;
  --border: #d0d0d0;
  --focus: #1565c0;
  --ok: #2e7d32;
  --ok-bg: #e8f5e9;
  --warn: #e65100;
  --warn-bg: #fff3e0;
  --err: #c62828;
  --err-bg: #ffebee;
  --card-bg: #f8f9fa;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --text: #e0e0e0;
    --accent: #42a5f5;
    --accent-light: #1a237e;
    --btn-bg: #1565c0;
    --border: #444;
    --focus: #42a5f5;
    --ok: #66bb6a;
    --ok-bg: #1b3a1b;
    --warn: #ff9800;
    --warn-bg: #3a2a00;
    --err: #ef5350;
    --err-bg: #3a1a1a;
    --card-bg: #1e1e1e;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
  }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  padding: 1rem;
  max-width: 820px;
  margin: auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
header { margin-bottom: 1.5rem; }
h1 { font-size: 2rem; }
header p { font-size: 1.1rem; opacity: 0.85; margin-top: 0.2rem; }
section { margin-bottom: 1.5rem; }
.check-section { margin-bottom: 1rem; }
.input-row {
  display: flex;
  gap: 0.5rem;
}
#input-url {
  flex: 1;
  padding: 0.75rem;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
#input-url:focus {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-color: var(--focus);
}
.btn-primary {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: bold;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s, background 0.2s;
}
.btn-primary:hover { opacity: 0.9; background: #0d47a1; }
.btn-primary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-secondary:hover { background: var(--accent-light); }
.btn-remove {
  background: none;
  border: none;
  color: var(--err);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0.4rem;
  line-height: 1;
}
#loading-spinner {
  font-style: italic;
  opacity: 0.7;
  margin-top: 0.5rem;
  display: inline-block;
}
#results { display: grid; gap: 0.75rem; }
.result-card {
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  box-shadow: var(--shadow);
}
.result-card .label {
  font-size: 0.8rem;
  opacity: 0.7;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.result-card .value {
  font-size: 1.1rem;
  font-weight: bold;
}
.grade-display {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}
.grade-letter {
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;
}
.grade-details {
  flex: 1;
}
.grade-label {
  font-size: 1.1rem;
  font-weight: 700;
}
.grade-sub {
  font-size: 0.85rem;
  opacity: 0.8;
  margin-top: 0.2rem;
}
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.err { color: var(--err); }
.ok-bg { background: var(--ok-bg); }
.warn-bg { background: var(--warn-bg); }
.err-bg { background: var(--err-bg); }
#history-section { margin-top: 1rem; }
#history-section h2 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  opacity: 0.8;
}
#history-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.history-item {
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: background 0.2s;
}
.history-item:hover { background: var(--card-bg); }
.info-section, .pro-section {
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
}
.info-section h2, .pro-section h2 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}
.info-section ol {
  margin-left: 1.5rem;
  margin-bottom: 0.5rem;
}
.info-section li, .pro-section p {
  margin-bottom: 0.25rem;
}
.pro-features {
  list-style: none;
  margin: 0.75rem 0;
}
.pro-features li {
  padding: 0.3rem 0 0.3rem 1.5rem;
  position: relative;
}
.pro-features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--ok);
  font-weight: bold;
}
.monitor-url-row {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}
.monitor-url-row input {
  flex: 1;
  padding: 0.6rem;
  font-size: 0.9rem;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
}
.monitor-url-row input:focus {
  outline: 2px solid var(--focus);
  border-color: var(--focus);
}
#monitor-email:focus {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-color: var(--focus);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  background: var(--btn-bg);
  color: var(--btn-text);
  padding: 0.5rem 1rem;
  z-index: 100;
  font-weight: bold;
  text-decoration: none;
}
.skip-link:focus { top: 0; outline: 3px solid var(--focus); outline-offset: 2px; }
a { color: var(--accent); }
a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
footer {
  margin-top: auto;
  font-size: 0.9rem;
  opacity: 0.8;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}
@media (max-width: 600px) {
  body { padding: 0.75rem; }
  h1 { font-size: 1.5rem; }
  .input-row { flex-direction: column; }
  .btn-primary { justify-content: center; }
  .grade-letter { font-size: 2.2rem; }
}
