:root {
  --bg: #e5e7eb;
  --line: #1f1f1f;
  --deep: #6f0000;
  --chip: #0b0b0b;
  --text: #131313;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  padding: 12px;
}

.layout {
  max-width: 1040px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 42% 58%;
  gap: 12px;
  align-items: stretch;
}

.left-panel {
  border: 2px solid var(--line);
  border-radius: 28px;
  padding: 8px;
  height: 560px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--deep);
}

.image-frame {
  height: calc(100% - 56px);
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.45);
  background: #4a0000;
}

.image-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.nav-arrows {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 30px;
  padding-top: 8px;
}

.arrow-btn {
  border: 2px solid #111;
  background: transparent;
  color: #111;
  border-radius: 8px;
  width: 58px;
  height: 30px;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.right-panel {
  min-height: 560px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 12px;
}

.top-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  column-gap: 12px;
  padding-top: 8px;
}

.icons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 34px;
  line-height: 1;
  padding-left: 8px;
}

.search-wrap {
  grid-column: 3;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  width: 190px;
  background: #a11107;
  display: flex;
  align-items: center;
  padding: 4px 8px;
  gap: 6px;
}

.search-wrap input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: #fff;
  font-size: 12px;
}

.search-wrap input::placeholder {
  color: #ffd7d3;
}

.middle-grid {
  border: 1.8px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  display: grid;
  grid-template-columns: 48px minmax(0, 0.8fr) minmax(0, 0.8fr) minmax(0, 0.8fr) minmax(0, 1.8fr) minmax(0, 1.2fr);
  gap: 8px;
  min-height: 245px;
}

.left-tools {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 8px;
}

.pill-btn {
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: #070707;
  color: #fff;
  font-size: 9px;
  padding: 5px 4px;
  cursor: pointer;
}

.option-stack {
  display: flex;
  flex-direction: column;
  gap: 7px;
  justify-content: center;
  align-items: center;
}

.solid-option {
  width: 24px;
  height: 18px;
  border: 1px solid #000;
  border-radius: 3px;
  background: #040404;
  cursor: pointer;
}

.solid-option.active,
.pill-btn.active {
  outline: 2px solid #f5f5f5;
  transform: translateY(-1px);
}

.field {
  border: 1.6px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 226px;
}

.field label {
  font-size: 20px;
  text-align: center;
}

.field textarea {
  width: 100%;
  height: 100%;
  min-height: 160px;
  border: 0;
  resize: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: #1a1a1a;
}

.footer-box {
  border: 1.8px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  min-height: 80px;
}

.footer-box input {
  border: 1.4px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  font-size: 13px;
  background: #ff7a70;
  outline: none;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .right-panel {
    min-height: unset;
  }
  .middle-grid {
    grid-template-columns: 48px 1fr 1fr;
    grid-auto-rows: minmax(150px, auto);
  }
}

/* Added: scalable home + auth modal */
body {
  padding: 0;
  overflow: hidden;
  background: #e5e7eb;
}

/* Hide legacy layout to avoid visual conflict */
.layout {
  display: none !important;
}

.home-stage {
  position: fixed;
  inset: 0;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.home-bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  opacity: 0;
  transition: opacity 0.2s ease;
  user-select: none;
  -webkit-user-drag: none;
}

.home-bg-img.is-ready {
  opacity: 1;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  display: none;
  z-index: 999;
  padding: 28px 20px;
}

