:root {
  --bg: #080808;
  --bg-warm: #1a0003;
  --card: #1a1a1a;
  --card-dark: #111;
  --border: #303030;
  --border-strong: #3b3b3b;
  --red: #f70d1a;
  --red-dark: #a82020;
  --text: #f4f4f4;
  --muted: #9ca3af;
  --soft: #dce3ea;
  --green: #19b34f;
  --green-bg: #0e6f2b;
  --yellow: #ffe93b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 14%, rgba(62, 0, 7, 0.5), transparent 42%),
    linear-gradient(180deg, var(--bg-warm) 0%, var(--bg) 42%, var(--bg) 100%);
  color: var(--text);
  font-family: Inter, Arial, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: transform 160ms ease, filter 160ms ease, background 160ms ease;
}

button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

.page-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 38px 18px;
}

.panel-wrap {
  width: min(480px, 100%);
}

h1 {
  margin: 0 0 30px;
  color: var(--red);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 6px;
  text-align: center;
  text-transform: uppercase;
}

.code-card,
.account-card,
.help-card,
.problem-card,
.admin-card,
.codes-card {
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--card);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.25);
}

.code-card {
  padding: 22px 20px 20px;
}

.code-card label {
  display: block;
  margin-bottom: 12px;
  color: var(--soft);
  font-size: 12px;
}

.code-row {
  display: grid;
  grid-template-columns: 1fr 102px;
  gap: 10px;
}

.code-row input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: #101010;
  color: #fff;
  padding: 13px 16px;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 2px;
  outline: none;
}

.code-row input:focus {
  border-color: #666;
}

.code-row button {
  min-height: 47px;
}

.account-card {
  display: none;
  margin-top: 16px;
  padding: 31px 20px 30px;
}

.account-card.is-visible {
  display: block;
}

.account-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-bottom: 20px;
}

.account-header span {
  border-radius: 999px;
  background: var(--green-bg);
  color: #70ff92;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.access-option {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
  min-height: 64px;
  margin-top: 11px;
  border: 1px solid #2d2d2d;
  border-radius: 7px;
  background: var(--card-dark);
  padding: 13px 16px;
}

.access-option p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.access-option button {
  min-width: 148px;
  padding: 11px 17px;
}

.help-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 16px;
  padding: 16px 20px;
  background: #101010;
}

.help-card p {
  margin: 0;
  color: #f2f6fb;
  font-size: 12px;
}

.help-card button {
  min-width: 130px;
  padding: 10px 16px;
}

.problem-card {
  display: grid;
  grid-template-columns: 20px 1fr 114px;
  align-items: center;
  gap: 16px;
  margin-top: 14px;
  border-color: #aa1717;
  background: rgba(70, 12, 12, 0.48);
  padding: 14px 17px 14px 20px;
}

.warning-mark {
  display: grid;
  place-items: center;
  width: 0;
  height: 0;
  border-right: 10px solid transparent;
  border-bottom: 18px solid var(--yellow);
  border-left: 10px solid transparent;
  color: #111;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  padding-top: 16px;
}

.problem-copy h2 {
  margin: 0 0 4px;
  color: #ff6b6b;
  font-size: 12px;
  letter-spacing: 0.2px;
}

.problem-copy p {
  margin: 0;
  color: #d8d8d8;
  font-size: 10px;
  line-height: 1.45;
}

.problem-card button {
  border: 1px solid #e24b43;
  background: var(--red-dark);
  padding: 10px 12px;
  line-height: 1.35;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(360px, calc(100vw - 40px));
  border: 1px solid #3b3b3b;
  border-radius: 8px;
  background: #171717;
  color: #fff;
  padding: 13px 16px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(0, 0, 0, 0.72);
  padding: 18px;
  z-index: 20;
}

.modal-backdrop.is-visible {
  display: grid;
}

