:root {
  --bg-primary: #0d1117;
  --bg-card: #161b22;
  --bg-input: #0a0e14;
  --fg-primary: #f4ead5;
  --fg-secondary: #d8cfb8;
  --fg-muted: #8b8578;
  --accent: #d4a017;
  --accent-bright: #f0c040;
  --accent-soft: rgba(212, 160, 23, 0.10);
  --rule: #2a2f38;
  --error: #ff6b6b;
  --error-bg: rgba(255, 107, 107, 0.08);
  --success: #4ade80;
  --radius-card: 18px;
  --radius-elem: 10px;
  --shadow-card: 0 30px 80px -20px rgba(0, 0, 0, 0.6),
                 0 0 0 1px rgba(255, 255, 255, 0.02);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg-primary);
  color: var(--fg-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.2rem 5rem;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(212, 160, 23, 0.08), transparent 60%),
    radial-gradient(ellipse 60% 50% at 50% 100%, rgba(212, 160, 23, 0.04), transparent 60%),
    var(--bg-primary);
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.45'/%3E%3C/svg%3E");
  opacity: 0.025;
  pointer-events: none;
  z-index: 0;
}

.card {
  position: relative;
  z-index: 1;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  padding: 2.5rem 2rem 2.2rem;
  max-width: 32rem;
  width: 100%;
  box-shadow: var(--shadow-card);
  animation: rise 0.55s cubic-bezier(0.2, 0.7, 0.3, 1);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* tag icon */
.tag {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  color: var(--accent);
  position: relative;
}

.tag-icon {
  width: 64px;
  height: 80px;
  filter: drop-shadow(0 2px 8px rgba(212, 160, 23, 0.15));
}

.is-active .tag-icon {
  animation: pulse 3.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { filter: drop-shadow(0 2px 8px rgba(212, 160, 23, 0.15)); }
  50% { filter: drop-shadow(0 2px 16px rgba(212, 160, 23, 0.4)); }
}

.tag .status {
  position: absolute;
  top: 6px;
  left: calc(50% + 36px);
  background: var(--accent);
  color: var(--bg-primary);
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  white-space: nowrap;
}

/* typography */
h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0 0 0.8rem;
  text-align: center;
}

h1 em {
  font-style: italic;
  color: var(--accent);
  font-weight: 400;
}

.lead {
  font-size: 1.08rem;
  color: var(--fg-secondary);
  margin: 0.3rem 0 1.6rem;
  text-align: center;
  font-weight: 400;
}

p {
  margin: 1rem 0;
  color: var(--fg-secondary);
}

.muted {
  color: var(--fg-muted);
  font-size: 0.95rem;
}

.signature {
  text-align: center;
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  color: var(--fg-muted);
  font-size: 1rem;
  margin-top: 2rem;
}

/* contact card on unlocked */
.contact {
  margin: 1.6rem 0 1rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.7rem 1.6rem;
  padding: 1.3rem 1.5rem;
  background: var(--accent-soft);
  border-radius: var(--radius-elem);
  border: 1px solid rgba(212, 160, 23, 0.3);
}

.contact dt {
  color: var(--fg-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  align-self: center;
  font-weight: 600;
}

.contact dd {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--fg-primary);
  word-break: break-word;
}

.contact a {
  color: var(--accent-bright);
  text-decoration: none;
  border-bottom: 1px dotted rgba(240, 192, 64, 0.4);
  padding-bottom: 1px;
  transition: border-color 0.15s, color 0.15s;
}

.contact a:hover {
  color: #fff;
  border-color: var(--accent-bright);
}

/* forms */
form { margin-top: 1.4rem; }

label {
  display: block;
  margin-bottom: 1.1rem;
}

label span {
  display: block;
  color: var(--fg-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.45rem;
  font-weight: 600;
}

input[type="password"],
input[type="text"] {
  width: 100%;
  padding: 0.8rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--rule);
  border-radius: var(--radius-elem);
  color: var(--fg-primary);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}

input[type="text"][name="totp"] {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  letter-spacing: 0.2em;
  font-size: 1.2rem;
  text-align: center;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-card);
}

button {
  width: 100%;
  padding: 0.85rem 1.4rem;
  border: none;
  border-radius: var(--radius-elem);
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: filter 0.12s, transform 0.05s, background 0.15s;
}

button.primary {
  background: var(--accent);
  color: var(--bg-primary);
}

button.primary:hover { filter: brightness(1.08); }
button.primary:active { transform: scale(0.99); }

button.ghost {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--rule);
}

button.ghost:hover {
  color: var(--fg-primary);
  border-color: var(--fg-muted);
}

.error {
  background: var(--error-bg);
  border: 1px solid rgba(255, 107, 107, 0.4);
  color: var(--error);
  padding: 0.7rem 1rem;
  border-radius: var(--radius-elem);
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

/* admin status box */
.status-box {
  padding: 1.3rem 1.5rem;
  border-radius: var(--radius-elem);
  border: 1px solid var(--rule);
  background: var(--bg-input);
  margin: 1.5rem 0;
}

.status-box.is-active {
  border-color: rgba(212, 160, 23, 0.4);
  background: var(--accent-soft);
}

.status-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.status-value {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--fg-primary);
}

.status-box.is-active .status-value { color: var(--accent-bright); }

.status-meta {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

.action-form { margin-top: 1rem; }

/* footer */
.page-footer {
  position: relative;
  z-index: 1;
  margin-top: 1.5rem;
  font-size: 0.78rem;
  color: var(--fg-muted);
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  letter-spacing: 0.05em;
  opacity: 0.6;
}

@media (max-width: 480px) {
  body { padding: 1.5rem 1rem 4rem; }
  .card { padding: 2rem 1.4rem; }
  .contact { grid-template-columns: 1fr; gap: 0.2rem 0; padding: 1.2rem; }
  .contact dt { margin-top: 0.6rem; }
  .contact dt:first-child { margin-top: 0; }
}
