/* Hallmark · 智耳正音 · recording workbench · material: the studio microphone and four Mandarin pitch contours. */
/* Critique: keep the first choice in reach on a phone and keep both account and guest entry visible. */
:root {
  --entry-paper: #faf8f0;
  --entry-ink: #182f28;
  --entry-muted: #4f6258;
  --entry-line: #d4dbd0;
  --entry-field: #fffef9;
  --entry-spruce: #173e34;
  --entry-dark: #0f3028;
  --entry-hover: #e9eee6;
  --entry-focus: #316f56;
  --entry-cream: #f5f1e5;
  --entry-subtle: #b7c9bc;
  --entry-overlay: rgb(16 30 25 / 58%);
  --entry-serif: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "STSong", "SimSun", Georgia, serif;
  --entry-error: #8c3426;
}

body:has(#language-dialog[open]) { overflow: hidden; }
body.studio-auth-active:has(#language-dialog[open]) #auth-dialog { visibility: hidden; }
.entry-dialog,
.entry-login { color: var(--entry-ink); }
.entry-dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(890px, calc(100% - 48px));
  max-width: none;
  height: fit-content;
  max-height: calc(100dvh - 40px);
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--entry-paper);
  border: 0;
  border-radius: 18px;
  box-shadow: none;
}
.entry-dialog::backdrop {
  background: var(--entry-overlay);
  backdrop-filter: blur(7px);
}
.entry-dialog[open] { animation: entry-in 220ms ease-out both; }
@keyframes entry-in {
  from { transform: translateY(6px); }
  to { transform: translateY(0); }
}
.entry-spread {
  display: grid;
  grid-template-columns: minmax(0, .84fr) minmax(0, 1.16fr);
  min-height: 515px;
}
.entry-scene {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  overflow: hidden;
  isolation: isolate;
  position: relative;
  background: var(--entry-dark);
  color: var(--entry-cream);
  padding: 27px 28px 25px;
}
.entry-imprint {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 17px;
  font-weight: 650;
  line-height: 1.45;
  z-index: 1;
}
.entry-imprint .entry-icon { color: var(--entry-cream); }
.entry-icon {
  width: 23px;
  height: 23px;
  flex: none;
  display: inline-block;
  vertical-align: middle;
}
.entry-portrait {
  min-width: 0;
  position: relative;
}
.entry-portrait img {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.entry-scene-caption {
  position: relative;
  display: grid;
  gap: 10px;
}
.entry-scene-caption > span {
  font-size: 12px;
  color: var(--entry-subtle);
}
.entry-contours {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid color-mix(in srgb, var(--entry-subtle), transparent 60%);
  padding-top: 11px;
}
.entry-contours > div {
  display: grid;
  gap: 4px;
  justify-content: start;
}
.entry-contours svg { width: 31px; height: 17px; }
.entry-contours path {
  fill: none;
  stroke: var(--entry-cream);
  stroke-linecap: round;
  stroke-width: 1.7;
}
.palm .entry-scene .entry-imprint .entry-icon { color: var(--entry-ink); }
.palm .entry-scene .entry-contours path { stroke: var(--entry-ink); }
.entry-contours span {
  color: var(--entry-cream);
  font: 15px/1.2 var(--entry-serif);
}
.entry-language-content {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
  min-width: 0;
  padding: 42px 40px;
}
#language-title {
  font: 600 clamp(31px, 3.2vw, 43px)/1.25 var(--entry-serif);
  margin: 0 0 27px;
  min-width: 0;
  overflow-wrap: break-word;
  letter-spacing: -.045em;
}
#language-title span { display: block; }
/* These programmatically focused headings announce the new view. Tab continues to the first choice. */
#language-title:focus, #auth-dialog #auth-title:focus { outline: none; }
.entry-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.entry-choice-form { display: grid; gap: 20px; }
.entry-choices { display: grid; gap: 9px; margin: 0; padding: 0; border: 0; min-width: 0; }
.entry-choice {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 19px;
  align-items: center;
  width: 100%;
  gap: 12px;
  min-height: 74px;
  padding: 12px 14px;
  color: var(--entry-ink);
  background: var(--entry-field);
  border: 1px solid var(--entry-line);
  border-radius: 8px;
  text-align: start;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.entry-choice-icon {
  display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: 50%; background: var(--entry-hover); color: var(--entry-spruce);
}
.entry-choice-icon svg { width: 20px; height: 20px; }
.entry-choice input[type=radio] { width: 19px; height: 19px; padding: 0; margin: 0; cursor: pointer; accent-color: var(--entry-spruce); }
.entry-choice:has(input:checked) { border-color: var(--entry-spruce); box-shadow: inset 0 0 0 1px var(--entry-spruce); background: var(--entry-hover); }
.entry-choice:has(input:checked) .entry-choice-icon { background: var(--entry-spruce); color: var(--entry-cream); }
.entry-choice:has(input:focus-visible) { outline: 2px solid var(--entry-focus); outline-offset: 2px; }
.entry-choice-copy { display: grid; gap: 5px; min-width: 0; }
.entry-choice-copy strong { font-size: 17px; font-weight: 630; line-height: 1.45; }
.entry-choice-copy > span { color: var(--entry-muted); font-size: 13px; line-height: 1.55; text-wrap: balance; }
#language-continue, #auth-dialog #auth-submit {
  display: flex; justify-content: center; align-items: center; gap: 11px;
  min-height: 48px; width: 100%; padding: 10px 17px;
  border: 1px solid var(--entry-spruce); border-radius: 7px;
  background: var(--entry-spruce); color: var(--entry-cream); font: inherit; font-size: 16px; font-weight: 650;
}
#language-continue svg { height: 18px; width: 18px; }
#language-continue:disabled { background: #e4e8e1; color: #55645a; border-color: #d4dcd1; cursor: not-allowed; }
#language-privacy { color: var(--entry-muted); font-size: 12px; margin: 12px 0 0; line-height: 1.65; }
.entry-close {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--entry-muted);
}
.entry-close .entry-icon { width: 18px; height: 18px; }
.entry-close[hidden], #auth-dialog[hidden],
#auth-dialog [hidden] { display: none !important; }
.entry-dialog :is(button, input):focus-visible,
#auth-dialog :is(button, input):focus-visible {
  outline: 2px solid var(--entry-focus);
  outline-offset: -2px;
}

