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

:root {
  --bg: #0d1117;
  --card-bg: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #9ea8b3;
  --accent: #58a6ff;
  --green: #3fb950;
  --red: #f85149;
  --orange: #d29922;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
.btn, .btn-download { text-decoration: none; }

header {
  border-bottom: 1px solid var(--border);
  padding: 2rem 1rem;
}

.header-content {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tagline {
  color: var(--muted);
  font-size: 0.9rem;
  flex: 1;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s;
}

.btn:hover { background: #21262d; text-decoration: none; }

.btn-request {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
}
.btn-request:hover { background: #4c9aff; }

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.empty-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.empty-desc {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 auto 1.5rem;
  line-height: 1.6;
}

.btn-empty {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.6rem 1.5rem;
  margin-bottom: 0.5rem;
}
.btn-empty:hover { background: #4c9aff; text-decoration: none; }

.empty-hint {
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 1.25rem;
  opacity: 0.6;
}

main {
  flex: 1;
  max-width: 800px;
  margin: 1.5rem auto;
  padding: 0 1rem;
  width: 100%;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.cards-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  overflow: hidden;
  transition: border-color 0.2s;
}

.card.valid { border-left: 3px solid var(--green); }
.card.expired { border-left: 3px solid var(--red); opacity: 0.6; }
.card.no-timer { border-left: 3px solid var(--muted); }

.card-icon {
  font-size: 1.5rem;
  width: 2rem;
  text-align: center;
  flex-shrink: 0;
}

.card-info { flex: 1; min-width: 0; }

.card-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}

.card-meta {
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.card-meta span { white-space: nowrap; }

.card-timer {
  font-size: 0.8rem;
  font-weight: 500;
  text-align: right;
  flex-shrink: 0;
  min-width: 12rem;
}

.timer-green { color: var(--green); }
.timer-orange { color: var(--orange); }
.timer-red { color: var(--red); }

.timer-countdown {
  font-weight: 500;
}

.timer-msk {
  font-weight: 400;
  font-size: 0.7rem;
  opacity: 0.7;
  white-space: nowrap;
}

.timer-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: 0.6rem;
  font-weight: 700;
  background: var(--border);
  color: var(--muted);
  cursor: help;
  position: relative;
  margin-left: 4px;
  vertical-align: middle;
  user-select: none;
}

.timer-help::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 10px;
  background: #2a2a2e;
  color: #f0f0f0;
  font-size: 0.75rem;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.06);
  z-index: 100;
}

.timer-help:hover::after {
  opacity: 1;
}

.btn-download {
  flex-shrink: 0;
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.btn-download.valid { border-color: var(--green); color: var(--green); }
.btn-download.expired { border-color: var(--border); color: var(--muted); cursor: not-allowed; }

footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal.hidden { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
}

.modal-content {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  max-width: 520px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  scrollbar-width: none;
  z-index: 101;
}

.modal-content::-webkit-scrollbar {
  display: none;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-content h2 { margin-bottom: 0.75rem; font-size: 1.2rem; }

.modal-content p { color: var(--muted); font-size: 0.9rem; margin-bottom: 1rem; }

textarea {
  width: 100%;
  padding: 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  resize: vertical;
  margin-bottom: 1rem;
}

.form-group { margin-bottom: 1.25rem; }

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.radio-group { display: flex; gap: 1rem; }

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 400;
}

.radio-label input { accent-color: var(--accent); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover { background: #4c9aff; }

.request-instructions {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--bg);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.request-instructions ol {
  padding-left: 1.25rem;
  margin: 0.5rem 0;
}

.request-instructions li { margin-bottom: 0.4rem; }
.request-instructions em { color: var(--text); font-style: italic; }

.request-note {
  font-size: 0.8rem;
  color: var(--accent);
  margin-top: 0.5rem;
  margin-bottom: 0;
}

.hidden { display: none; }

.seo-intro {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.seo-intro p { flex: 1; margin: 0; color: var(--muted); }
.seo-intro strong { color: var(--text); }

.btn-faq {
  flex-shrink: 0;
  font-size: 0.8rem;
  padding: 0.4rem 1rem;
  color: var(--accent);
  border-color: var(--accent);
}

.modal-content--wide { max-width: 640px; }

.faq-item { margin-bottom: 1.5rem; }
.faq-item:last-child { margin-bottom: 0; }
.faq-item h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text);
}
.faq-item p {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}
.faq-item code {
  color: var(--accent);
  font-size: 0.85rem;
}

@media (max-width: 768px) {
  .tagline { display: none; }
  .btn-request { align-self: flex-end; }

  .card {
    display: grid !important;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    align-items: center;
  }

  .card-icon {
    grid-column: 1;
    grid-row: 1;
    margin: 0;
  }

  .card-info {
    grid-column: 2;
    grid-row: 1;
    flex: none;
    width: 100%;
  }

  .card-meta {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }

  .card-timer {
    grid-column: 1 / -1;
    grid-row: 3;
    text-align: left;
    min-width: 0;
    margin-bottom: 0.25rem;
  }

  .btn-download {
    grid-column: 1 / -1;
    grid-row: 4;
    justify-self: start;
  }
}
