:root {
  --bg: #0a0a0a;
  --panel: #0f0f0f;
  --panel-2: #141414;
  --panel-3: #1a1a1a;
  --line: rgba(255, 255, 255, .04);
  --line-soft: rgba(255, 255, 255, .025);
  --text: #d4d4d4;
  --muted: #6b6b6b;
  --green: #8ab090;
  --green-fill: #2c4830;
  --green-border: #416548;
  --danger: #c47b7b;
  --gold: #c4a86b;
  --toast-duration: 1500ms;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

body {
  min-width: 320px;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: middle;
}

.muted {
  color: var(--muted);
}

.hidden {
  display: none !important;
}

/* Default button — neutral ghost style */
.btn {
  width: fit-content;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 4px;
  background: var(--panel-3);
  color: var(--text);
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}

.btn:hover {
  background: #222;
  border-color: rgba(255, 255, 255, .12);
}

/* Primary CTA — dark green fill */
.btn.primary {
  background: var(--green-fill);
  color: #c8ddc9;
  border-color: var(--green-border);
}

.btn.primary:hover {
  background: #354f39;
  border-color: #4e7a57;
}

/* Green variant — same dark green fill */
.btn.green {
  background: var(--green-fill);
  color: #c8ddc9;
  border-color: var(--green-border);
}

.btn.green:hover {
  background: #354f39;
  border-color: #4e7a57;
}

.btn.danger {
  background: var(--panel-3);
  color: var(--danger);
  border-color: rgba(196, 123, 123, .15);
}

.btn.small {
  padding: 6px 10px;
  border-radius: 3px;
  font-size: 12px;
}

.toasts {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 24px));
  display: grid;
  gap: 6px;
  z-index: 100;
  pointer-events: none;
}

.toast {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-2);
  transform: translateY(-140%);
  opacity: 0;
  transition: transform .2s ease, opacity .2s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.hide {
  transform: translateY(-140%);
  opacity: 0;
}

.toast-body {
  padding: 8px 12px;
  text-align: center;
  font-size: 13px;
}

.toast-progress {
  width: 100%;
  height: 2px;
  background: #444;
  animation: toast-life var(--toast-duration, 1500ms) linear forwards;
}

.toast.good {
  border-color: rgba(138, 176, 144, .2);
}

.toast.good .toast-progress {
  background: var(--green);
}

.toast.warn {
  border-color: rgba(196, 168, 107, .2);
}

.toast.warn .toast-progress {
  background: var(--gold);
}

.toast.bad {
  border-color: rgba(196, 123, 123, .2);
}

.toast.bad .toast-progress {
  background: var(--danger);
}

@keyframes toast-life {
  from { width: 100%; }
  to { width: 0%; }
}

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

.modal-backdrop.show {
  display: grid;
}

.modal {
  width: min(400px, 100%);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  padding: 20px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.modal h2 {
  margin: 0;
  font-size: 18px;
}

.close-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 2px;
  font-size: 18px;
}

.close-btn:hover {
  color: var(--text);
}

.form {
  display: grid;
  gap: 10px;
}

.input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel-2);
  color: var(--text);
  padding: 0 10px;
  outline: none;
  font-size: 13px;
}

.input:focus {
  border-color: rgba(255, 255, 255, .1);
}

.form-note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.link-btn {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link-btn:hover {
  opacity: 0.8;
}

@media (max-width: 720px) {
  .toast-body {
    font-size: 12px;
  }
}

/* Thin dark scrollbars: only the thumb is visible and barely separates from the background. */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(92, 92, 92, .34) transparent;
}

*::-webkit-scrollbar {
  width: 3px;
  height: 3px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: rgba(92, 92, 92, .34);
  border-radius: 999px;
  border: 0;
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(118, 118, 118, .48);
}

*::-webkit-scrollbar-button,
*::-webkit-scrollbar-corner {
  display: none;
  width: 0;
  height: 0;
  background: transparent;
}

/* Emergency-safe thin dark scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(75, 75, 75, .55) transparent;
}
*::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: rgba(75, 75, 75, .55);
  border-radius: 999px;
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(105, 105, 105, .75);
}