.tutorial-modal {
  width: min(336px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border: 1px solid #3b3b3b;
  border-radius: 10px;
  background: #1d1d1d;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5);
  padding: 24px 18px 17px;
}

.tutorial-modal h2 {
  margin: 0 0 18px;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2px;
  text-align: center;
  text-transform: uppercase;
}

.tutorial-modal h3 {
  margin: 0 0 9px;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.tutorial-modal ol {
  margin: 0;
  padding-left: 16px;
  color: #d4d4d4;
  font-size: 10px;
  line-height: 1.7;
}

.tutorial-modal li {
  margin-bottom: 2px;
}

.tutorial-modal hr {
  border: 0;
  border-top: 1px solid #343434;
  margin: 17px 0;
}

.tutorial-modal .video-btn,
.tutorial-modal .close-btn {
  width: 100%;
  margin-top: 14px;
  padding: 10px 12px;
}

.tutorial-modal .close-btn {
  margin-top: 8px;
  border: 1px solid #555;
  background: #2a2a2a;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.admin-shell {
  place-items: start center;
}

.admin-wrap {
  width: min(760px, 100%);
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.admin-topbar h1 {
  margin: 0;
  text-align: left;
}

.admin-topbar a {
  border: 1px solid #3b3b3b;
  border-radius: 8px;
  color: #fff;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  text-decoration: none;
  text-transform: uppercase;
}

.admin-login-card,
.admin-card,
.codes-card {
  padding: 20px;
}

.admin-login-card {
  width: min(420px, 100%);
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--card);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.25);
}

.admin-login-card h1 {
  margin-bottom: 22px;
}

.admin-login-card button {
  width: 100%;
  margin-top: 16px;
  padding: 13px 16px;
}

.admin-nav {
  display: flex;
  gap: 10px;
  align-items: center;
}

.admin-nav button {
  border: 1px solid #444;
  background: #121212;
  padding: 10px 14px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.admin-field {
  display: grid;
  gap: 8px;
}

.admin-field.is-wide {
  grid-column: 1 / -1;
}

.admin-field label {
  color: var(--soft);
  font-size: 12px;
}

.admin-field input {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: #101010;
  color: #fff;
  padding: 12px 13px;
  outline: none;
}

.admin-field textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: #101010;
  color: #fff;
  padding: 12px 13px;
  outline: none;
}

.admin-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.admin-actions button {
  padding: 12px 16px;
}

.admin-actions .secondary-btn {
  border: 1px solid #444;
  background: #121212;
}

.codes-card {
  margin-top: 16px;
}

.codes-card h2 {
  margin: 0 0 14px;
  color: #fff;
  font-size: 15px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.codes-list {
  display: grid;
  gap: 10px;
}

.code-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  border: 1px solid #2d2d2d;
  border-radius: 7px;
  background: #101010;
  padding: 14px;
  overflow: hidden;
}

.code-item strong {
  display: block;
  margin-bottom: 5px;
  color: #fff;
  letter-spacing: 1px;
}

.code-item p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.code-actions {
  display: grid;
  gap: 8px;
  min-width: 118px;
}

.code-item button {
  width: 100%;
  padding: 10px 12px;
}

.code-item button[data-delete] {
  background: var(--red-dark);
}

.code-item button[data-remove] {
  border: 1px solid #7f1d1d;
  background: #3a0b0b;
}

.empty-state {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 560px) {
  .page-shell {
    place-items: start center;
    padding-top: 58px;
  }

  h1 {
    font-size: 21px;
    letter-spacing: 4px;
  }

  .code-row,
  .access-option,
  .problem-card {
    grid-template-columns: 1fr;
  }

  .code-row button,
  .access-option button,
  .help-card button,
  .problem-card button {
    width: 100%;
  }

  .help-card,
  .account-header {
    align-items: stretch;
    flex-direction: column;
  }

  .problem-card {
    gap: 10px;
  }

  .admin-topbar,
  .admin-nav,
  .admin-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-grid,
  .code-item {
    grid-template-columns: 1fr;
  }
}
