:root {
  --ink: #1c2430;
  --muted: #667384;
  --line: #e4e9ef;
  --bg: #f4f6f8;
  --card: #ffffff;
  --accent: #1f6b57;
  --accent-soft: #e8f3ef;
  --warn: #9b2c2c;
  --ok: #1f6b57;
  --shadow: 0 1px 2px rgba(28, 36, 48, 0.04), 0 12px 28px rgba(28, 36, 48, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font: 16px/1.5 "Source Sans 3", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.frame {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.top {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.brand {
  font: 700 1.05rem/1 "Source Sans 3", sans-serif;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
}

nav { display: flex; gap: 1.1rem; }
nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
}
nav a:hover { color: var(--ink); }

main {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.25rem 2.5rem;
}

.hero { margin-bottom: 1.25rem; }

h1 {
  margin: 0 0 0.5rem;
  font: 600 1.55rem/1.25 "Source Sans 3", sans-serif;
  letter-spacing: -0.01em;
}

.lead {
  margin: 0;
  color: var(--muted);
  max-width: 34rem;
  font-size: 1rem;
}

.sheet {
  margin-top: 0.25rem;
  padding: 1.35rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.create, .about { display: grid; gap: 0.95rem; }
.grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.95rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.92rem;
}

.optional { font-weight: 400; color: var(--muted); }

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
input:focus {
  outline: 2px solid rgba(31, 107, 87, 0.25);
  border-color: var(--accent);
}

.prefix {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 0.15rem 0 0.8rem;
  background: #fff;
}
.prefix span { color: var(--muted); white-space: nowrap; font-size: 0.92rem; }
.prefix input { border: 0; padding-left: 0; outline: none; }
.prefix:focus-within {
  outline: 2px solid rgba(31, 107, 87, 0.25);
  border-color: var(--accent);
}

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border: 0;
  border-radius: 10px;
  padding: 0.8rem 1.05rem;
  background: var(--accent);
  color: #fff;
  font: 600 0.95rem/1 "Source Sans 3", sans-serif;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { filter: brightness(0.96); }
.button.quiet {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.result {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.note {
  margin: 0;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  font-size: 0.95rem;
}
.note.bad { background: #fdecec; color: var(--warn); }
.note.ok { background: var(--accent-soft); color: var(--ok); }

.meta, footer, .text { color: var(--muted); }
.meta {
  margin: 0.85rem 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  font-size: 0.92rem;
}
.text { font-size: 0.95rem; }

footer {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1.25rem 1.75rem;
  font-size: 0.88rem;
}

.about ul {
  margin: 0.25rem 0 0.4rem;
  padding-left: 1.1rem;
  color: var(--muted);
}

/* Wait / interstitial */
.wait-body {
  min-height: 100vh;
  background:
    linear-gradient(180deg, #eef2f5 0%, var(--bg) 42%, #e9eef3 100%);
}

.wait-shell {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 1rem;
  padding: 1.5rem 1.1rem;
}

.wait-brand {
  justify-self: center;
}

.wait-card {
  width: min(440px, 100%);
  padding: 1.6rem 1.4rem 1.35rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  text-align: center;
}

.wait-card h1 {
  margin-top: 0.85rem;
  font-size: 1.28rem;
}

.wait-card .lead {
  margin: 0.35rem auto 1rem;
  max-width: 28rem;
}

.ring {
  position: relative;
  width: 108px;
  height: 108px;
  margin: 0 auto;
}

.ring svg {
  width: 108px;
  height: 108px;
  transform: rotate(-90deg);
}

.ring-track,
.ring-bar {
  fill: none;
  stroke-width: 8;
}

.ring-track { stroke: #e7edf2; }
.ring-bar {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 327;
  stroke-dashoffset: 0;
  animation: drain calc(var(--seconds) * 1s) linear forwards;
}

.ring-count {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 700 1.55rem/1 "Source Sans 3", sans-serif;
  color: var(--ink);
}

@keyframes drain {
  to { stroke-dashoffset: 327; }
}

.ad-slot {
  margin: 0 0 1rem;
  padding: 1rem;
  border: 1px dashed #cfd8e2;
  border-radius: 12px;
  background: #f8fafb;
  text-align: left;
}

.ad-label {
  margin: 0 0 0.3rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.ad-copy {
  margin: 0;
  color: var(--ink);
  font-size: 0.95rem;
}

.wait-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.recent { margin-top: 1rem; }
.recent-head { margin-bottom: 0.85rem; }
.recent-head h2 {
  margin: 0 0 0.25rem;
  font: 600 1.1rem/1.3 "Source Sans 3", sans-serif;
}
.recent-head .lead { font-size: 0.92rem; }

.recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.recent-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.7rem;
  align-items: center;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfd;
}

.recent-main { min-width: 0; }
.recent-code {
  display: inline-block;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.95rem;
}
.recent-code:hover { color: var(--accent); }
.recent-target {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.9rem;
  padding: 0.28rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: 600 0.8rem/1 "Source Sans 3", sans-serif;
  text-decoration: none;
  cursor: pointer;
}
.mini:hover { background: #f3f6f8; }
.mini.go {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.mini.go:hover { filter: brightness(0.96); background: var(--accent); }

.stats-choice {
  margin: 0;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 0.55rem;
}
.stats-choice legend {
  padding: 0 0.25rem;
  font-weight: 600;
  font-size: 0.92rem;
}
.radio {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.55rem;
  align-items: start;
  font-weight: 400;
  font-size: 0.92rem;
}
.radio input { margin-top: 0.2rem; }
.stats-pass {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.45rem;
  justify-items: start;
}
.stats-pass strong {
  font-size: 1.2rem;
  letter-spacing: 0.08em;
}

.stats-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.stats-toolbar .meta { margin: 0; flex: 1; }

.table-wrap { overflow-x: auto; }
table.compact {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
table.compact th,
table.compact td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
table.compact th {
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}
table.compact .ua {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
table.days { max-width: 280px; margin-bottom: 0.25rem; }
.empty-note { margin: 0; color: var(--muted); }
.button.quiet {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

@media (max-width: 640px) {
  .result,
  .grid-two,
  .wait-actions,
  .recent-item { grid-template-columns: 1fr; }
  .recent-actions { justify-content: flex-start; }
  h1 { font-size: 1.35rem; }
}
