:root {
  --bg: #0b0f14;
  --bg-elevated: #121820;
  --bg-panel: #161d27;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8edf4;
  --text-muted: #8b9cb3;
  --primary: #0891ff;
  --primary-hover: #3aa7ff;
  --accent: #00d4aa;
  --danger: #ff6b6b;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --radius: 14px;
  --font: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

body {
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(8, 145, 255, 0.18), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(0, 212, 170, 0.08), transparent),
    var(--bg);
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 64px;
  background: rgba(11, 15, 20, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.navbar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.navbar__logo {
  width: 36px;
  height: 36px;
}

.navbar__title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: linear-gradient(90deg, var(--text), #b8d4ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--primary {
  background: linear-gradient(135deg, var(--primary), #0670cc);
  color: #fff;
  box-shadow: 0 4px 20px rgba(8, 145, 255, 0.35);
}

.btn--primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--primary-hover), var(--primary));
  transform: translateY(-1px);
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
  color: var(--text);
}

.btn--ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn--text {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 4px 8px;
  font-size: 13px;
}

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

/* Dropdown */
.dropdown {
  position: relative;
}

.dropdown__trigger svg {
  opacity: 0.7;
}

.dropdown__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  padding: 6px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.dropdown__menu[hidden] {
  display: none;
}

.dropdown__item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.dropdown__item:hover {
  background: rgba(8, 145, 255, 0.12);
  color: var(--primary-hover);
}

/* Main */
.main {
  flex: 1;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 48px 28px 64px;
}

.hero {
  text-align: center;
  margin-bottom: 40px;
}

.hero__title {
  margin: 0 0 24px;
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 700;
  line-height: 1.25;
  background: linear-gradient(135deg, #fff 0%, #a8c8ff 50%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero__desc {
  text-align: left;
  max-width: 780px;
  margin: 0 auto;
  padding: 20px 24px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.75;
}

.hero__desc p {
  margin: 0 0 10px;
}

.hero__desc p:last-child {
  margin-bottom: 0;
}

.hero__desc strong {
  color: var(--text);
}

/* Panel */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.panel__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.field--full {
  grid-column: 1 / -1;
}

.field__label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.field__input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field__input:focus {
  border-color: rgba(8, 145, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(8, 145, 255, 0.15);
}

.field__input::placeholder {
  color: #5a6a80;
}

/* Log */
.log-section {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.log-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.log {
  margin: 0;
  padding: 16px;
  min-height: 220px;
  max-height: 360px;
  overflow: auto;
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: 12px;
  line-height: 1.6;
  color: #b8c5d6;
  white-space: pre-wrap;
  word-break: break-all;
}

.log .line-warn { color: #ffc857; }
.log .line-error { color: var(--danger); }
.log .line-info { color: #8ec8ff; }

/* Modal */
.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal__dialog {
  position: relative;
  width: min(720px, 100%);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.modal__title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.modal__close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.modal__close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.modal__body {
  padding: 20px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-muted);
}

.modal__body ol {
  margin: 0;
  padding-left: 20px;
}

.modal__body li {
  margin-bottom: 8px;
}

.modal__body a {
  color: var(--primary-hover);
}

.tutorial-video-wrap {
  margin-bottom: 16px;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
}

.tutorial-video {
  display: block;
  width: 100%;
  max-height: 360px;
  background: #000;
}

.payment {
  text-align: center;
}

.payment__desc {
  margin: 0 0 8px;
  color: var(--text-muted);
}

.payment__amount {
  color: #ffb020;
  font-size: 28px;
}

.payment__hint {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.payment__qr-wrap {
  display: inline-flex;
  padding: 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--border);
  margin-bottom: 12px;
}

.payment__qr {
  display: block;
}

.payment__status {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}

.payment__status--ok {
  color: #3dd68c;
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 20px 20px;
}

.modal__footer[hidden] {
  display: none;
}

.folder-prompt__hint {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

.folder-prompt__hint--tight {
  margin: 8px 0 0;
  font-size: 13px;
}

.field__label--spaced {
  margin-top: 16px;
}

.folder-prompt {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.folder-prompt__input {
  flex: 1;
  min-width: 0;
}

.folder-prompt__error {
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 13px;
}

.upload-field {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px dashed rgba(8, 145, 255, 0.35);
  background: rgba(0, 0, 0, 0.2);
}

.upload-field__input {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 100%;
}

.upload-field__name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Status panel */
.status-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
  padding: 20px 24px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.status-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.status-item__label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-item__value {
  font-size: 14px;
  color: var(--text-muted);
  word-break: break-all;
}

.status-item__value--ok {
  color: var(--accent);
}

.status-item__value--warn {
  color: #ffc857;
}

@media (max-width: 640px) {
  .navbar {
    padding: 0 16px;
    flex-wrap: wrap;
    height: auto;
    min-height: 64px;
    gap: 12px;
  }

  .navbar__actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

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

  .main {
    padding: 32px 16px 48px;
  }
}
