:root {
  color-scheme: dark;
  --bg-0: #080d1a;
  --bg-1: #0f172d;
  --bg-2: #16213f;
  --line: #2e3f73;
  --text-0: #ebf0ff;
  --text-1: #aebae1;
  --good: #63d9ab;
  --warn: #ffd087;
  --focus: #68a2ff;
  font-family: "Segoe UI", "SF Pro Text", Tahoma, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 10% 10%, #22366d55, transparent 40%),
    radial-gradient(circle at 95% 90%, #1a5f7b44, transparent 35%),
    linear-gradient(150deg, var(--bg-0), #0b1224 50%, #121f3b);
  color: var(--text-0);
  padding: 18px;
}

.app-shell {
  width: min(920px, 100%);
  background: #0d1529;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.35);
  padding: 18px;
}

.app-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
}

.brand h1 {
  margin: 0;
  font-size: clamp(26px, 4vw, 34px);
  letter-spacing: 0.01em;
}

.subtitle {
  margin: 6px 0 0;
  color: var(--text-1);
}

.character-picker {
  min-width: min(340px, 100%);
  display: grid;
  gap: 6px;
}

.character-picker label {
  font-size: 12px;
  color: var(--text-1);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#characterSelect {
  width: 100%;
  border: 1px solid #3d518a;
  border-radius: 12px;
  background: #0f1936;
  color: var(--text-0);
  padding: 11px 12px;
  font-size: 15px;
  outline: none;
}

#characterSelect:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px #68a2ff33;
}

.character-select-wrap {
  position: relative;
}

.character-select-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #3d518a;
  border-radius: 12px;
  background: #0f1936;
  color: var(--text-0);
  padding: 8px 10px;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}

.character-select-btn:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px #68a2ff33;
  outline: none;
}

.character-select-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid #405792;
  object-fit: cover;
  flex: 0 0 auto;
}

.character-select-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.character-select-caret {
  color: var(--text-1);
  font-size: 12px;
  flex: 0 0 auto;
}

.character-select-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid #3d518a;
  border-radius: 12px;
  background: #0f1936;
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.4);
  max-height: 300px;
  overflow: auto;
}

.character-option-row {
  margin: 0;
  padding: 0;
}

.character-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-0);
  padding: 7px 8px;
  text-align: left;
  cursor: pointer;
}

.character-option:hover,
.character-option:focus {
  background: #1a2748;
  outline: none;
}

.character-option.is-selected {
  background: #213665;
}

.character-option-avatar,
.character-option-add {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.character-option-avatar {
  border: 1px solid #405792;
  object-fit: cover;
}

.character-option-add {
  display: grid;
  place-items: center;
  border: 1px dashed #5b74b5;
  color: #9bc5ff;
  font-weight: 700;
}

.character-option-text {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn {
  justify-self: end;
  border: 1px solid #4a3b67;
  border-radius: 10px;
  background: #241a36;
  color: var(--text-0);
  padding: 8px 12px;
  cursor: pointer;
}

.logout-btn:hover {
  background: #2f2147;
}

.status-text {
  min-height: 20px;
  margin: 10px 2px 0;
  color: #97d3ff;
  font-size: 14px;
}

.status-text.is-error {
  color: #ffb8c8;
}

.current-character-card {
  margin-top: 8px;
  background: #14203b;
  border: 1px solid #344a82;
  border-radius: 14px;
  padding: 14px;
}

.character-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  color: var(--text-1);
}

.character-line strong {
  color: var(--text-0);
}

.tab-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.tab-btn {
  border: 1px solid #3a4f86;
  background: #1a2748;
  color: var(--text-0);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 600;
}

.tab-btn.is-active {
  background: #2a4f93;
  border-color: #4f74bc;
}

.content-panel {
  background: #0f1935;
  border: 1px solid #2d3f73;
  border-radius: 10px;
  padding: 12px;
}

.content-panel.is-hidden {
  display: none;
}

.wallet-wrap {
  display: grid;
  gap: 8px;
}

.wallet-title {
  margin: 0;
  color: var(--text-1);
}

.wallet-value {
  margin: 0;
  color: var(--good);
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 700;
}

.wallet-updated {
  margin: 0;
  color: var(--text-1);
  font-size: 13px;
}

.wallet-transactions {
  margin-top: 8px;
  border-top: 1px solid #24315d;
  padding-top: 10px;
}

.wallet-transactions-title {
  margin: 0 0 8px;
  color: var(--text-1);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.wallet-transaction-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.wallet-transaction-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid #1f2b52;
}

.wallet-transaction-row:first-child {
  border-top: 0;
}

.wallet-transaction-main {
  min-width: 0;
  flex: 1 1 0;
}

.wallet-transaction-label {
  margin: 0 0 2px;
  color: var(--text-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wallet-transaction-date {
  margin: 0;
  color: var(--text-1);
  font-size: 12px;
}

.wallet-transaction-amount {
  min-width: max-content;
  white-space: nowrap;
  text-align: right;
  font-weight: 700;
}

.wallet-transaction-amount.is-positive {
  color: var(--good);
}

.wallet-transaction-amount.is-negative {
  color: #ff9eb0;
}

.queue-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.queue-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid #24315d;
}

.queue-row:first-child {
  border-top: 0;
}

.queue-main {
  flex: 1;
  min-width: 0;
}

.queue-skill-name {
  color: var(--text-0);
  font-weight: 600;
  margin-bottom: 4px;
}

.queue-levels {
  color: var(--text-1);
  font-size: 13px;
  margin-bottom: 6px;
}

.queue-level-bar {
  display: flex;
  gap: 4px;
  max-width: 220px;
}

.queue-level-segment {
  display: block;
  flex: 1;
  height: 5px;
  border-radius: 999px;
  background: #2a355f;
}

.queue-level-segment.is-complete {
  background: var(--good);
}

.queue-level-segment.is-target {
  background: var(--focus);
}

.queue-time {
  color: #9fd9ff;
  font-weight: 600;
  white-space: nowrap;
  margin-left: 12px;
}

.queue-total {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid #2a3b6f;
  color: var(--warn);
  font-weight: 700;
}

.mail-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.mail-filter-btn {
  border: 1px solid #3a4f86;
  background: #1a2748;
  color: var(--text-0);
  border-radius: 999px;
  padding: 7px 12px;
  cursor: pointer;
  font-weight: 600;
}

.mail-filter-btn.is-active {
  background: #2a4f93;
  border-color: #4f74bc;
}

.mail-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid #24315d;
}

.mail-row:first-child {
  border-top: 0;
}

.mail-row.is-unread .mail-subject {
  color: #d2e3ff;
}

.mail-main {
  min-width: 0;
  flex: 1;
}

.mail-subject {
  margin: 0 0 4px;
  color: var(--text-0);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mail-meta {
  margin: 0;
  color: var(--text-1);
  font-size: 13px;
}

.mail-time {
  color: #9fd9ff;
  white-space: nowrap;
  font-size: 13px;
}

.empty-text {
  margin: 0;
  color: var(--text-1);
}

@media (max-width: 700px) {
  body {
    padding: 10px;
  }

  .app-shell {
    padding: 14px;
    border-radius: 14px;
  }

  .character-picker {
    min-width: 100%;
  }

  .queue-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .queue-time {
    margin-left: 0;
  }
}