.auth-overlay.open {
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-modal {
  width: min(420px, 92vw);
  max-height: min(88vh, 760px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
  overflow: hidden;
  border: 1px solid #e8eaee;
}

.auth-sheet-handle {
  display: none;
}

.auth-top {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.05rem 1.15rem 0.85rem 1.25rem;
  background: #fff;
  color: #111;
  border-bottom: 1px solid #eef0f3;
}

.auth-top-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.auth-brand {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  color: #94a3b8;
  text-transform: lowercase;
}

.auth-top h2 {
  font-size: 1.2rem;
  font-weight: 750;
  margin: 0;
  letter-spacing: 0.02em;
  line-height: 1.25;
  color: #111;
}

.auth-close {
  appearance: none;
  border: 0;
  background: #f3f4f6;
  color: #475569;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0;
  flex: 0 0 auto;
}

.auth-close:hover,
.auth-close:focus-visible {
  background: #e8eaee;
  color: #111;
  outline: none;
}

.auth-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 1.15rem 1.25rem 1.35rem;
}

.auth-msg {
  min-height: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: #d12a2a;
  margin: 0 0 0.75rem;
  text-align: left;
}

.auth-msg:empty {
  display: none;
}

.auth-view {
  display: none;
}

.auth-view.active {
  display: block;
}

.auth-body .field {
  display: grid;
  justify-items: stretch;
  gap: 0.38rem;
  margin-bottom: 0.9rem;
  min-height: auto;
  border: 0;
  padding: 0;
  background: transparent;
}

.auth-body .field label {
  font-size: 0.8rem;
  color: #475569;
  font-weight: 650;
  text-align: left;
  width: 100%;
}

.auth-body .field input {
  width: 100%;
  max-width: none;
  height: 2.65rem;
  padding: 0 0.9rem;
  border-radius: 10px;
  border: 1px solid #d7dbe2;
  background: #f8fafc;
  outline: none;
  font-size: 0.92rem;
  justify-self: stretch;
  box-sizing: border-box;
  color: #111;
}

.field input:focus {
  border-color: #c93030;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(201, 48, 48, 0.12);
}

.auth-view .auth-btn {
  display: block;
  width: 100%;
  max-width: none;
  margin: 0.15rem 0 0;
  appearance: none;
  border: 0;
  cursor: pointer;
  border-radius: 10px;
  padding: 0.78rem 1rem;
  min-height: 2.7rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  background: #c93030;
}

.auth-view .auth-btn:hover,
.auth-view .auth-btn:focus-visible {
  background: #b42323;
  outline: none;
}

.auth-view .auth-btn:disabled,
.auth-view .mini-btn:disabled,
.auth-view button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.auth-agree {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.2rem 0.35rem;
  margin: 0.15rem 0 0.85rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: #475569;
}

.auth-agree-check {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.45rem;
  cursor: pointer;
  user-select: none;
}

.auth-agree input {
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  margin-top: 0.12rem;
  accent-color: #c93030;
}

.auth-agree-links,
.auth-agree a {
  color: #c93030;
  font-weight: 650;
}

.auth-agree a {
  text-decoration: none;
}

.auth-agree a:hover {
  text-decoration: underline;
}

.auth-links {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  margin-top: 1.05rem;
}

.link-btn {
  background: transparent;
  border: 0;
  cursor: pointer;
  color: #c93030;
  font-size: 0.82rem;
  font-weight: 650;
  padding: 0.15rem 0;
  text-decoration: none;
}

.link-btn:hover,
.link-btn:focus-visible {
  text-decoration: underline;
  outline: none;
}

.inline-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: end;
  margin-bottom: 0.9rem;
}

.inline-action .field {
  margin-bottom: 0;
  min-width: 0;
}

.inline-action .field input {
  max-width: none;
}

.mini-btn {
  appearance: none;
  border: 1px solid #f0c7c4;
  background: #fff7f6;
  color: #c93030;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0 0.85rem;
  height: 2.65rem;
  cursor: pointer;
  white-space: nowrap;
}

.mini-btn:hover,
.mini-btn:focus-visible {
  background: #ffeceb;
  outline: none;
}

.mini-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-login-tabs {
  display: flex;
  align-items: stretch;
  width: 100%;
  gap: 0;
  margin: 0 0 1.05rem;
  padding: 0.16rem;
  border-radius: 999px;
  background: #f1f5f9;
  box-sizing: border-box;
}

