:root {
  color-scheme: dark;
  --bg: #090a0b;
  --panel: #141619;
  --panel-strong: #1c2025;
  --text: #f1eee8;
  --muted: #a59d90;
  --line: #33373d;
  --line-hot: #74400f;
  --accent: #ff8a1d;
  --accent-dark: #cc5f00;
  --accent-soft: rgba(255, 138, 29, 0.16);
  --danger: #ff5548;
  --danger-soft: rgba(255, 85, 72, 0.12);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgba(255, 138, 29, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 138, 29, 0.03) 1px, transparent 1px),
    radial-gradient(circle at 15% 0%, rgba(255, 138, 29, 0.12), transparent 32rem),
    var(--bg);
  background-size: 34px 34px, 34px 34px, auto, auto;
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

h1,
h2,
p {
  margin: 0;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid #ff9f3f;
  border-radius: 8px;
  background: linear-gradient(180deg, #ff9b35, var(--accent-dark));
  box-shadow: 0 0 0 1px rgba(255, 138, 29, 0.18), 0 10px 28px rgba(204, 95, 0, 0.22);
  color: #140a00;
  cursor: pointer;
  font-weight: 800;
  min-height: 42px;
  padding: 0 18px;
  text-transform: uppercase;
}

button:hover {
  background: linear-gradient(180deg, #ffac55, #e56c00);
}

button.secondary {
  background: #24282e;
  border-color: #3c4149;
  box-shadow: none;
  color: var(--text);
}

button.secondary:hover {
  background: #2e333a;
}

button.danger {
  background: transparent;
  border: 1px solid rgba(255, 85, 72, 0.5);
  box-shadow: none;
  color: var(--danger);
  min-height: 34px;
  padding: 0 12px;
}

button.danger:hover {
  background: var(--danger-soft);
}

input {
  background: #0d0f12;
  width: 100%;
  border: 1px solid #3a3f47;
  border-radius: 8px;
  color: var(--text);
  min-height: 44px;
  padding: 0 12px;
}

input::placeholder {
  color: #716a60;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 0 24px rgba(255, 138, 29, 0.18);
  outline: none;
}

label {
  display: grid;
  gap: 7px;
  color: #d9d0c3;
  font-weight: 800;
}

.muted {
  color: var(--muted);
  margin-top: 5px;
}

.error {
  background: var(--danger-soft);
  border: 1px solid rgba(255, 85, 72, 0.5);
  border-radius: 8px;
  color: var(--danger);
  padding: 10px 12px;
}

.inline-error {
  margin-top: 14px;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.auth-panel,
.add-panel {
  background: linear-gradient(180deg, var(--panel-strong), var(--panel));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
  position: relative;
}

.auth-panel::before,
.add-panel::before,
.totp-card::before {
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  content: "";
  height: 1px;
  left: 14px;
  opacity: 0.72;
  position: absolute;
  right: 14px;
  top: -1px;
}

.auth-panel {
  width: min(100%, 420px);
}

.stack {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.topbar {
  align-items: center;
  background: rgba(12, 13, 15, 0.82);
  border-bottom: 1px solid var(--line-hot);
  display: flex;
  justify-content: space-between;
  padding: 24px clamp(18px, 4vw, 48px);
  position: sticky;
  top: 0;
  z-index: 2;
}

.layout {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(280px, 360px) 1fr;
  padding: 24px clamp(18px, 4vw, 48px) 48px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.codes-panel {
  min-width: 0;
}

.cycle {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 54px 1fr;
  margin-bottom: 18px;
}

#timer {
  color: var(--accent);
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  text-shadow: 0 0 18px rgba(255, 138, 29, 0.42);
}

.progress-track {
  background: #191c20;
  border: 1px solid #343943;
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
}

#progress-bar {
  background: linear-gradient(90deg, #ff5f00, #ffb451);
  box-shadow: 0 0 18px rgba(255, 138, 29, 0.56);
  height: 100%;
  transition: width 180ms linear;
  width: 0;
}

.code-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.totp-card {
  background:
    linear-gradient(135deg, rgba(255, 138, 29, 0.08), transparent 44%),
    linear-gradient(180deg, #181b20, #111316);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  position: relative;
}

.card-head {
  align-items: start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-height: 48px;
}

.card-head h2 {
  font-size: 1.05rem;
}

.card-head p {
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.code-button {
  background:
    linear-gradient(rgba(255, 138, 29, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, #0a0b0d, #171a1f);
  background-size: 100% 12px, auto;
  border: 1px solid var(--line-hot);
  border-radius: 8px;
  box-shadow: inset 0 0 28px rgba(255, 138, 29, 0.08), 0 0 24px rgba(0, 0, 0, 0.35);
  color: var(--accent);
  font-size: clamp(2rem, 7vw, 3.1rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  margin-top: 18px;
  min-height: 82px;
  width: 100%;
}

.code-button:hover {
  background:
    linear-gradient(rgba(255, 138, 29, 0.12) 1px, transparent 1px),
    linear-gradient(180deg, #101216, #1f2329);
  background-size: 100% 12px, auto;
}

.copy-state {
  color: var(--accent);
  font-weight: 800;
  min-height: 22px;
  padding-top: 8px;
}

.empty {
  color: var(--muted);
  padding: 40px 0;
}

@media (max-width: 760px) {
  .topbar {
    align-items: start;
    gap: 16px;
  }

  .layout {
    grid-template-columns: 1fr;
  }
}
