:root {
  color-scheme: dark;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #0b0d10;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 32px 0;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at top, #20252d 0, #0b0d10 62%);
}

.tool {
  width: min(860px, calc(100vw - 32px));
}

.login-card {
  width: min(420px, calc(100vw - 32px));
  padding: 22px;
  border: 1px solid #39414c;
  border-radius: 12px;
  background: rgba(17, 20, 25, 0.96);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
}

#login-form {
  display: grid;
  gap: 12px;
}

#login-form input {
  min-height: 48px;
  font-size: 16px;
}

.login-message,
.device-message {
  min-height: 20px;
  margin: 10px 0 0;
  color: #d5a9ad;
  font-size: 13px;
  line-height: 1.5;
}

.login-message:empty,
.device-message:empty {
  display: none;
}

.login-card > h1 {
  margin-bottom: 14px;
}

.helper-downloads {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 16px 0 12px;
}

.helper-downloads a {
  display: grid;
  min-height: 44px;
  padding: 8px 12px;
  place-items: center;
  color: #e6e9ed;
  border: 1px solid #46505c;
  border-radius: 9px;
  background: #22272e;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

#device-verify,
#device-back {
  width: 100%;
  margin-top: 10px;
}

.helper-note {
  margin: 14px 0 0;
  color: #9ea7b1;
  font-size: 12px;
  line-height: 1.6;
}

.history-count {
  color: #9ea7b1;
  font-size: 13px;
  font-weight: 400;
}

.challenge-title {
  display: block;
  margin: 0 0 10px;
  color: #f4f6f8;
  font-size: 20px;
  font-weight: 700;
}

textarea {
  display: block;
  width: 100%;
  height: 116px;
  min-height: 96px;
  max-height: 260px;
  resize: vertical;
  border: 1px solid #39414c;
  border-radius: 12px;
  outline: none;
  padding: 18px;
  color: #f4f6f8;
  background: rgba(17, 20, 25, 0.94);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  font: 15px/1.55 Consolas, monospace;
}

textarea:focus {
  border-color: #74808f;
}

.actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.actions .quiet {
  min-height: 48px;
}

button {
  min-height: 48px;
  border: 0;
  border-radius: 10px;
  color: #0b0d10;
  background: #eef1f4;
  font: 600 16px/1 "Segoe UI", "Microsoft YaHei", sans-serif;
  cursor: pointer;
}

button:disabled {
  opacity: 0.35;
  cursor: default;
}

button.quiet {
  min-height: 36px;
  padding: 0 14px;
  color: #e6e9ed;
  border: 1px solid #46505c;
  background: #22272e;
  font-size: 14px;
}

button.compact {
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

button.danger {
  color: #fff;
  background: #a52d35;
}

dialog {
  width: min(1180px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  color: #eef1f4;
  border: 1px solid #3b444f;
  border-radius: 14px;
  background: #111419;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.65);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.75);
}

dialog > header,
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

h1,
h2 {
  margin: 0;
  font-weight: 600;
}

h1 {
  font-size: 22px;
}

h2 {
  font-size: 17px;
}

dialog section {
  margin-top: 24px;
}

#account-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  margin-top: 12px;
}

input {
  min-width: 0;
  min-height: 42px;
  padding: 0 12px;
  color: #f4f6f8;
  border: 1px solid #39414c;
  border-radius: 8px;
  outline: none;
  background: #171b21;
}

input:focus {
  border-color: #74808f;
}

.message {
  min-height: 20px;
  margin: 8px 0;
  color: #c7cdd4;
  font-size: 13px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid #303842;
  border-radius: 9px;
}

.history-wrap {
  max-height: 45vh;
  margin-top: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}

th,
td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #2b323a;
}

th {
  position: sticky;
  top: 0;
  color: #bfc6ce;
  background: #1c2128;
}

tbody tr:last-child td {
  border-bottom: 0;
}

@media (max-width: 520px) {
  body {
    padding: 16px 0;
    place-items: start center;
  }

  textarea {
    height: 132px;
    min-height: 108px;
    max-height: 240px;
  }

  #account-form {
    grid-template-columns: 1fr;
  }
}
