/* 登录入口与账号弹窗：和主界面共用羊皮纸 / 木框这一套令牌 */

.auth-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2rem;
  padding: 0.28rem 0.7rem;
  border: 1px solid rgba(75, 58, 39, 0.42);
  border-radius: 3px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(87, 69, 47, 0.06)),
    #e6dfc8;
  color: var(--ink, #2e2a22);
  font: 500 0.78rem/1.1 var(--f-sans, "Microsoft YaHei", sans-serif);
  letter-spacing: 0;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset;
  transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

.auth-chip:hover {
  transform: translateY(-1px);
  background-color: #eee6d1;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.5) inset,
    0 4px 10px rgba(60, 44, 26, 0.16);
}

.auth-chip:active {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(60, 44, 26, 0.2) inset;
}

.auth-chip--floating {
  position: fixed;
  z-index: 60;
  top: 1.4rem;
  right: 1.6rem;
  min-height: 2.35rem;
  padding: 0.4rem 0.9rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(87, 69, 47, 0.08)),
    #e6dfc8;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.55) inset,
    0 6px 16px rgba(50, 36, 20, 0.22);
}

.auth-chip-dot {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: #8b7a5c;
  box-shadow: 0 0 0 2px rgba(139, 122, 92, 0.14);
}

.auth-chip.is-logged-in .auth-chip-dot {
  background: var(--verd, #5e857a);
  box-shadow: 0 0 0 2px rgba(94, 133, 122, 0.16);
}

.auth-modal[hidden] {
  display: none !important;
}

.auth-modal {
  position: fixed;
  z-index: 1200;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.auth-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(38, 31, 23, 0.36);
  backdrop-filter: blur(1.5px);
}

.auth-panel {
  position: relative;
  width: min(24.5rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  padding: 1.35rem 1.5rem 1.25rem;
  border: 6px solid transparent;
  border-image-source: url("./assets/btn-plate.webp?v=21");
  border-image-slice: 17.2%;
  border-image-repeat: stretch;
  background-color: #e6dfc8;
  background-image:
    linear-gradient(135deg, rgba(255, 255, 255, 0.34), rgba(132, 104, 67, 0.07)),
    url("./assets/paper-tile.webp?v=3");
  background-size: auto, 256px 256px;
  color: var(--ink, #2e2a22);
  font-family: var(--f-sans, "Microsoft YaHei", sans-serif);
  box-shadow: 0 18px 45px rgba(36, 27, 17, 0.32);
}

.auth-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.55rem;
}

.auth-kicker {
  margin: 0 0 0.2rem;
  color: var(--muted, #564f3e);
  font: 600 0.62rem/1 var(--f-sans, sans-serif);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.auth-panel h2 {
  margin: 0;
  color: var(--ink, #2e2a22);
  font: 700 1.55rem/1.2 var(--f-serif, Georgia, serif);
  letter-spacing: 0;
}

.auth-close {
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  border: 1px solid rgba(75, 58, 39, 0.34);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  color: var(--muted, #564f3e);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.auth-close:hover {
  background: rgba(255, 255, 255, 0.42);
  color: var(--ink, #2e2a22);
}

.auth-tabs {
  display: flex;
  gap: 0.2rem;
  margin: 0.45rem 0 0.9rem;
  border-bottom: 1px solid rgba(75, 58, 39, 0.24);
}

.auth-tabs[hidden] {
  display: none !important;
}

.auth-tabs button {
  flex: 1;
  padding: 0.5rem 0.4rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted, #564f3e);
  font: 600 0.86rem/1 var(--f-sans, sans-serif);
  cursor: pointer;
}

.auth-tabs button.is-active {
  border-bottom-color: var(--wood-3, #7d6343);
  color: var(--ink, #2e2a22);
}

.auth-form,
.auth-account {
  display: grid;
  gap: 0.68rem;
}

.auth-form[hidden],
.auth-account[hidden] {
  display: none !important;
}

.auth-form label {
  display: grid;
  gap: 0.28rem;
  color: var(--muted, #564f3e);
  font-size: 0.76rem;
}

.auth-form label[hidden] {
  display: none !important;
}

.auth-form input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.52rem 0.62rem;
  border: 1px solid rgba(75, 58, 39, 0.4);
  border-radius: 2px;
  background: rgba(246, 241, 227, 0.78);
  color: var(--ink, #2e2a22);
  font: 0.86rem/1.25 var(--f-sans, sans-serif);
}

.auth-form input:focus {
  outline: none;
  border-color: rgba(75, 58, 39, 0.85);
  box-shadow:
    0 0 0 1px rgba(75, 58, 39, 0.06),
    0 0 8px 1px rgba(75, 58, 39, 0.22);
}

.auth-form input::placeholder {
  color: rgba(86, 79, 62, 0.48);
}

.auth-error {
  min-height: 1.1rem;
  margin: 0;
  color: var(--danger, #a3453b);
  font-size: 0.75rem;
  line-height: 1.35;
}

.auth-error.is-ok {
  color: var(--verd, #5e857a);
}

.auth-button {
  width: 100%;
  min-height: 2.55rem;
  border: 1px solid rgba(75, 58, 39, 0.5);
  border-radius: 3px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.32), rgba(87, 69, 47, 0.08)),
    #d9c39e;
  color: #3a2d1e;
  font: 600 0.95rem/1 var(--f-sans, sans-serif);
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.55) inset,
    0 4px 10px rgba(60, 44, 26, 0.18);
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

.auth-button:hover {
  transform: translateY(-2px);
  filter: brightness(1.03);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 7px 15px rgba(60, 44, 26, 0.22);
}

.auth-button:active {
  transform: translateY(1px);
  box-shadow: 0 2px 4px rgba(60, 44, 26, 0.22) inset;
}

.auth-button:disabled {
  transform: none;
  filter: grayscale(0.5);
  opacity: 0.58;
  cursor: not-allowed;
  box-shadow: none;
}

.auth-guest {
  justify-self: center;
  padding: 0.2rem 0.3rem;
  border: 0;
  background: transparent;
  color: var(--muted, #564f3e);
  font: 0.75rem/1.3 var(--f-sans, sans-serif);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.auth-guest[hidden] {
  display: none !important;
}

.auth-guest:hover {
  color: var(--ink, #2e2a22);
}

.auth-account-name {
  margin: 0;
  font: 700 1.15rem/1.3 var(--f-serif, Georgia, serif);
}

.auth-account-meta {
  margin: 0 0 0.4rem;
  color: var(--muted, #564f3e);
  font-size: 0.78rem;
}

.auth-note {
  margin: 0.9rem 0 0;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(75, 58, 39, 0.18);
  color: var(--muted, #564f3e);
  font-size: 0.7rem;
  line-height: 1.5;
}

@media (max-width: 720px) {
  .auth-chip--floating {
    top: 0.8rem;
    right: 0.8rem;
  }

  .auth-panel {
    padding: 1.1rem 1.05rem 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-chip,
  .auth-button {
    transition: none;
  }
}