/* Login is an ordinary view inside the workbench's main region. */
body.studio-auth-active .shell main > :not(#auth-dialog):not(.topbar) { display: none !important; }
#auth-dialog.entry-login:not([hidden]) {
  display: grid;
  grid-template-columns: minmax(0, .96fr) minmax(0, 1.04fr);
  max-width: 1040px;
  width: 100%;
  max-height: none;
  border: 1px solid var(--entry-line);
  padding: 0;
  margin: clamp(20px, 4vw, 60px) auto;
  border-radius: 15px;
  overflow: clip;
  background: var(--entry-paper);
  box-shadow: none;
}
#auth-dialog .entry-scene { min-height: 510px; padding: 30px; }
#auth-dialog .entry-login-content {
  min-width: 0;
  margin: auto 0;
  padding: clamp(23px, 3.3vw, 50px);
}
#auth-dialog .entry-preference {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  max-width: 100%;
  padding: 6px 11px;
  margin: -8px 0 15px;
  border: 1px solid var(--entry-line);
  border-radius: 6px;
  background: var(--entry-paper);
  color: var(--entry-muted);
  font: inherit;
  font-size: 12px;
  text-align: left;
}
#auth-dialog .entry-preference .entry-icon { width: 16px; height: 16px; }
.entry-edit { border-left: 1px solid var(--entry-line); padding-left: 8px; font-weight: 650; color: var(--entry-spruce); }
#auth-dialog #auth-title {
  margin: 0;
  font: 600 clamp(25px, 2.8vw, 37px)/1.3 var(--entry-serif);
  color: var(--entry-ink);
  overflow-wrap: break-word;
}
#auth-dialog #auth-description { margin: 8px 0 23px; font-size: 14px; line-height: 1.65; color: var(--entry-muted); }
#auth-dialog form { display: grid; gap: 15px; }
#auth-dialog form label { display: grid; gap: 6px; color: var(--entry-ink); font-size: 14px; font-weight: 550; }
#auth-dialog form input {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid var(--entry-line);
  border-radius: 6px;
  background: var(--entry-field);
  color: var(--entry-ink) !important;
  font-size: 16px;
}
#auth-dialog form input::placeholder { color: var(--entry-muted) !important; }
.entry-password-control { position: relative; }
#auth-dialog #auth-password { padding-right: 50px; }
#entry-toggle-password {
  position: absolute; bottom: 2px; right: 3px; width: 44px; height: 44px;
  display: grid; place-items: center; padding: 0; border: 0; border-radius: 5px;
  color: var(--entry-muted); background: transparent;
}
#entry-toggle-password svg { width: 20px; height: 20px; }
#auth-dialog #auth-submit { margin: 3px 0 0; }
#auth-dialog #auth-switch {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--entry-spruce);
  margin: 1px 0 0;
  border: 0; padding: 0; background: transparent;
  font-size: 14px; font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
