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

html, body {
  width: 100%;
  height: 100%;
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
}

:root {
  --card-width: 720px;
  --card-bg: rgba(18, 18, 18, 0.92);
  --card-border: rgba(255, 255, 255, 0.08);
  --text: #f3f3f3;
  --muted: #b6b6b6;
  --accent: #cce46b;
  --accent-2: #f5c669;
  --success: #83e37d;
  --error: #f38a8a;
}

/* ================= BACKGROUND ================= */
#page-bg-wrapper {
  position: fixed;
  inset: 0;
  z-index: -10;
  pointer-events: none;
}

#page-bg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  image-rendering: auto;
}

.pixel-art #page-bg {
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  -ms-interpolation-mode: nearest-neighbor;
  -webkit-optimize-contrast: pixelated;
}

/* ================= PAGE ================= */
body {
  color: var(--text);
  background: #000;
}

#account-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 16px;
}

/* ================= CARD ================= */
.account-card {
  width: min(100%, var(--card-width));
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  border-radius: 0;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 14px 0 rgba(0, 0, 0, 0.35);
}

.login-required {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  text-align: center;
}

.login-required.is-hidden {
  display: none;
}

.login-actions {
  display: flex;
  gap: 12px;
}

.login-link {
  color: #4aa3ff;
  text-decoration: underline;
  font-size: 14px;
}

.login-link:hover {
  color: #78b9ff;
}

.card-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
  align-items: center;
}

.card-header h1 {
  font-size: 24px;
  letter-spacing: 0.02em;
}

.subtitle {
  color: var(--muted);
  font-size: 14px;
}

.logo-frame {
  width: 88px;
  height: 88px;
  border-radius: 0;
  border: 2px dashed rgba(255, 255, 255, 0.25);
  display: grid;
  place-items: center;
  margin: 0 auto 6px auto;
  background: rgba(0, 0, 0, 0.25);
}

.logo-image {
  width: 72px;
  height: 72px;
  object-fit: contain;
  image-rendering: auto;
}

/* ================= PANELS ================= */
.panel {
  border: 2px solid rgba(255, 255, 255, 0.1);
  padding: 16px;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel h2 {
  font-size: 18px;
}

.profile-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  align-items: start;
}

.avatar-preview {
  width: 140px;
  height: 140px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.4);
  object-fit: cover;
  image-rendering: auto;
}

.avatar-cropper {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

.avatar-cropper.is-open {
  display: flex;
}

.avatar-cropper-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}

.avatar-cropper-panel {
  position: relative;
  background: #101010;
  border: 2px solid rgba(255, 255, 255, 0.2);
  padding: 16px;
  width: min(92vw, 420px);
  z-index: 1;
}

.avatar-cropper-header {
  margin-bottom: 12px;
}

.avatar-cropper-canvas-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.avatar-cropper-canvas-wrap canvas {
  image-rendering: auto;
  background: transparent;
}

.avatar-cropper-zoom {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  margin-bottom: 16px;
}

.avatar-cropper-zoom input {
  flex: 1;
}

.avatar-cropper-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.secondary-btn {
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 8px 12px;
  cursor: pointer;
}

.profile-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ================= FORM ================= */
.account-form,
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field input,
.field textarea {
  background: rgba(0, 0, 0, 0.45);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 0;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  width: 100%;
}

.field textarea {
  resize: vertical;
  min-height: 96px;
}

.form-message {
  min-height: 18px;
  font-size: 13px;
}

.form-message.is-success {
  color: var(--success);
}

.form-message.is-error {
  color: var(--error);
}

/* ================= BUTTONS ================= */
.primary-btn {
  margin-top: 4px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1b1b1b;
  border: 2px solid rgba(0, 0, 0, 0.35);
  border-radius: 0;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  text-align: center;
}

@media (max-width: 720px) {
  .profile-row {
    grid-template-columns: 1fr;
  }

  .avatar-preview {
    width: 120px;
    height: 120px;
    margin: 0 auto;
  }
}
