/* Hallmark · pre-emit critique: P5 H5 E4 S5 R5 V4 */
/* Hallmark · component: account menu · genre: playful · theme: PolyTrack native
 * states: default · hover · focus · active · disabled · loading · error · success
 * contrast: pass (40–41) · responsive: pass (34, 49–57) · icons: pass (30)
 */
:root {
  --cheesy-color-panel: oklch(27% 0.095 266);
  --cheesy-color-panel-deep: oklch(20% 0.07 267);
  --cheesy-color-field: oklch(18% 0.06 268);
  --cheesy-color-ink: oklch(98% 0.01 265);
  --cheesy-color-muted: oklch(79% 0.035 265);
  --cheesy-color-accent: oklch(83% 0.17 92);
  --cheesy-color-accent-ink: oklch(20% 0.07 267);
  --cheesy-color-danger: oklch(72% 0.17 25);
  --cheesy-color-focus: oklch(90% 0.14 94);
  --cheesy-color-overlay: oklch(10% 0.035 267 / 0.82);
  --cheesy-font-game: ForcedSquare, Arial, sans-serif;
  --cheesy-space-xs: 0.5rem;
  --cheesy-space-sm: 0.75rem;
  --cheesy-space-md: 1rem;
  --cheesy-space-lg: 1.5rem;
  --cheesy-space-xl: 2.5rem;
  --cheesy-dur-micro: 120ms;
  --cheesy-dur-long: 360ms;
  --cheesy-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --cheesy-z-modal: 400;
}

html,
body {
  overflow-x: clip;
}

.cheesy-chat-invite-button {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  white-space: nowrap;
}

.cheesy-account-menu-button {
  white-space: nowrap;
}

.cheesy-account-menu-button:focus-visible,
.cheesy-account-modal :is(button, a, input):focus-visible {
  outline: 3px solid var(--cheesy-color-focus);
  outline-offset: 3px;
}

.cheesy-account-modal {
  position: fixed;
  inset: 0;
  z-index: var(--cheesy-z-modal);
  width: min(38rem, calc(100% - 2rem));
  height: fit-content;
  max-height: min(90dvh, 44rem);
  margin: auto;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
  color: var(--cheesy-color-ink);
  font-family: var(--cheesy-font-game);
}

.cheesy-account-modal::backdrop {
  background: var(--cheesy-color-overlay);
  backdrop-filter: blur(3px);
}

.cheesy-account-modal[open] {
  animation: cheesy-account-enter var(--cheesy-dur-long) var(--cheesy-ease-out) both;
}

.cheesy-account-card {
  box-sizing: border-box;
  width: 100%;
  padding: clamp(var(--cheesy-space-lg), 4vw, var(--cheesy-space-xl));
  border-block-start: 0.5rem solid var(--cheesy-color-accent);
  background: var(--cheesy-color-panel);
  box-shadow: 0.75rem 0.75rem 0 var(--cheesy-color-panel-deep);
}

.cheesy-account-header {
  display: flex;
  align-items: center;
  gap: var(--cheesy-space-lg);
  margin-block-end: var(--cheesy-space-xl);
}

.cheesy-account-header > img {
  width: 4.5rem;
  height: 4.5rem;
  flex: 0 0 auto;
}

.cheesy-account-header h2 {
  margin: 0;
  color: var(--cheesy-color-ink);
  font-family: var(--cheesy-font-game);
  font-size: clamp(2rem, 6vw, 3.25rem);
  font-style: normal;
  font-weight: 700;
  line-height: 0.95;
  overflow-wrap: anywhere;
}

.cheesy-account-header p {
  margin: var(--cheesy-space-xs) 0 0;
  color: var(--cheesy-color-muted);
  font-size: clamp(0.9rem, 2vw, 1.15rem);
  line-height: 1.25;
}

.cheesy-account-header strong {
  color: var(--cheesy-color-accent);
  font-weight: 700;
}

.cheesy-account-form {
  display: grid;
  gap: var(--cheesy-space-md);
}

.cheesy-account-form label {
  display: grid;
  gap: var(--cheesy-space-xs);
  color: var(--cheesy-color-ink);
  font-size: 1rem;
}

.cheesy-account-form input {
  box-sizing: border-box;
  width: 100%;
  min-height: 3.5rem;
  padding: 0 var(--cheesy-space-md);
  border: 1px solid var(--cheesy-color-muted);
  border-radius: 0;
  outline: 2px solid transparent;
  outline-offset: 1px;
  background: var(--cheesy-color-field);
  color: var(--cheesy-color-ink);
  font: 1.15rem var(--cheesy-font-game);
  transition: background-color var(--cheesy-dur-micro) var(--cheesy-ease-out);
}

.cheesy-account-form input:hover {
  background: var(--cheesy-color-panel-deep);
}

.cheesy-account-form input:focus-visible {
  border-color: var(--cheesy-color-ink);
}

.cheesy-account-form input[aria-invalid="true"] {
  border-color: var(--cheesy-color-danger);
}

.cheesy-account-error {
  min-height: 1.25em;
  color: var(--cheesy-color-danger);
  font-size: 0.95rem;
  line-height: 1.25;
}

.cheesy-account-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--cheesy-space-xs);
  margin-block-start: var(--cheesy-space-md);
}

.cheesy-account-actions .button {
  box-sizing: border-box;
  min-width: 7.5rem;
  min-height: 3.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding-inline: var(--cheesy-space-md);
  text-decoration: none;
  white-space: nowrap;
}

.cheesy-account-submit {
  background: var(--cheesy-color-accent) !important;
  color: var(--cheesy-color-accent-ink) !important;
}

.cheesy-account-submit:disabled,
.cheesy-account-submit[data-state="loading"] {
  opacity: 0.58;
  cursor: wait;
}

.cheesy-account-submit[data-state="error"] {
  background: var(--cheesy-color-danger) !important;
  color: var(--cheesy-color-accent-ink) !important;
}

@keyframes cheesy-account-enter {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 40rem) {
  .cheesy-account-modal {
    width: min(31rem, calc(100% - 1rem));
  }

  .cheesy-account-card {
    padding: var(--cheesy-space-lg);
    border-block-start-width: 0.35rem;
    box-shadow: 0.4rem 0.4rem 0 var(--cheesy-color-panel-deep);
  }

  .cheesy-account-header {
    gap: var(--cheesy-space-md);
    margin-block-end: var(--cheesy-space-lg);
  }

  .cheesy-account-header > img {
    width: 3.25rem;
    height: 3.25rem;
  }

  .cheesy-account-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .cheesy-account-submit {
    grid-column: 1 / -1;
    grid-row: 1;
  }
}

@media (hover: hover) and (pointer: fine) {
  .cheesy-account-actions .button:hover {
    transform: translateY(-1px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .cheesy-account-modal[open] {
    animation: cheesy-account-fade 150ms linear both;
  }
}

@keyframes cheesy-account-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
