/* ==========================================================================
   布局与双端（桌面/移动）响应式体系 Layout CSS
   ========================================================================== */

.app-root {
  position: relative;
  z-index: 5;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.view {
  position: absolute;
  inset: 0;
  display: none;
  opacity: 0;
  transition: opacity 0.45s var(--ease-silk);
}

.view.active {
  display: flex;
  opacity: 1;
}

/* ==========================================================================
   1. 主界面 Title View
   ========================================================================== */
.view-title {
  flex-direction: column;
  justify-content: space-between;
  padding: 36px 56px;
}

.title-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.title-dynasty-mark {
  font-size: 13px;
  letter-spacing: 0.35em;
  color: var(--gold-light);
  opacity: 0.85;
  border-left: 2px solid var(--gold);
  padding-left: 12px;
}

.title-center-hero {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 620px;
  margin-top: auto;
  margin-bottom: auto;
  animation: fadeUp 0.9s var(--ease-silk);
}

.title-vertical-tagline {
  font-size: 14px;
  letter-spacing: 0.42em;
  color: var(--gold);
  margin-bottom: 12px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9);
}

.title-main-logo {
  font-family: var(--font-calligraphy);
  font-size: clamp(54px, 7.5vw, 94px);
  font-weight: 400;
  line-height: 1.08;
  margin: 0;
  color: var(--paper);
  text-shadow: 0 6px 28px rgba(0, 0, 0, 0.88), 0 0 32px rgba(207, 169, 98, 0.25);
  letter-spacing: 0.08em;
}

.title-sub-logo {
  font-size: clamp(18px, 2.2vw, 24px);
  font-weight: 500;
  letter-spacing: 0.45em;
  color: var(--gold-light);
  margin: 10px 0 28px 4px;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.9);
}

.title-menu-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 280px;
}

.title-menu-row {
  display: flex;
  gap: 10px;
}

.title-menu-row .btn-ink {
  flex: 1;
}

.title-footer-note {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.78;
}

/* ==========================================================================
   2. 角色创建 Create View
   ========================================================================== */
.view-create {
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.create-scroll-card {
  width: 100%;
  max-width: 980px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 28px 34px;
  animation: fadeUp 0.55s var(--ease-silk);
}

.create-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.create-title {
  font-family: var(--font-calligraphy);
  font-size: 34px;
  color: var(--gold-light);
  margin: 0;
  letter-spacing: 0.12em;
}

.origin-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}

.origin-card {
  position: relative;
  padding: 18px;
  background: rgba(20, 18, 22, 0.78);
  border: 1px solid rgba(207, 169, 98, 0.28);
  cursor: pointer;
  transition: all 0.28s var(--ease-silk);
}

.origin-card:hover {
  border-color: var(--gold);
  background: rgba(36, 24, 24, 0.85);
}

.origin-card.selected {
  border-color: var(--gold-light);
  background: linear-gradient(180deg, rgba(112, 26, 26, 0.45) 0%, rgba(24, 18, 22, 0.92) 100%);
  box-shadow: 0 0 22px rgba(207, 169, 98, 0.22);
}

.origin-card h3 {
  margin: 0 0 6px;
  font-size: 20px;
  color: var(--gold-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.origin-tag {
  font-size: 11px;
  padding: 2px 7px;
  border: 1px solid var(--gold-dim);
  color: var(--gold);
}

.origin-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin: 8px 0 12px;
  line-height: 1.6;
}

.origin-bonuses {
  font-size: 12px;
  color: var(--gold-light);
  border-top: 1px dashed rgba(207, 169, 98, 0.25);
  padding-top: 8px;
}

.create-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--gold);
  margin-bottom: 6px;
  letter-spacing: 0.12em;
}

.palace-input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(12, 11, 14, 0.85);
  border: 1px solid rgba(207, 169, 98, 0.4);
  color: var(--text-light);
  font-family: var(--font-serif);
  font-size: 15px;
  outline: none;
}

.palace-input:focus {
  border-color: var(--gold-light);
  box-shadow: 0 0 12px rgba(207, 169, 98, 0.2);
}

.choice-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-pill {
  padding: 7px 14px;
  font-size: 13px;
  background: rgba(20, 18, 22, 0.78);
  border: 1px solid rgba(207, 169, 98, 0.28);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.choice-pill:hover {
  border-color: var(--gold);
  color: var(--text-light);
}

.choice-pill.selected {
  background: rgba(143, 36, 36, 0.65);
  border-color: var(--gold-light);
  color: var(--gold-light);
}

.create-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid rgba(207, 169, 98, 0.24);
}

