:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --card: rgba(255, 255, 255, 0.92);
  --line: rgba(105, 10, 10, 0.24);
  --ink: #070a12;
  --muted: rgba(7, 10, 18, 0.72);
  --quiet: rgba(7, 10, 18, 0.52);
  --accent: #a9b8ff;
  --accent-dark: #0b1020;
  --soft: rgba(169, 184, 255, 0.18);
  --field-bg: rgba(255, 255, 255, 0.98);
  --field-border: rgba(11, 16, 32, 0.16);
  --focus-ring: rgba(169, 184, 255, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(125, 12, 12, 0.28), rgba(255, 255, 255, 0) 34%),
    radial-gradient(circle at bottom right, rgba(80, 8, 8, 0.22), rgba(255, 255, 255, 0) 38%),
    linear-gradient(180deg, #f3ebe6 0%, #f7efeb 58%, #eadbd4 100%);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.45;
}

.page,
.page-shell {
  min-height: 100vh;
  padding: 1.75rem 1rem 3.5rem;
  max-width: 72rem;
  margin: 0 auto;
}

.topline {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.brand {
  color: var(--ink);
}

.brand-title {
  font-family: Arial, sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 2.05rem;
  line-height: 0.95;
}

.brand-strap {
  margin-top: 0.15rem;
  font-size: 0.72rem;
  line-height: 1.1;
  color: rgba(11, 16, 32, 0.58);
}

.intro-panel {
  margin: 0 auto 1.4rem;
  padding: 2rem 1.5rem 1.35rem;
  border-radius: 1.75rem;
  background:
    linear-gradient(135deg, rgba(125, 12, 12, 0.32), rgba(255, 255, 255, 0.34) 46%, rgba(11, 19, 48, 0.08) 100%),
    rgba(231, 236, 243, 0.42);
  box-shadow: 0 14px 34px rgba(11, 16, 32, 0.08);
  border: 1px solid rgba(105, 10, 10, 0.30);
}

.card,
.panel {
  max-width: 56rem;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.6rem;
  padding: 1.6rem;
  box-shadow: 0 1rem 2.2rem rgba(11, 16, 32, 0.1);
  backdrop-filter: blur(1px);
}

.card-login,
.panel-login {
  max-width: 32rem;
}

.card-header,
.panel-header {
  margin-bottom: 1.4rem;
}

.card-header-profile,
.panel-header-profile {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-start;
}

.brand-label {
  margin: 0 0 0.7rem;
  color: #0b1330;
  font-family: Arial, sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 0.6rem;
  font-size: clamp(2.25rem, 4.5vw, 3.5rem);
  line-height: 1;
  letter-spacing: -0.04em;
  font-weight: 500;
}

.intro,
.lead {
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
  max-width: 42rem;
}

.message-area {
  min-height: 1.5rem;
  margin-top: 1.1rem;
  padding: 0.95rem 1rem;
  border: 1px solid rgba(105, 10, 10, 0.18);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 0.95rem;
}

.message-area-info {
  border-color: rgba(102, 112, 128, 0.28);
  background: rgba(236, 240, 245, 0.92);
  color: rgba(27, 36, 52, 0.82);
}

.message-area-success {
  border-color: #8ca678;
  background: #edf4e8;
  color: #365126;
}

.message-area-warning {
  border-color: #ccb06a;
  background: #fbf4de;
  color: #6f5310;
}

.message-area-error {
  border-color: #c88d82;
  background: #f9e9e6;
  color: #7f2417;
}

.is-hidden {
  display: none;
}

.toast-message {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5000;
  width: min(30rem, calc(100vw - 2rem));
  min-height: 0;
  margin: 0;
  margin-top: 0;
  border-width: 2px;
  padding: 0.95rem 1rem;
  box-shadow: 0 1rem 2rem rgba(11, 16, 32, 0.18);
}

.form-stack {
  display: grid;
  gap: 1.35rem;
}

.field-group {
  margin: 0;
  border: 1px solid rgba(105, 10, 10, 0.2);
  border-radius: 1.15rem;
  padding: 1.1rem;
  background: rgba(255, 255, 255, 0.55);
}

.field-group legend {
  padding: 0 0.5rem;
  font-family: Arial, sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.profile-section {
  padding: 0;
  overflow: clip;
}

.profile-section > summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 1rem 1.1rem;
  cursor: pointer;
  list-style: none;
  font-family: Arial, sans-serif;
}

.profile-section > summary::-webkit-details-marker {
  display: none;
}

.profile-section > summary::after {
  content: "+";
  flex: 0 0 auto;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  color: rgba(11, 16, 32, 0.62);
}

.profile-section[open] > summary::after {
  content: "−";
}

.profile-section-title {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.profile-section-hint {
  display: block;
  margin-left: auto;
  padding-right: 0.5rem;
  color: var(--quiet);
  font-size: 0.82rem;
  font-weight: 400;
  text-align: right;
}

.profile-section-body {
  padding: 0 1.1rem 1.1rem;
}

.form-row {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.form-row:last-child {
  margin-bottom: 0;
}

.form-row-identity {
  grid-template-columns: minmax(11rem, 1fr) minmax(11rem, 1fr);
  align-items: end;
  gap: 1rem;
}

.form-row-compact-pair {
  grid-template-columns: minmax(12rem, 1.15fr) minmax(12rem, 0.85fr);
  align-items: start;
  gap: 1rem;
}

.field-compact {
  display: grid;
  gap: 0.5rem;
}

label {
  font-family: Arial, sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
}

.inline-option {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  font-weight: 400;
}

.inline-option input {
  width: auto;
  margin: 0;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.95rem 1rem;
  border: 1px solid var(--field-border);
  border-radius: 1rem;
  background: var(--field-bg);
  color: var(--ink);
  font-family: Arial, sans-serif;
}

input::placeholder,
textarea::placeholder {
  color: rgba(7, 10, 18, 0.42);
  font-size: 0.92em;
}

input:focus,
select:focus,
textarea:focus,
button:focus {
  outline: none;
  box-shadow: 0 0 0 0.25rem var(--focus-ring);
}

textarea {
  resize: vertical;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-start;
  padding-top: 0.25rem;
}

button {
  border: 0;
  border-radius: 1rem;
  padding: 0.9rem 1.25rem;
  /* CR-style alternative:
  background: var(--accent-dark);
  color: #e7ecf3;
  */
  background: #8d3a1f;
  color: #fff;
  font-family: Arial, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 120ms ease, transform 120ms ease;
}

button:hover {
  /* CR-style alternative:
  background: #070a12;
  */
  background: #692510;
  transform: translateY(-1px);
}

#reset-profile {
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  border: 1px solid rgba(11, 16, 32, 0.16);
}

#reset-profile:hover {
  background: #ffffff;
}

#logout-button {
  white-space: nowrap;
}

@media (max-width: 42rem) {
  .page,
  .page-shell {
    padding: 1rem 0.75rem 2rem;
  }

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

  .intro-panel {
    padding: 1.4rem 1rem 1rem;
    border-radius: 1.3rem;
  }

  .card,
  .panel {
    padding: 1rem;
  }

  .card-header-profile,
  .panel-header-profile {
    flex-direction: column;
  }

  .form-row-identity {
    grid-template-columns: 1fr;
  }

  .form-row-compact-pair {
    grid-template-columns: 1fr;
  }

  .profile-section > summary {
    align-items: flex-start;
  }

  .profile-section-hint {
    max-width: 12rem;
  }

  .form-actions {
    flex-direction: column;
  }

  button {
    width: 100%;
  }

  .toast-message {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: auto;
  }
}
