:root {
  --bg: #15181d;
  --fg: #f1f3f5;
  --muted: #a7aeb6;
  --surface: #20252c;
  --surface-hover: #2a3038;
  --border: #353c45;
}
*,
*::before,
*::after {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html,
body {
  height: 100%;
  margin: 0;
}
body {
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
main {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.screen {
  width: 100%;
  max-width: 22rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  text-align: center;
}
h1 {
  margin: 0 0 1rem;
  font-family: var(--font-title, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  font-size: var(--title-size, 2.25rem);
  font-weight: var(--title-weight, 600);
  letter-spacing: 0.02em;
}
.hint,
.muted {
  margin: 0;
}
.hint {
  font-size: 1.125rem;
}
.muted {
  color: var(--muted);
  word-break: break-word;
}
.btn {
  width: 100%;
  min-height: 3.5rem;
  padding: 0.75rem 1.25rem;
  font: inherit;
  font-weight: 600;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
.btn:hover {
  background: var(--surface-hover);
}
.btn:active {
  transform: scale(0.98);
}
.btn:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}
.btn.primary {
  color: var(--bg);
  background: var(--fg);
  border-color: var(--fg);
}
.btn.primary:hover {
  opacity: 0.9;
}
.qr {
  width: min(100%, 20rem);
  aspect-ratio: 1;
  background: var(--fg);
  border-radius: 14px;
  overflow: hidden;
  padding: 1rem;
}
.qr img,
.qr canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}
.timer {
  width: 100%;
}
.timer .muted {
  margin-top: 0.5rem;
  font-size: 0.9rem;
}
.timer-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.timer-bar span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--fg);
  transition: width 0.25s linear;
}
.progress {
  width: 100%;
}
.stats {
  display: flex;
  justify-content: space-between;
  margin: 1rem 0 0.5rem;
}
.stats div {
  text-align: start;
}
.stats div:last-child {
  text-align: end;
}
.stats dt {
  color: var(--muted);
  font-size: 0.85rem;
}
.stats dd {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.link {
  padding: 0.5rem 0.75rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--muted);
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link:hover {
  color: var(--fg);
}
.link:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
  border-radius: 6px;
}
.code-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.code-value {
  margin: 0;
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.code-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.code-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font: inherit;
  font-size: 2rem;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.code-input:focus {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}
.code-input::placeholder {
  color: var(--muted);
  opacity: 0.6;
}
.code-error {
  margin: 0;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.emoji-options {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
.emoji-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 7rem;
  padding: 1rem 0.25rem;
  font: inherit;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
.emoji-option:hover {
  background: var(--surface-hover);
}
.emoji-option:active {
  transform: scale(0.97);
}
.emoji-option:disabled {
  opacity: 0.5;
  cursor: default;
}
.emoji-option:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}
.emoji-option .emoji {
  font-size: 2.75rem;
  line-height: 1.1;
}
.emoji-option .name {
  font-size: 0.85rem;
  color: var(--muted);
  word-break: break-word;
}
.emoji-big {
  font-size: 7rem;
  line-height: 1;
}