/* ==========================================================================
   3. 宫廷日常主界面 Palace View
   ========================================================================== */
.view-palace {
  flex-direction: column;
  justify-content: space-between;
  padding: 14px 22px 18px;
  gap: 12px;
}

.palace-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;
  gap: 14px;
  flex-wrap: wrap;
}

.topbar-identity {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-avatar {
  width: 48px;
  height: 48px;
  border-radius: 2px;
  border: 1.5px solid var(--gold);
  object-fit: cover;
  object-position: top center;
}

.topbar-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--paper);
}

.topbar-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.topbar-calendar {
  text-align: center;
}

.calendar-date {
  font-size: 16px;
  color: var(--gold-light);
  letter-spacing: 0.16em;
  font-weight: 600;
}

.calendar-ap {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.topbar-quick-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* 中央三栏布局 */
.palace-main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 270px 1fr 290px;
  gap: 14px;
}

.palace-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 14px 16px;
  overflow-y: auto;
}

.col-heading {
  font-size: 14px;
  letter-spacing: 0.22em;
  color: var(--gold);
  border-bottom: 1px solid rgba(207, 169, 98, 0.26);
  padding-bottom: 8px;
  margin: 0 0 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* 属性条 */
.stat-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.stat-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stat-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.stat-name {
  color: var(--text-muted);
}

.stat-val {
  color: var(--gold-light);
  font-weight: 600;
}

.stat-bar-bg {
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold-light));
  transition: width 0.4s var(--ease-silk);
}

.stat-bar-fill.danger {
  background: linear-gradient(90deg, #7c1f1f, #d94c42);
}

.stat-bar-fill.jade {
  background: linear-gradient(90deg, #2d5952, #63a699);
}

.hidden-sense-box {
  margin-top: 14px;
  padding: 10px 12px;
  background: rgba(143, 36, 36, 0.14);
  border-left: 2px solid var(--cinnabar-bright);
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* 中栏：宫廷景象 + 自由行动网格 */
.palace-center-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 12px;
}

.court-atmosphere-banner {
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.atmosphere-text {
  font-size: 14px;
  color: var(--paper);
  line-height: 1.7;
}

.atmosphere-sub {
  font-size: 12px;
  color: var(--gold);
  margin-top: 4px;
}

.action-grid-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 10px;
}

.action-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px 14px;
  text-align: left;
  background: rgba(24, 21, 26, 0.8);
  border: 1px solid rgba(207, 169, 98, 0.25);
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.24s var(--ease-silk);
}

.action-tile:hover:not(:disabled) {
  background: rgba(68, 22, 24, 0.72);
  border-color: var(--gold-light);
  transform: translateY(-2px);
}

.action-tile:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.action-tile-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gold-light);
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.action-tile-cost {
  font-size: 11px;
  color: var(--text-muted);
  border: 1px solid rgba(207, 169, 98, 0.3);
  padding: 1px 5px;
}

.action-tile-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* 右栏：后宫暗流与邸报 */
.rumor-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rumor-item {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-left: 2px solid var(--gold-dim);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-light);
}

.rumor-item.urgent {
  border-left-color: var(--cinnabar-bright);
  background: rgba(143, 36, 36, 0.16);
}

.rumor-time {
  font-size: 11px;
  color: var(--gold);
  margin-bottom: 3px;
}

/* 底部功能导航栏 */
.palace-dock {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;
  gap: 10px;
}

.dock-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ==========================================================================
   4. 全屏剧情舞台 Stage View
   ========================================================================== */
.view-stage {
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 24px 20px;
}

.stage-top-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 6;
}

.stage-chapter-badge {
  padding: 6px 16px;
  background: rgba(14, 13, 16, 0.78);
  border: var(--border-gold);
  font-size: 13px;
  letter-spacing: 0.2em;
  color: var(--gold-light);
}

.stage-portraits {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding-bottom: 185px;
  gap: 40px;
  z-index: 3;
}

.portrait-slot {
  max-height: 68vh;
  max-width: 44vw;
  display: flex;
  align-items: flex-end;
  transition: all 0.5s var(--ease-silk);
}

