/* ── Modal overlay ───────────────────────────────────────────────── */
.dw-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dw-modal {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  min-width: 280px;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.dw-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid #30363d;
  background: #0d1117;
  border-radius: 8px 8px 0 0;
}

.dw-modal-title {
  font-size: 13px;
  font-weight: 600;
  color: #c9d1d9;
}

.dw-modal-close {
  background: none;
  border: none;
  color: #484f58;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  line-height: 1;
}
.dw-modal-close:hover { color: #c9d1d9; }

.dw-modal-body {
  padding: 12px;
  overflow-y: auto;
  flex: 1;
}

/* ── Layout containers ──────────────────────────────────────────── */
.dw-layout-vertical {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dw-layout-horizontal {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: center;
}

.dw-layout-grid {
  display: grid;
  gap: 8px;
}

/* ── Display elements ───────────────────────────────────────────── */
.dw-heading {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #c9d1d9;
}

.dw-paragraph {
  margin: 0;
  font-size: 12px;
  color: #8b949e;
  line-height: 1.5;
}

.dw-text {
  font-size: 12px;
  color: #c9d1d9;
}

.dw-divider {
  border: none;
  border-top: 1px solid #21262d;
  margin: 4px 0;
}

.dw-progress {
  position: relative;
  height: 16px;
  background: linear-gradient(180deg, #0d1117, #161b22);
  border: 1px solid #30363d;
  border-radius: 999px;
  overflow: hidden;
}

.dw-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2388ff, #6fb6ff);
  transition: width 0.3s ease;
}

.dw-progress-label {
  position: absolute;
  top: 0;
  left: 8px;
  right: 8px;
  font-size: 10px;
  line-height: 16px;
  color: #f0f6fc;
  font-weight: 700;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.65);
}

/* ── Form fields ────────────────────────────────────────────────── */
.dw-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.dw-label {
  font-size: 11px;
  color: #8b949e;
  font-weight: 600;
}

.dw-input, .dw-select {
  background: #0d1117;
  border: 1px solid #30363d;
  color: #c9d1d9;
  padding: 5px 8px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 12px;
  outline: none;
}

.dw-input:focus, .dw-select:focus {
  border-color: #58a6ff;
}

.dw-checkbox-field {
  flex-direction: row;
  align-items: center;
}

.dw-checkbox-label {
  font-size: 12px;
  color: #c9d1d9;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Buttons ────────────────────────────────────────────────────── */
.dw-button {
  background: #21262d;
  color: #c9d1d9;
  border: 1px solid #30363d;
  padding: 5px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
}
.dw-button:hover { background: #30363d; }

.dw-button-primary {
  background: #238636;
  border-color: #2ea043;
  color: #fff;
}
.dw-button-primary:hover { background: #2ea043; }

.dw-button-secondary {
  background: #21262d;
  border-color: #30363d;
}

/* ── Image display ─────────────────────────────────────────────── */
.dw-image {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  background: #0d1117;
  min-height: 80px;
}

.dw-image img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.dw-image.dw-image-loaded img {
  opacity: 1;
}

.dw-image-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: #8b949e;
  font-size: 12px;
  font-style: italic;
  text-align: center;
  white-space: pre-line;
  line-height: 1.5;
}

.dw-image.dw-image-loaded .dw-image-loading {
  display: none;
}

.dw-image.dw-image-error img {
  display: none;
}

.dw-image.dw-image-error {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
}

.dw-image.dw-image-error .dw-image-loading {
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
}

/* ── Rich player rows ────────────────────────────────────────────── */
.dw-player-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(22, 27, 34, 0.98), rgba(13, 17, 23, 0.98));
  min-height: 72px;
}

.dw-player-row:hover {
  border-color: #3d4a58;
  background: linear-gradient(180deg, rgba(25, 32, 41, 0.98), rgba(13, 17, 23, 0.98));
}

.dw-player-row-avatar-button {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1px solid #30363d;
  border-radius: 8px;
  overflow: hidden;
  background: #0d1117;
  cursor: zoom-in;
}

.dw-player-row-avatar-button:focus-visible {
  outline: 2px solid #58a6ff;
  outline-offset: 2px;
}

.dw-player-row-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.dw-player-row-body {
  min-width: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 5px;
}

.dw-player-row-line {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.dw-player-row-line1 {
  color: #f0f6fc;
}

.dw-player-row-line2 {
  color: #9fb3c8;
  font-size: 12px;
}

.dw-player-row-level {
  flex: 0 0 auto;
  min-width: 44px;
  padding: 2px 6px;
  border: 1px solid #58a6ff;
  border-radius: 999px;
  color: #e6edf3;
  background: rgba(88, 166, 255, 0.12);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.dw-player-row-name {
  min-width: 0;
  color: #f0f6fc;
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.dw-player-row-achievement {
  min-width: 0;
  color: #f2cc60;
  font-size: 12px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.dw-player-row-title {
  min-width: 0;
  overflow-wrap: anywhere;
}

.dw-player-row-designation {
  color: #79c0ff;
  font-weight: 600;
}

.dw-player-row-designation::before {
  content: "•";
  margin-right: 7px;
  color: #484f58;
  font-weight: 400;
}

.dw-player-row-flags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

.dw-player-row-flag {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 1px 6px;
  border: 1px solid #30363d;
  border-radius: 999px;
  background: rgba(48, 54, 61, 0.55);
  color: #c9d1d9;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
  text-transform: uppercase;
}

.dw-avatar-lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 3100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.78);
}

.dw-avatar-lightbox-frame {
  position: relative;
  max-width: 80vw;
  max-height: 80vh;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #0d1117;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.62);
}

.dw-avatar-lightbox-image {
  display: block;
  max-width: 80vw;
  max-height: 80vh;
  border-radius: 8px;
  object-fit: contain;
}

.dw-avatar-lightbox-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(201, 209, 217, 0.28);
  border-radius: 999px;
  background: rgba(13, 17, 23, 0.86);
  color: #c9d1d9;
  cursor: pointer;
  line-height: 1;
}

.dw-avatar-lightbox-close:hover,
.dw-avatar-lightbox-close:focus-visible {
  border-color: #58a6ff;
  color: #f0f6fc;
}

/* ── Login modal (game-launcher style) ─────────────────────────── */
.dw-login-overlay {
  background: rgba(0, 0, 0, 0.8);
}

.dw-login-modal {
  flex-direction: row;
  width: 680px;
  max-width: 95vw;
  height: 480px;
  max-height: 90vh;
  overflow: hidden;
}

.dw-login-art {
  width: 260px;
  min-width: 260px;
  overflow: hidden;
  position: relative;
  border-radius: 8px 0 0 8px;
}

.dw-login-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  display: block;
}

.dw-login-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 32px 28px 24px;
  justify-content: center;
  overflow-y: auto;
}