#auth-dialog #auth-error { color: var(--entry-error); margin: 0; line-height: 1.5; font-size: 13px; }
#auth-dialog #auth-error:empty { display: none; }
#auth-dialog .guest-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  padding: 16px 0 0;
  margin: 5px 0 0;
  border: 0;
  border-top: 1px solid var(--entry-line);
  border-radius: 0;
  background: transparent;
}
#auth-dialog .guest-entry h2 { font-size: 14px; font-weight: 600; line-height: 1.5; margin: 0; color: var(--entry-ink); }
#auth-dialog .guest-entry small { color: var(--entry-muted); margin: 0; font-size: 12px; line-height: 1.6; }
#auth-dialog button.guest-start {
  color: var(--entry-ink);
  width: 100%;
  background: transparent;
  border: 1px solid var(--entry-spruce);
  border-radius: 7px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  min-height: 47px;
  font-size: 15px; font-weight: 650;
}
#auth-dialog button.guest-start .entry-icon { width: 14px; height: 14px; }
#auth-dialog :disabled { opacity: .55; cursor: not-allowed; }
@media (hover:hover) {
  .entry-choice:hover, #entry-toggle-password:hover, #auth-dialog .entry-preference:hover, #auth-dialog button.guest-start:hover:not(:disabled) { background: var(--entry-hover); }
  .entry-choice:hover { border-color: var(--entry-spruce); }
  #language-continue:hover:not(:disabled), #auth-dialog #auth-submit:hover:not(:disabled) { background: var(--entry-dark); }
  #auth-dialog #auth-switch:hover { text-decoration: underline; }
}
.entry-choice:active, #auth-dialog button:not(:disabled):active { transform: translateY(1px); }
@media (max-width: 900px) {
  .entry-language-content { padding: 35px 28px; }
  #auth-dialog .entry-login-content { padding: 25px; }
}
@media (max-width: 680px) {
  .entry-dialog { width: calc(100% - 24px); max-width: 460px; max-height: calc(100dvh - 24px); border-radius: 14px; }
  .entry-spread { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .entry-scene, #auth-dialog .entry-scene {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    grid-template-rows: auto 1fr;
    min-height: 0;
    height: clamp(102px, 16.5dvh, 145px);
    padding: 15px 21px;
  }
  .entry-imprint { align-self: start; font-size: 15px; }
  .entry-imprint .entry-icon { width: 19px; height: 19px; }
  .entry-portrait { grid-area: 1/2/3/3; margin: -12px 0 -15px; }
  .entry-scene-caption { grid-area: 2/1/3/2; align-self: end; }
  .entry-scene-caption > span { display: none; }
  .entry-contours { border: 0; padding: 0; max-width: 142px; }
  .entry-contours svg { width: 22px; height: 12px; }
  .entry-contours span { font-size: 12px; }
  .entry-language-content { padding: 22px 20px 18px; }
  #language-title { font-size: clamp(23px, 6.1vw, 30px); line-height: 1.45; margin-bottom: 15px; }
  #language-title span { display: inline; }
  .entry-choice-form { gap: 15px; }
  .entry-choice { min-height: 69px; grid-template-columns: 30px minmax(0,1fr) 18px; gap: 9px; padding: 9px 10px; }
  .entry-choice-icon { width: 30px; height: 30px; }
  .entry-choice-copy { gap: 3px; }
  .entry-choice-copy strong { font-size: 16px; }
  .entry-choice-copy > span { font-size: 12.5px; }
  #language-privacy { margin-top: 9px; font-size: 12px; }
  .entry-close { top: -48px; color: var(--entry-cream); }
  #auth-dialog.entry-login:not([hidden]) { grid-template-columns: minmax(0, 1fr); max-width: 475px; margin: 16px auto 30px; }
  #auth-dialog .entry-login-content { padding: 20px; }
  #auth-dialog .entry-preference { margin-bottom: 6px; }
  #auth-dialog #auth-title { font-size: 27px; }
}
@media (max-width: 680px), (max-height: 560px) {
  #language-dialog {
    --z-secondary: 15px;
    width: min(460px, calc(100% - 24px));
    max-height: calc(100dvh - 24px);
  }
  #language-dialog .entry-spread {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }
  #language-dialog .entry-scene { height: clamp(80px, 14dvh, 116px); }
  #language-dialog .entry-language-content { padding: 16px; }
  #language-dialog h1 { font-size: clamp(22px, 6.1vw, 27px); line-height: 1.35; margin-bottom: 12px; }
  #language-dialog h1 span { display: inline; }
  #language-dialog .entry-choice-form { gap: 10px; }
  #language-dialog .entry-choice {
    min-height: 61px;
    grid-template-columns: 26px minmax(0, 1fr) 18px;
    gap: 8px;
    padding: 7px 9px;
  }
  #language-dialog .entry-choice-icon { width: 26px; height: 26px; }
  #language-dialog .entry-choice-icon svg { width: 17px; height: 17px; }
  #language-dialog .book-cover-title { font-size: clamp(19px, 6.3vw, 24px); }
  #language-dialog .book-cover-title br { display: none; }
  #language-dialog .entry-portrait:has(>img) { margin-block: -6px; }
  .palm #language-dialog .entry-portrait { width: min(68px, 80%); }
  #language-dialog #language-privacy { margin-top: 7px; }
}
@media (max-height: 560px) {
  #language-dialog .entry-scene { display: none; }
  #language-dialog .entry-close { top: 2px; right: 2px; color: var(--entry-ink); }
  #language-dialog .entry-language-content:has(.entry-close:not([hidden])) h1 { padding-right: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  .entry-dialog[open], .entry-choice, #auth-dialog button { animation: none; transition: none; }
}