.auth-login-tab {
  flex: 1 1 0;
  min-width: 0;
  border: 0;
  background: transparent;
  color: #64748b;
  border-radius: 999px;
  padding: 0.48rem 0.4rem;
  font-size: 0.82rem;
  font-weight: 650;
  cursor: pointer;
  line-height: 1.2;
}

.auth-login-tab.is-active {
  color: #111;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

html[data-device="phone"] .auth-login-tab[data-login-mode="qr"],
html[data-device="phone"] #loginQrPane,
html[data-device="desktop"] .auth-login-tab[data-login-mode="scan"],
html[data-device="desktop"] #loginScanPane,
html[data-device="tablet"] .auth-login-tab[data-login-mode="scan"],
html[data-device="tablet"] #loginScanPane {
  display: none !important;
}

@media (max-width: 767px) {
  .auth-login-tab[data-login-mode="qr"],
  #loginQrPane {
    display: none !important;
  }
}

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

.auth-login-qr-canvas {
  display: block;
  width: min(196px, 58vw);
  height: auto;
  margin: 0.35rem auto 0.7rem;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 0 0 1px #e8eaee;
}

.auth-login-hint {
  margin: 0 0 0.7rem;
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #64748b;
}

.auth-login-scan-stage {
  position: relative;
  width: min(240px, 70vw);
  margin: 0 auto 0.7rem;
  border-radius: 14px;
  overflow: hidden;
  background: #111;
  aspect-ratio: 3 / 4;
  max-height: min(42vh, 300px);
}

.auth-login-scan-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #111;
}

.auth-login-scan-actions {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

/* 平板：居中卡片，不要贴底窄条 */
html[data-device="tablet"] .auth-overlay.open {
  align-items: center;
  justify-content: center;
  padding: 32px 28px;
}

html[data-device="tablet"] .auth-modal {
  width: min(440px, 100%);
  max-height: min(86vh, 780px);
  border-radius: 20px;
}

html[data-device="tablet"] .auth-body {
  padding: 1.2rem 1.4rem 1.5rem;
}

html[data-device="tablet"] .auth-body .field input,
html[data-device="tablet"] .auth-view .auth-btn,
html[data-device="tablet"] .mini-btn {
  min-height: 2.75rem;
  font-size: 1rem;
}

/* 手机：封面照常显示；点封面后才弹出全屏登录 */
html[data-device="phone"] .home-stage {
  display: flex;
}

html[data-device="phone"] .auth-overlay {
  display: none;
}

html[data-device="phone"] .auth-overlay.open {
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  background: #fff;
}

html[data-device="phone"] .auth-modal {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  min-height: 100dvh;
  min-height: 100svh;
  border-radius: 0;
  border: 0;
  box-shadow: none;
}

html[data-device="phone"] .auth-sheet-handle {
  display: none;
}

html[data-device="phone"] .auth-top {
  padding: calc(0.75rem + env(safe-area-inset-top, 0px)) 1.15rem 0.8rem;
}

html[data-device="phone"] .auth-close {
  width: 2.15rem;
  height: 2.15rem;
}

html[data-device="phone"] .auth-top h2 {
  font-size: 1.42rem;
}

html[data-device="phone"] .auth-body {
  padding: 1.15rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
}

html[data-device="phone"] .auth-body .field input,
html[data-device="phone"] .auth-view .auth-btn,
html[data-device="phone"] .mini-btn,
html[data-device="phone"] .inline-action .mini-btn {
  min-height: 3rem;
  height: 3rem;
  box-sizing: border-box;
  font-size: 16px;
}

html[data-device="phone"] .inline-action {
  align-items: end;
}

html[data-device="phone"] .auth-links .link-btn {
  min-height: 2.4rem;
  display: inline-flex;
  align-items: center;
}

html[data-device="phone"] .auth-agree {
  font-size: 0.8rem;
  margin-bottom: 1rem;
}

html[data-device="phone"] .auth-login-tab {
  min-height: 2.45rem;
  font-size: 0.86rem;
}

html[data-device="phone"] .auth-login-scan-stage {
  width: min(280px, 86vw);
  max-height: min(46vh, 340px);
}