.portrait-img {
  max-height: 64vh;
  max-width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 16px 32px rgba(0, 0, 0, 0.78));
  mask-image: linear-gradient(180deg, rgba(0,0,0,1) 76%, rgba(0,0,0,0) 100%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,1) 76%, rgba(0,0,0,0) 100%);
  animation: fadeUp 0.45s var(--ease-silk);
}

.portrait-slot.dimmed .portrait-img {
  filter: brightness(0.55) saturate(0.75) drop-shadow(0 12px 24px rgba(0, 0, 0, 0.7));
  transform: scale(0.95);
}

/* 底部对白与选项区 */
.stage-bottom-zone {
  position: relative;
  z-index: 8;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stage-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 38vh;
  overflow-y: auto;
  animation: fadeUp 0.35s var(--ease-silk);
}

.stage-choice-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 20px;
  text-align: left;
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--paper);
  background: rgba(20, 17, 22, 0.88);
  border: 1px solid rgba(207, 169, 98, 0.42);
  cursor: pointer;
  transition: all 0.24s var(--ease-silk);
}

.stage-choice-btn:hover:not(:disabled) {
  background: linear-gradient(90deg, rgba(130, 30, 30, 0.88), rgba(40, 22, 24, 0.92));
  border-color: var(--gold-light);
  padding-left: 26px;
}

.stage-choice-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.choice-hint-tag {
  font-size: 12px;
  color: var(--gold);
  white-space: nowrap;
  border: 1px solid rgba(207, 169, 98, 0.35);
  padding: 2px 8px;
}

/* 自由输入条 */
.free-input-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  background: rgba(15, 14, 18, 0.88);
  border: 1px solid rgba(207, 169, 98, 0.35);
}

.free-input-bar input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--paper);
  font-family: var(--font-serif);
  font-size: 14px;
  outline: none;
}

.free-input-bar input::placeholder {
  color: rgba(185, 174, 156, 0.6);
}

/* 对白框 */
.dialogue-box {
  position: relative;
  min-height: 156px;
  padding: 22px 28px 18px;
  background: linear-gradient(180deg, rgba(16, 14, 18, 0.88) 0%, rgba(12, 10, 14, 0.95) 100%);
  border: 1px solid rgba(207, 169, 98, 0.52);
  box-shadow: var(--shadow-deep);
  cursor: pointer;
}

.dialogue-speaker-plate {
  position: absolute;
  top: -17px;
  left: 24px;
  padding: 4px 18px;
  background: linear-gradient(90deg, var(--cinnabar-deep), var(--cinnabar));
  border: 1px solid var(--gold);
  color: var(--gold-light);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.18em;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.55);
}

.dialogue-text {
  font-size: var(--fs-dialogue);
  line-height: 1.85;
  color: var(--paper);
  white-space: pre-wrap;
  min-height: 82px;
}

.dialogue-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.dialogue-continue-cue {
  color: var(--gold);
  animation: subtleFloat 1.5s infinite;
}

/* ==========================================================================
   5. 手机端与平板响应式适配
   ========================================================================== */
@media (max-width: 960px) {
  .view-title {
    padding: 24px 22px;
  }
  .origin-grid {
    grid-template-columns: 1fr;
  }
  .create-form-grid {
    grid-template-columns: 1fr;
  }
  .create-scroll-card {
    padding: 18px 16px;
  }

  .view-palace {
    padding: 8px 10px 10px;
    gap: 8px;
  }
  .palace-topbar {
    padding: 8px 12px;
  }
  .palace-main {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    gap: 10px;
  }
  .palace-col, .action-grid-wrap {
    overflow: visible;
    flex-shrink: 0;
  }
  .action-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .palace-dock {
    padding: 8px 10px;
    overflow-x: auto;
    flex-wrap: nowrap;
  }
  .dock-nav {
    flex-wrap: nowrap;
  }
  .dock-nav .btn-ink {
    white-space: nowrap;
    padding: 8px 12px;
    font-size: 12px;
  }

  .view-stage {
    padding: 10px 10px 12px;
  }
  .stage-portraits {
    padding-bottom: 205px;
    gap: 10px;
  }
  .portrait-img {
    max-height: 48vh;
  }
  .dialogue-box {
    padding: 18px 16px 14px;
    min-height: 138px;
  }
  .stage-choice-btn {
    padding: 11px 14px;
    font-size: 14px;
  }
}
