:root {
  --bg: #141414;
  --card: #1f1f1f;
  --card-2: #262626;
  --text: #f5f5f5;
  --muted: #9a9a9a;
  --red: #e50914;
  --red-dark: #b20710;
  --green: #46d369;
  --yellow: #f5c518;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
[hidden] { display: none !important; }
h1 { font-size: 1.5rem; margin: 0; }
.muted { color: var(--muted); }
.error { color: #ff6b6b; min-height: 1.4em; margin: .5rem 0; text-align: center; }

/* PIN */
.pin-screen {
  min-height: 100dvh; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 24px 16px; gap: 8px;
}
.pin-screen h1 { color: var(--red); font-size: 2rem; letter-spacing: -.5px; }
.dots { display: flex; gap: 16px; margin: 16px 0 4px; }
.dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--muted); transition: .15s; }
.dots span.on { background: var(--text); border-color: var(--text); }
.dots.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px; }
.keypad button {
  height: 76px; border-radius: 50%; border: 0; background: var(--card-2); color: var(--text);
  font-size: 1.75rem; cursor: pointer; transition: background .1s;
}
.keypad button:active, .keypad button:focus-visible { background: #3a3a3a; outline: none; }
.keypad button:disabled { opacity: .4; }

/* Lista */
.list-screen { max-width: 640px; margin: 0 auto; padding: 16px 16px 40px; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 8px 0 16px; }
.topbar h1 { color: var(--red); }
.status { color: var(--green); font-size: .8rem; transition: color .3s; }
.status.off { color: #ff6b6b; }

.card {
  background: var(--card); border-radius: var(--radius); padding: 18px; margin-bottom: 14px;
  border: 1px solid #2c2c2c;
}
.card.new { animation: pop .5s ease-out; border-color: var(--red); }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.badge { font-weight: 700; font-size: 1.05rem; }
.countdown {
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.1rem;
  padding: 4px 10px; border-radius: 999px; background: rgba(70, 211, 105, .15); color: var(--green);
  white-space: nowrap;
}
.countdown.warn { background: rgba(245, 197, 24, .15); color: var(--yellow); }
.countdown.expired { background: #2c2c2c; color: var(--muted); font-weight: 500; font-size: .9rem; }
.code {
  margin: 14px 0 4px; font-size: 3rem; font-weight: 700; letter-spacing: .35em;
  font-variant-numeric: tabular-nums; text-align: center;
}
.card.expired .code { font-size: 1.4rem; text-align: left; margin: 8px 0 0; }
.who { margin: 12px 0 2px; font-size: 1.05rem; }
.when { margin: 0; font-size: .9rem; }
.actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.btn-open {
  flex: 1 1 200px; display: block; text-align: center; text-decoration: none;
  background: var(--red); color: #fff; font-weight: 700; font-size: 1.15rem;
  padding: 16px; border-radius: 999px;
}
.btn-open:hover, .btn-open:focus-visible { background: var(--red-dark); outline: none; }
.btn-copy {
  flex: 0 1 auto; background: transparent; color: var(--text); border: 1px solid #555;
  padding: 14px 18px; border-radius: 999px; font-size: 1rem; cursor: pointer;
}

.btn-copy-main { flex: 1 1 200px; font-weight: 700; font-size: 1.1rem; padding: 16px; }

.card.expired { opacity: .55; padding: 14px 18px; }
.card.expired .actions { display: none; }

.history-title { font-size: 1rem; color: var(--muted); font-weight: 600; margin: 28px 0 12px; }
.empty { text-align: center; padding: 48px 12px; font-size: 1.1rem; line-height: 1.6; }
footer { text-align: center; margin-top: 32px; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: .9rem; }

@media (min-width: 1200px) { /* TV */
  .list-screen { max-width: 820px; }
  body { font-size: 1.2rem; }
}
