:root {
  --bg: #1f1f1f;
  --bg-elevated: #262626;
  --bg-soft: #2d2d2d;
  --bg-input: #303030;
  --line: #3a3a3a;
  --line-strong: #4a4a4a;
  --text-main: #ececec;
  --text-sub: #a9a9a9;
  --text-dim: #8e8e8e;
  --accent: #7ab3ff;
  --accent-soft: rgba(122, 179, 255, 0.2);
  --ok: #59c88a;
  --warn: #f0be63;
  --error: #eb7e7e;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "PingFang SC",
    "Hiragino Sans GB",
    "Microsoft YaHei",
    sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(1100px 560px at 50% 40%, #242424 0%, var(--bg) 60%),
    var(--bg);
  min-height: 100vh;
}

.page {
  min-height: 100vh;
  padding: 22px;
}

.container {
  width: min(1180px, 96vw);
  margin: 0 auto;
}

.header {
  margin-bottom: 22px;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.header h1 {
  font-size: clamp(1.9rem, 4.8vw, 2.6rem);
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #f3f3f3;
  text-align: center;
}

.lang-btn {
  border: 1px solid #4b4b4b;
  border-radius: 999px;
  background: #2d2d2d;
  color: #dcdcdc;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s ease;
}

.lang-btn:hover {
  border-color: #6f97d5;
  color: #eaf2ff;
  background: #364052;
}

.header p {
  margin-top: 8px;
  color: var(--text-sub);
  font-size: 0.98rem;
}

.nav-links {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}

.entry-switch {
  margin-bottom: 14px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.entry-switch-label {
  color: #d2d2d2;
  font-size: 0.88rem;
}

.entry-switch-actions {
  display: flex;
  gap: 8px;
}

.entry-btn {
  border: 1px solid #484848;
  background: #2f2f2f;
  color: #cfcfcf;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.18s ease;
}

.entry-btn:hover {
  border-color: #5a5a5a;
  color: #e1e1e1;
}

.entry-btn.is-active {
  border-color: #6f97d5;
  color: #dce9ff;
  background: #374252;
}

.entry-switch-tip {
  margin-left: auto;
  color: #a1a1a1;
  font-size: 0.82rem;
}

.nav-link {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #2a2a2a;
  color: var(--text-sub);
  padding: 9px 18px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-link:hover {
  border-color: var(--line-strong);
  color: #d5d5d5;
}

.nav-link.is-active {
  background: #373737;
  color: #f0f0f0;
  border-color: #4a4a4a;
}

.panel {
  display: none;
}

.panel.is-active {
  display: block;
}

.redeem-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.card-shell {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.guide-panel {
  padding: 14px;
  position: sticky;
  top: 14px;
}

.guide-panel h3 {
  margin-bottom: 12px;
  font-size: 1rem;
  color: #e7e7e7;
}

.guide-list {
  list-style: none;
  display: grid;
  gap: 9px;
}

.guide-list li {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #2b2b2b;
}

.guide-list h4 {
  margin-bottom: 5px;
  font-size: 0.87rem;
  color: #e3e3e3;
}

.guide-list p {
  color: var(--text-dim);
  font-size: 0.82rem;
  line-height: 1.45;
}

.guide-list a {
  display: inline-block;
  margin-top: 6px;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.82rem;
}

.guide-list a:hover {
  text-decoration: underline;
}

.guide-note {
  margin-top: 10px;
  border: 1px solid #5c5131;
  border-radius: 12px;
  padding: 10px;
  background: rgba(124, 98, 39, 0.14);
}

.guide-note strong {
  display: block;
  margin-bottom: 5px;
  color: #e4c887;
  font-size: 0.84rem;
}

.guide-note p {
  color: #c6b289;
  font-size: 0.81rem;
  line-height: 1.42;
}

.redeem-main {
  min-width: 0;
}

.progress-bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  margin-bottom: 14px;
  overflow: hidden;
  background: #343434;
  border: 1px solid #3f3f3f;
}

.progress-fill {
  height: 100%;
  width: 25%;
  border-radius: 999px;
  background: linear-gradient(90deg, #6fa8ff, #8dc3ff);
  transition: width 0.24s ease;
}

.steps-container {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.step-item {
  flex: 1;
  text-align: center;
  color: var(--text-dim);
}

.step-index {
  width: 34px;
  height: 34px;
  margin: 0 auto 6px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.86rem;
  font-weight: 600;
  border: 1px solid #4a4a4a;
  background: #313131;
  color: #b5b5b5;
}

.step-title {
  font-size: 0.84rem;
}

.step-item.is-current,
.step-item.is-done {
  color: #dddddd;
}

.step-item.is-current .step-index {
  border-color: #719ad8;
  color: #dbe8ff;
  background: #3b4658;
}

.step-item.is-done .step-index {
  border-color: #5f876d;
  color: #c8efd8;
  background: #34453d;
}

.card-wrapper {
  perspective: 1000px;
}

.card {
  display: none;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.24s ease;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
}

.step-card.is-active,
.query-card.is-active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.card h2 {
  margin-bottom: 8px;
  font-size: 1.18rem;
  color: #f0f0f0;
}

.muted {
  margin-bottom: 14px;
  color: var(--text-sub);
  line-height: 1.52;
  font-size: 0.92rem;
}

label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: #d4d4d4;
}

input,
textarea {
  width: 100%;
  border: 1px solid #4a4a4a;
  border-radius: 12px;
  background: var(--bg-input);
  color: #f1f1f1;
  padding: 11px 12px;
  font: inherit;
  margin-bottom: 12px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: #6f97d5;
  box-shadow: 0 0 0 3px rgba(111, 151, 213, 0.2);
}

textarea {
  min-height: 130px;
  resize: vertical;
  line-height: 1.4;
}

.short-area {
  min-height: 108px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 16px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
}

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

.btn-primary {
  background: #3a3a3a;
  border-color: #4a4a4a;
  color: #f2f2f2;
}

.btn-primary:hover:not(:disabled) {
  background: #444;
}

.btn-secondary {
  background: #2f2f2f;
  border-color: #454545;
  color: #d8d8d8;
}

.btn-secondary:hover:not(:disabled) {
  background: #383838;
}

.notice {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 44px;
  padding: 10px 12px;
  background: #2b2b2b;
  color: #d2d2d2;
  white-space: pre-line;
}

.notice-ok {
  border-color: rgba(89, 200, 138, 0.5);
  color: #bde7cd;
}

.notice-error {
  border-color: rgba(235, 126, 126, 0.55);
  color: #f2b0b0;
}

.notice-warn {
  border-color: rgba(240, 190, 99, 0.52);
  color: #f2d195;
}

.user-info-box {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #2a2a2a;
}

.user-info-box h4 {
  margin-bottom: 6px;
  color: #d8d8d8;
  font-size: 0.88rem;
}

#userInfoContent {
  margin: 0;
  color: #afafaf;
  font-size: 0.82rem;
  line-height: 1.42;
  white-space: pre-wrap;
}

#step2CdkeyContent {
  margin: 0;
  color: #afafaf;
  font-size: 0.82rem;
  line-height: 1.42;
  white-space: pre-wrap;
}

.confirm-list {
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
}

.confirm-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.confirm-list li:last-child {
  border-bottom: 0;
}

.confirm-list span {
  color: #a9a9a9;
}

.confirm-list strong {
  text-align: right;
  word-break: break-all;
}

.table-wrap {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: auto;
}

.query-table {
  width: 100%;
  border-collapse: collapse;
}

.query-table th,
.query-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  font-size: 0.88rem;
  text-align: left;
}

.query-table th {
  color: #cfcfcf;
  background: #2f2f2f;
}

.query-table tr:last-child td {
  border-bottom: 0;
}

.empty-row {
  text-align: center;
  color: #989898;
}

.log-panel {
  margin-top: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}

.log-panel h3 {
  margin-bottom: 8px;
  color: #e6e6e6;
  font-size: 1rem;
}

#rawOutput {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 110px;
  background: #2a2a2a;
  padding: 10px;
  font-size: 0.82rem;
  overflow: auto;
}

.site-footer {
  margin-top: 14px;
  text-align: center;
  color: #8c8c8c;
  font-size: 0.8rem;
  line-height: 1.6;
}

@media (max-width: 980px) {
  .redeem-layout {
    grid-template-columns: 1fr;
  }

  .guide-panel {
    position: static;
  }
}

@media (max-width: 680px) {
  .page {
    padding: 12px;
  }

  .nav-links {
    flex-direction: column;
  }

  .header-row {
    justify-content: space-between;
  }

  .nav-link {
    width: 100%;
  }

  .entry-switch {
    align-items: flex-start;
  }

  .entry-switch-tip {
    margin-left: 0;
    width: 100%;
  }

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

  .actions .btn {
    width: 100%;
  }

  .confirm-list li {
    flex-direction: column;
  }
}