.dw-login-brand {
  font-size: 28px;
  font-weight: 700;
  color: #c9d1d9;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 2px;
}

.dw-login-tagline {
  font-size: 13px;
  color: #58a6ff;
  text-align: center;
  margin-bottom: 24px;
  letter-spacing: 0.5px;
}

.dw-login-body {
  padding: 0;
}

/* Hide the server-sent heading/error in login since we have our own brand header */
.dw-login-body .dw-heading {
  display: none;
}

/* Style the login error message */
.dw-login-body .dw-paragraph[data-dw-id="error"]:empty {
  display: none;
}

/* Larger inputs for login */
.dw-login-body .dw-input {
  padding: 8px 12px;
  font-size: 13px;
}

/* Larger login buttons */
.dw-login-body .dw-button {
  padding: 8px 20px;
  font-size: 13px;
}

.dw-login-body .dw-button-primary {
  background: #238636;
  border-color: #2ea043;
  box-shadow: 0 0 12px rgba(35, 134, 54, 0.3);
  transition: background 0.15s, box-shadow 0.15s;
}

.dw-login-body .dw-button-primary:hover {
  background: #2ea043;
  box-shadow: 0 0 18px rgba(46, 160, 67, 0.4);
}

/* ── Login modal responsive ─────────────────────────────────────── */
@media (max-width: 600px) {
  .dw-login-modal {
    flex-direction: column;
    width: 95vw;
    height: auto;
    max-height: 90vh;
  }

  .dw-login-art {
    width: 100%;
    min-width: unset;
    height: 160px;
    border-radius: 8px 8px 0 0;
  }

  .dw-login-form {
    padding: 20px 20px 16px;
  }
}
