/* A0819: the entry before the game (title, account, character creation) and the Aparência window.
   After the owner's mockups (.claude-evidence/A0819-contas-e-montaria/modelo-do-dono/): 1-entrada.png, 2-criar-conta.png
   (without "Tipo de conta"), 3-criar-personagem.png and 5-aparencia-no-jogo.png. Frames, buttons and colours are the
   game's kit (styles.css: --hud-panel, --hud-button, --ms-*, the ornaments of assets/ui/a0761); the pictures are
   assets/ui/entrada; titles and buttons take a serif the system already has (no font is downloaded). No text under
   11 px; inputs at 16 px, so a phone does not zoom into them. */

:is(.account-entry, .appearance) {
  --entry-serif: Georgia, 'Times New Roman', serif;
  --entry-cream: #efe0bd;
  /* --ms-gold at 72%. */
  --entry-line: #d9ad63b8;
  /* The green of the main buttons: the game's forest (#173e24) lit with the green of the health bar (#4cc34a):
     58/42 → #2d7634, 82/18 → #21562b (mixed by hand, so an older phone without color-mix() shows the same). */
  --entry-green: linear-gradient(to bottom, #2d7634, #21562b 52%, #173e24);
}

/* ── Buttons of both: the bronze plate of the kit; the main one has the green of the mockups inside its rim ───── */
:is(.account-entry, .appearance) .glass {
  --frame: 12px;
  position: relative; isolation: isolate; min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  gap: 10px; padding: 0 16px; border: 1px solid transparent; border-image: var(--hud-button) 30 fill / var(--frame);
  border-radius: 0; background: none; box-shadow: none; color: var(--entry-cream); font: 600 18px/1.1 var(--entry-serif);
  text-shadow: 0 1px 0 #000c; -webkit-user-select: none; user-select: none;
}
:is(.account-entry, .appearance) .glass:active { background: none; filter: brightness(1.25); transform: translateY(1px); }
:is(.account-entry, .appearance) .glass:disabled { cursor: default; filter: grayscale(.35) brightness(.82); transform: none; }
:is(.account-entry, .appearance) .glass[aria-busy="true"] { cursor: progress; filter: none; }
:is(.account-entry, .appearance) .glass .icon { width: 22px; height: 22px; color: var(--ms-gold); }
/* The fill goes inside the bronze ring of the plate (button.png: the ring ends at 11 of its 30 px, the corner cut is 19). */
:is(.account-entry, .appearance) .glass.primary::before,
.appearance .appearance-part[aria-checked="true"]::before {
  --cut: calc(var(--frame) * .42);
  content: ""; position: absolute; z-index: -1; inset: calc(var(--frame) * .37);
  clip-path: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% calc(100% - var(--cut)),
    calc(100% - var(--cut)) 100%, var(--cut) 100%, 0 calc(100% - var(--cut)), 0 var(--cut));
  background: var(--entry-green); box-shadow: inset 0 1px 0 #ffffff33, inset 0 -3px 6px #0006;
}
:is(.account-entry, .appearance) .glass.primary { color: #fbeecb; text-shadow: 0 1px 0 #0a1c0d, 0 0 6px #000a; }
:is(.account-entry, .appearance) :is(button, input):focus-visible { outline: 2px solid var(--ms-gold-bright); outline-offset: 2px; }

/* ── The entry: one screen over everything, on the art of the title ─────────────────────────────────────────── */
.account-entry {
  position: fixed; inset: 0; z-index: 40; overflow: hidden; color: var(--ms-text);
  background-color: #07100e; background-image: var(--entry-portrait, none); background-size: cover;
  background-position: center; background-repeat: no-repeat;
}
.account-entry[hidden] { display: none; }
@media (min-aspect-ratio: 1/1) { .account-entry { background-image: var(--entry-landscape, none); } }
/* Over the windows of the forms the art steps back a little, as in the mockups. */
.account-entry:not([data-screen="title"])::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to bottom, #02060573, #0206052e 32%, #02060566); }
.entry-scroll {
  position: relative; height: 100%; display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain;
  touch-action: pan-y; -webkit-overflow-scrolling: touch;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
/* Auto margins centre a window and still let a tall one scroll from its top. */
.entry-scroll > * { margin: auto; }
.entry-wait { display: none; }

/* The title (mockup 1): the logo over the sky, the two buttons over the stones. */
.entry-title { flex: 1 0 auto; margin: 0 !important; width: 100%; display: flex; flex-direction: column; align-items: center;
  justify-content: space-between; gap: 24px; padding: 1vh 0 6vh; }
.entry-logo { margin: 0; width: min(84vw, 560px, 30vh * 1.311); line-height: 0; outline: none; }
.entry-logo img { width: 100%; height: auto; filter: drop-shadow(0 6px 10px #000b); }
.entry-title-actions { width: min(70vw, 340px); display: grid; gap: 18px; }
.account-entry .glass.entry-big { --frame: 15px; width: 100%; min-height: 60px; font-size: clamp(21px, 5.6vw, 25px); }

/* A window of the entry (mockups 2 and 3): the card of the kit, the sun of the logo on its top edge. */
.entry-panel.map-card { position: relative; width: min(420px, 100%); max-height: none; margin: auto;
  padding: 34px 22px 18px; display: grid; gap: 12px; }
/* Room above a window for the sun on its edge, also when the window is taller than the screen and scrolls. */
.account-entry:not([data-screen="title"]) .entry-scroll { padding-top: max(56px, calc(env(safe-area-inset-top) + 44px)); }
.entry-crest { --crest: 132px; position: absolute; left: 50%; top: 0; width: var(--crest); height: calc(var(--crest) * .59);
  transform: translate(-50%, -66%); pointer-events: none; filter: drop-shadow(0 3px 3px #000c);
  background: var(--entry-logo, none) no-repeat calc(var(--crest) * -.725) calc(var(--crest) * -.02) / calc(var(--crest) * 2.39) auto; }
.entry-heading { margin: 0; text-align: center; font: 700 clamp(27px, 7.6vw, 34px)/1.15 var(--entry-serif); letter-spacing: .01em;
  color: var(--ms-gold-bright); background: linear-gradient(to bottom, #fbe6ad, var(--ms-gold-bright) 45%, var(--ms-bronze));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 0 #24160a) drop-shadow(0 0 6px #000a); outline: none; }
/* The rule under the title and at the foot: a fine gold line with the flourish of the kit in the middle. */
.entry-rule { position: relative; display: block; height: 14px; margin: -4px 0 2px; pointer-events: none; }
.entry-rule::before { content: ""; position: absolute; left: 4%; right: 4%; top: 50%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--entry-line) 18%, var(--entry-line) 82%, transparent); }
.entry-rule::after { content: ""; position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; transform: translate(-50%, -50%);
  background: var(--ms-icons) 100% 100% / 400% 300% no-repeat; }
.entry-rule-foot { margin: 4px 0 -4px; }
.entry-form { display: grid; gap: 12px; }
.entry-field { display: grid; gap: 6px; }
.entry-field label { color: var(--entry-cream); font: 600 17px/1.2 var(--entry-serif); }
.entry-input { width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--ms-bronze); border-radius: 6px;
  background: #0d0b08; color: var(--ms-text); font: 16px/1.2 Inter, ui-sans-serif, system-ui, sans-serif;
  box-shadow: inset 0 2px 6px #000a; -webkit-user-select: text; user-select: text; touch-action: manipulation; }
.entry-input:focus { outline: none; border-color: var(--ms-gold-bright); box-shadow: inset 0 2px 6px #000a, 0 0 0 2px #f1c56d4d; }
.entry-input[aria-invalid="true"] { border-color: #c96a4a; }
.entry-field-error { margin: 0; color: #f3c9bd; font-size: 13px; line-height: 1.35; }
.entry-panel .glass { width: 100%; min-height: 50px; }
.entry-panel .glass.primary { min-height: 56px; font-size: 22px; }
.entry-submit { margin-top: 6px; }
.entry-text { margin: 0; text-align: center; color: var(--ms-text); font: 17px/1.45 var(--entry-serif); }
.entry-text b, .entry-account b { color: var(--ms-gold-bright); font-weight: 700; }
.entry-account { margin: -6px 0 0; text-align: center; color: var(--ms-muted); font-size: 13px; overflow-wrap: anywhere; }
.entry-account b { color: var(--ms-text); font-weight: 600; }
.entry-notice { margin: 0; padding: 8px 12px; border: 1px solid var(--ms-bronze-dark); border-radius: 4px; background: #10140fd9;
  color: var(--ms-gold); font-size: 14px; line-height: 1.35; text-align: center; }
.entry-title-actions .entry-notice { background: #10140fe6; }
.entry-error { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid #c96a4a; border-radius: 4px; background: #1a120d;
  color: #f3c9bd; font-size: 14px; line-height: 1.35; }
.entry-error p { margin: 0; }
.entry-error .glass { min-height: 44px; font-size: 17px; }
.entry-hint { margin: 0; text-align: center; color: var(--ms-muted); font-size: 13px; }
.entry-switch { margin: 0; text-align: center; color: var(--ms-muted); font-size: 14px; }
.entry-link { min-height: 44px; padding: 0 8px; border: 0; background: none; color: var(--ms-gold); cursor: pointer;
  font: 600 16px/1.2 var(--entry-serif); text-decoration: underline; text-underline-offset: 3px; }
.entry-link:disabled { opacity: .6; cursor: default; }
.entry-back, .entry-bring { justify-self: center; }
.entry-back { color: var(--ms-muted); }

/* The characters of the account: one line each, the chosen one lit. */
.entry-characters { display: grid; gap: 8px; max-height: min(44vh, 360px); overflow-y: auto; overscroll-behavior: contain; padding: 2px; }
.entry-character { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 14px;
  border: 1px solid var(--ms-bronze-dark); border-radius: 6px; background: var(--ms-ink); color: var(--ms-text); text-align: left; cursor: pointer; }
.entry-character b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 18px/1.1 var(--entry-serif); }
.entry-character span { flex: none; color: var(--ms-muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.entry-character[aria-checked="true"] { border-color: var(--ms-gold-bright); background: #1d170d;
  box-shadow: 0 0 0 1px var(--ms-gold-bright), 0 0 12px #f1c56d4d; }
.entry-character[aria-checked="true"] b { color: var(--ms-gold-bright); }

/* Criar personagem (mockup 3): the two bodies, the default outfit and its colours. */
.entry-bodies { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.entry-body { position: relative; aspect-ratio: 5 / 6; min-width: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto;
  justify-items: center; gap: 4px; padding: 10px 6px; border: 1px solid var(--ms-bronze-dark); border-radius: 8px;
  background: radial-gradient(circle at 50% 42%, #241c12, #120e09 72%); color: var(--ms-text); cursor: pointer; }
.entry-body[aria-checked="true"] { border: 2px solid var(--ms-gold-bright);
  box-shadow: 0 0 0 1px var(--ms-bronze-dark), 0 0 16px #f1c56d59, inset 0 0 18px #f1c56d1f; }
.entry-body:disabled { cursor: default; }
.entry-body-art { width: 100%; height: 100%; min-height: 0; object-fit: contain; image-rendering: pixelated; }
.entry-body-name { color: var(--entry-cream); font: 600 20px/1.1 var(--entry-serif); }
.entry-body:disabled .entry-body-name { color: var(--ms-muted); }
.entry-body-soon { align-self: center; display: grid; justify-items: center; gap: 8px; color: var(--ms-muted); font: 600 15px/1.2 var(--entry-serif); }
.entry-body-soon .icon { width: 26px; height: 26px; color: var(--ms-bronze); }
.entry-divider { display: flex; align-items: center; gap: 12px; margin: 2px 0 0; color: var(--entry-cream); font: 600 16px/1.2 var(--entry-serif); }
.entry-divider::before, .entry-divider::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--entry-line)); }
.entry-divider::after { background: linear-gradient(90deg, var(--entry-line), transparent); }
.entry-panel .glass.entry-colors { min-height: 48px; font-size: 19px; }

@media (min-width: 700px) and (min-height: 640px) {
  .entry-panel.map-card { width: 420px; padding: 38px 28px 20px; }
}
@media (max-height: 560px) and (min-aspect-ratio: 1/1) {
  /* A phone on its side: the logo smaller, the buttons side by side. */
  .entry-title { padding: 1vh 0 3vh; gap: 10px; }
  .entry-title-actions { width: min(80vw, 560px); grid-template-columns: 1fr 1fr; gap: 12px; }
  .entry-title-actions .entry-notice { grid-column: 1 / -1; }
}

/* ── Aparência (mockup 5): over the game, which stays in sight around it ────────────────────────────────────── */
.appearance { z-index: 45; background: rgba(2, 6, 5, .42); backdrop-filter: none; -webkit-backdrop-filter: none; }
.appearance .map-card { position: relative; width: min(460px, 100%); max-height: 100%; overflow-y: auto; overscroll-behavior: contain;
  touch-action: pan-y; padding: 16px 18px; display: grid; gap: 10px; color: var(--ms-text); }
.appearance-head { position: relative; min-height: 42px; display: flex; align-items: center; justify-content: center; gap: 4px; padding: 0 46px; }
.appearance-head b { color: var(--ms-gold-bright); font: 700 26px/1.1 var(--entry-serif);
  background: linear-gradient(to bottom, #fbe6ad, var(--ms-gold-bright) 45%, var(--ms-bronze));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; filter: drop-shadow(0 2px 0 #24160a); }
.appearance-flourish { flex: none; width: 40px; height: 40px; margin: -12px 0; pointer-events: none;
  background: var(--ms-icons) 100% 100% / 400% 300% no-repeat; }
.appearance .glass.appearance-close { --frame: 10px; position: absolute; right: 0; top: 50%; transform: translateY(-50%); width: 42px;
  min-width: 42px; height: 42px; min-height: 42px; padding: 0; font: 700 20px/1 Inter, ui-sans-serif, system-ui, sans-serif; }
.appearance .glass.appearance-close:active { transform: translateY(calc(-50% + 1px)); }
.appearance-top { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 10px; }
.appearance-preview { position: relative; min-height: 200px; margin: 0; border: 1px solid transparent; border-image: var(--hud-panel) 48 fill / 18px; }
.appearance-preview canvas { position: absolute; inset: 6px 6px 26px; width: calc(100% - 12px); height: calc(100% - 32px); display: block; }
.appearance .glass.appearance-turn { --frame: 9px; position: absolute; top: 44%; transform: translateY(-50%); z-index: 1; width: 36px; min-width: 36px;
  height: 36px; min-height: 36px; padding: 0; }
.appearance .glass.appearance-turn:active { transform: translateY(calc(-50% + 1px)); }
.appearance-turn.left { left: 6px; }
.appearance-turn.right { right: 6px; }
.appearance-turn .icon { width: 18px; height: 18px; color: var(--entry-cream); }
.appearance-turn.right .icon { transform: scaleX(-1); }
.appearance-preview figcaption { position: absolute; left: 0; right: 0; bottom: 6px; display: flex; justify-content: center; align-items: center;
  gap: 6px; color: var(--entry-cream); font: 600 15px/1 var(--entry-serif); pointer-events: none; }
.appearance-preview figcaption::before, .appearance-preview figcaption::after { content: ""; width: 26px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--entry-line)); }
.appearance-preview figcaption::after { background: linear-gradient(90deg, var(--entry-line), transparent); }
.appearance-parts { display: grid; gap: 6px; align-content: start; }
.appearance .glass.appearance-part { --frame: 10px; width: 100%; min-height: 38px; justify-content: space-between; gap: 8px; padding: 0 10px 0 14px;
  font-size: 17px; }
.appearance .glass.appearance-part[aria-checked="true"]::before { background: linear-gradient(to bottom, var(--ms-bronze), var(--ms-bronze-dark) 60%, #3d2a10); }
.appearance .glass.appearance-part[aria-checked="true"] { color: #fff3d6; filter: drop-shadow(0 0 3px #f1c56d); }
.appearance-part-swatch { flex: none; width: 26px; height: 22px; border: 1px solid #000a; border-radius: 4px; background: var(--swatch, #0d0b08);
  box-shadow: inset 0 0 0 1px #ffffff2e, 0 0 0 1px var(--ms-bronze-dark); }
.appearance-part-swatch.unset { background: repeating-linear-gradient(45deg, #3b322a 0 3px, #221c16 3px 6px); }
.appearance-soon { color: var(--ms-muted); font: italic 13px/1 var(--entry-serif); }
.appearance .glass.appearance-part:disabled { filter: grayscale(.6) brightness(.75); }
.appearance-section { display: flex; align-items: center; gap: 10px; margin: 2px 0 0; color: var(--entry-cream); font: 700 19px/1.1 var(--entry-serif); }
.appearance-section::before, .appearance-section::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--entry-line)); }
.appearance-section::after { background: linear-gradient(90deg, var(--entry-line), transparent); }
.appearance-section > span::before, .appearance-section > span::after { content: "\25C6"; display: inline-block; margin: 0 10px; color: var(--ms-gold);
  font-size: 11px; vertical-align: 3px; }
.appearance-section small { color: var(--ms-muted); font: italic 13px/1 var(--entry-serif); }
.appearance-section small[hidden] { display: none; }
.appearance-grid { display: grid; grid-template-columns: repeat(var(--columns, 10), minmax(0, 1fr)); gap: 5px; padding: 7px;
  border: 1px solid var(--ms-bronze-dark); border-radius: 6px; background: #0d0b08cc; box-shadow: inset 0 2px 8px #000a; }
.appearance-grid.tones { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 7px; }
.appearance-grid.tones.active { border-color: var(--ms-gold); }
.appearance-swatch { position: relative; aspect-ratio: 1; min-width: 0; min-height: 0; padding: 0; border: 1px solid #000d; border-radius: 4px;
  background: linear-gradient(to bottom, #ffffff26, #ffffff00 45%, #0000002e), var(--swatch, #000);
  box-shadow: inset 0 0 0 1px #ffffff1f; cursor: pointer; }
.appearance-grid.tones .appearance-swatch { aspect-ratio: 5 / 4; }
.appearance-swatch .icon { position: absolute; right: 6%; bottom: 4%; display: none; width: 64%; height: 64%; color: #fff6dc;
  filter: drop-shadow(0 1px 0 #000) drop-shadow(0 0 2px #000d); }
.appearance-swatch[aria-checked="true"] { z-index: 1; border-color: var(--ms-gold-bright); box-shadow: 0 0 0 2px var(--ms-gold-bright), 0 0 8px #f1c56d99; }
.appearance-swatch[aria-checked="true"] .icon { display: block; }
.appearance-swatch:active { filter: brightness(1.15); }
.appearance-grid.waiting .appearance-swatch { opacity: .8; }
.appearance-grid.tones.off .appearance-swatch { cursor: default; opacity: .55; filter: grayscale(.35); }
.appearance-status { margin: 0; color: #f3c9bd; font-size: 13px; line-height: 1.35; text-align: center; }
.appearance-status:empty { display: none; }
.appearance-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 2px; }
.appearance .appearance-actions .glass { min-height: 50px; font-size: 21px; }

@media (max-width: 420px) {
  .appearance .map-card { padding: 14px 13px; gap: 8px; }
  .appearance-head b { font-size: 23px; }
  .appearance-head { padding: 0 42px; }
  .appearance-flourish { width: 32px; height: 32px; margin: -10px 0; }
  .appearance .glass.appearance-close { width: 38px; min-width: 38px; height: 38px; min-height: 38px; }
  .appearance-top { gap: 8px; }
  .appearance-preview { min-height: 190px; }
  .appearance .glass.appearance-part { min-height: 34px; font-size: 16px; padding: 0 8px 0 11px; }
  .appearance-part-swatch { width: 22px; height: 19px; }
  .appearance-section { font-size: 17px; }
  .appearance-grid { gap: 4px; padding: 6px; }
  .appearance-grid.tones { gap: 5px; }
  .appearance .appearance-actions .glass { min-height: 46px; font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  :is(.account-entry, .appearance) .glass:active { transform: none; }
}
