/********************************************
 * 0. 全局 Reset + 背景
 ********************************************/
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #0b5c3a 0, #02210f 45%, #001407 100%);
  color: #f5f5f5;
  min-height: 100vh;
  overflow-x: hidden;
}

/********************************************
 * 1. 顶部按钮区（首页）
 ********************************************/
.top-bar {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  z-index: 20;
}

.top-bar-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.btn {
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(8px);
  color: #f5f5f5;
  cursor: pointer;
  font-size: 14px;
}

.btn:hover {
  background: rgba(0,0,0,0.65);
}

.btn-small {
  padding: 4px 10px;
  font-size: 12px;
}

/********************************************
 * 2. 主视图布局（托盘与网格）
 ********************************************/
.table-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  /* 直接整屏高度就行，不用减也不用额外上 padding */
  min-height: 100vh;
  padding: 0;
}

.wood-circle {
  position: relative;              /* 让 card-grid 以托盘为定位基准 */

  display: flex;                   /* ⭐ 托盘本身在 table-wrapper 内居中 */
  justify-content: center;
  align-items: center;

  width: min(70vmin, 90vw);
  height: min(70vmin, 90vw);

  max-height: 80vh;
  max-width: 80vh;

  border-radius: 50%;              /* ⭐ 防止托盘变成方形 */
  overflow: visible;               /* 卡牌阴影不被剪裁 */

  margin: 0 auto;                  /* ⭐ 防止托盘向左跑偏 */
}

/* 默认木质主题 */
.theme-wood .wood-circle {
  background: radial-gradient(circle, #c88b4a, #8b5524 60%, #452312);
}

/* 水晶主题 */
.theme-crystal .wood-circle {
  background: radial-gradient(circle, rgba(150,200,255,0.9), #6aa8ff 50%, #1d3b78);
  box-shadow: 0 0 40px rgba(140,180,255,0.7);
}

.goddess-highlight {
  box-shadow: 0 0 25px rgba(255, 200, 50, 0.9) !important;
  border: 2px solid rgba(255, 220, 100, 0.9);
}

/* 魔法阵主题 */
.theme-magic .wood-circle {
  background: url('magic_circle.png'), radial-gradient(circle, #732aff, #2a0a52);
  background-size: contain;
  background-blend-mode: lighten;
  box-shadow: 0 0 60px rgba(200,100,255,0.8);
}

/********************************************
 * 3. 卡牌网格布局（4×2）
 ********************************************/
.card-grid {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 80%;
  height: 80%;
  transform: translate(-50%, -50%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 1.5vmin;
  z-index: 5;
}

/********************************************
 * 4. 单张卡牌（扑克牌造型）
 ********************************************/
.card {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;  /* 防止内容撑开 */
  cursor: pointer;
  perspective: 1200px;
  transform-style: preserve-3d;
  z-index: 5;
}

/* 悬浮微动 */
.card:hover {
  transform: translateY(-0.5vmin);
}

/* 点击波纹：基础 */
.card::after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
}

.card.ripple::after {
  animation: ripple 0.5s ease-out;
}

/* 波纹动画 */
@keyframes ripple {
  0% {
    width: 0;
    height: 0;
    opacity: 0.5;
  }
  100% {
    width: 220%;
    height: 220%;
    opacity: 0;
  }
}

/* 洗牌落位动画（进场） */
@keyframes shuffle {
  0% { transform: translateY(-10vmin) rotate(8deg); opacity: 0; }
  50% { transform: translateY(2vmin) rotate(-3deg); opacity: 1; }
  100% { transform: translateY(0) rotate(0deg); opacity: 1; }
}

.card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.25,1.4,0.3,1), box-shadow .3s ease;
  box-shadow: 0 6px 12px rgba(0,0,0,0.4);
}

@media (max-width: 480px) {
  .card-inner {
    transition: transform 0.55s cubic-bezier(0.32, 1.4, 0.4, 1.05),
                box-shadow .25s ease;
  }
}

/* 翻面 */
.card.flipped .card-inner {
  transform: rotateY(180deg);
  box-shadow:
    inset -8px 0 12px rgba(0,0,0,0.25),
    inset 8px 0 12px rgba(255,255,255,0.25);
}

/* 翻牌时扫过的光带 */
.card-inner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    75deg,
    transparent 40%,
    rgba(255,255,255,0.4) 50%,
    transparent 60%
  );
  opacity: 0;
  transform: translateX(-150%);
  pointer-events: none;
  transition: transform 0.6s ease, opacity 0.3s ease;
}

.card.flipped .card-inner::after {
  opacity: 1;
  transform: translateX(150%);
}

/********************************************
 * 4.1 卡牌正反两面（统一）
 ********************************************/
.card-face {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 1vmin;
  backface-visibility: hidden;
  box-shadow:
    0 6px 12px rgba(0,0,0,0.35),
    0 0 0 1px rgba(0,0,0,0.16);
}

.card-face::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    rgba(255,255,255,0.25),
    transparent 30%,
    transparent 70%,
    rgba(0,0,0,0.08)
  );
  opacity: 0;
  pointer-events: none;
  transition: opacity .4s ease;
}

.card:hover .card-face::after {
  opacity: .35;
}

/********************************************
 * 4.2 正面：扑克牌风格 + 内框
 ********************************************/
.card-front {
  background: #fdfdfd;
  transform: rotateY(180deg);
  padding: 1.4vmin;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.card-front::before {
  content: "";
  position: absolute;
  inset: .9vmin;
  border-radius: .9vmin;
  border: 1px solid rgba(0,0,0,0.2);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.7),
    inset 0 0 10px rgba(0,0,0,0.06);
}

/********************************************
 * 4.3 背面：经典扑克牌背纹
 ********************************************/
.card-back {
  background:
    repeating-linear-gradient(
      45deg,
      #0c1c2b 0px,
      #0c1c2b 4px,
      #122c43 4px,
      #122c43 8px
    ),
    radial-gradient(circle at 50% 50%, rgba(255,255,255,0.12), transparent 70%);
  border-radius: 1.2vmin;
  border: 2px solid rgba(255,255,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(250,250,250,0.9);
  letter-spacing: .25em;
  font-size: 1.3vmin;
  text-transform: uppercase;
}

/********************************************
 * 4.4 卡牌内容：头像 / 名字 / 角标 / 点赞
 ********************************************/
.card-avatar {
  width: 70%;
  aspect-ratio: 3 / 4;
  border-radius: .8vmin;
  overflow: hidden;
  border: 2px solid rgba(120,120,120,0.6);
  margin-bottom: 1vmin;
  box-shadow: 0 3px 8px rgba(0,0,0,0.25);
}

.card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-name {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 2vmin;
  font-weight: 600;
  letter-spacing: .25em;
  color: #333;

  max-height: 60%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 12;
  -webkit-box-orient: vertical;
}

/* 手机版名字（横排用，不使用 writing-mode） */
.card-name-mobile {
  font-size: 3.6vmin;
  font-weight: 600;
  color: #333;
  text-align: center;
  line-height: 1.3;
  padding: 0 6px;

  max-height: 32%;
  overflow: hidden;
  white-space: normal;
  display: block;
}


/* 左上 / 右下角标（首字母 / 花色） */
.card-corner {
  position: absolute;
  font-size: 1.6vmin;
  font-weight: bold;
  color: #222;
  font-family: "Georgia", serif;
  line-height: 1.2;
  text-align: center;
  pointer-events: none;
}

.card-corner.top-left {
  top: 0.8vmin;
  left: 0.8vmin;
}

.card-corner.bottom-right {
  bottom: 0.8vmin;
  right: 0.8vmin;
  transform: rotate(180deg);
}

/* 点赞角标 */
.card-like-count {
  position: absolute;
  bottom: 1vmin;
  right: 1vmin;
  font-size: 1.4vmin;
  color: #b22222;
  font-weight: bold;
}

/* 点赞按钮（心形） */
.like-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 2.2vmin;
  cursor: pointer;
  z-index: 10;
  user-select: none;
  transition: transform .2s ease;
}

.like-btn:hover {
  transform: scale(1.3);
}

/********************************************
 * 5. 番号弹窗
 ********************************************/
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
}

@keyframes popupFadeIn {
  0%   { opacity: 0; transform: scale(.6) rotate(-5deg); box-shadow: 0 0 0 rgba(255,255,255,0); }
  60%  { opacity: 1; transform: scale(1.05) rotate(2deg); box-shadow: 0 0 40px rgba(255,255,200,0.7); }
  100% { opacity: 1; transform: scale(1) rotate(0);      box-shadow: 0 0 20px rgba(255,255,200,0.4); }
}

.modal-card {
  animation: popupFadeIn .35s ease-out;
  background: #faf7f1;
  padding: 20px 28px;
  border-radius: 16px;
  min-width: 260px;
  max-width: 320px;
  text-align: center;
  color: #2b2117;
  border: 3px solid rgba(255,255,220,0.6);
  box-shadow: 0 18px 40px rgba(0,0,0,0.6);
}

.modal-card h2 {
  margin-bottom: 10px;
}

.modal-code {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin: 10px 0 6px;
}

.modal-hint {
  font-size: 12px;
  opacity: 0.6;
}

/********************************************
 * 6. 后台管理样式
 ********************************************/
.admin-container {
  padding: 24px;
  max-width: 960px;
  margin: 0 auto;
  color: #f5f5f5;
}

.admin-card {
  background: rgba(0,0,0,0.4);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.admin-works {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.actress-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(0,0,0,0.4);
  border-radius: 12px;
  overflow: hidden;
  font-size: 14px;
}

.actress-table th,
.actress-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.actress-table thead {
  background: rgba(0,0,0,0.5);
}

.works-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.work-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(250,247,241,0.06);
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 12px;
}

.work-badge input {
  cursor: pointer;
}

.badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(250,247,241,0.1);
  font-size: 12px;
}

.badge button {
  margin-left: 6px;
  font-size: 11px;
}

input[type="text"] {
  padding: 6px 10px;
  border-radius: 999px;
  border: none;
  margin-right: 6px;
  font-size: 14px;
}

/* 管理页头像缩略图 */
.admin-avatar-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  margin-left: 8px;
  vertical-align: middle;
}

/********************************************
 * 7. 登录页面
 ********************************************/
.login-body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #0b5c3a 0, #02210f 45%, #001407 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f5f5f5;
}

.login-card {
  background: rgba(0,0,0,0.5);
  padding: 24px 28px;
  border-radius: 18px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.7);
}

.login-card h1 {
  margin-bottom: 16px;
  font-size: 22px;
  text-align: center;
}

.login-field {
  margin-bottom: 12px;
  font-size: 14px;
}

.login-field label {
  display: block;
  margin-bottom: 4px;
}

.login-field input[type="text"],
.login-field input[type="password"],
.login-field input[type="file"] {
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  border: none;
  outline: none;
}

  .card-corner.bottom-right {
    display: none !important;
}

.login-error {
  background: rgba(255,0,0,0.3);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
}

/********************************************
 * 8. 响应式适配
 ********************************************/
@media (max-width: 768px) {
  .wood-circle {
    width: 90vmin;
    height: 90vmin;
  }

  .card-grid {
    width: 85%;
    height: 85%;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(4, 1fr);
  }

  .top-bar {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  pointer-events: auto;
}

  .admin-container {
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .card-grid {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(8, 1fr);
  }

  .card-name {
    font-size: 2.4vmin;
  }

  .like-btn {
    font-size: 5vmin;
  }

  .modal-card {
    transform: scale(1.1);
    padding: 24px 26px;
  }

  .btn {
    padding: 10px 20px;
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .card-inner {
    transition: transform 0.55s cubic-bezier(0.32, 1.40, 0.40, 1.10),
                box-shadow .25s ease;
  }
}

@media (max-width: 480px) {
  .card-front .card-name {
    position: relative;
    overflow: hidden;
  }

  .card-front .card-name::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    height: 30%;
    width: 100%;
    background: linear-gradient(to bottom, transparent, rgba(255,255,255,0.9));
  }
}

@media (max-width: 380px) {
  .wood-circle {
    width: 85vmin;
    height: 85vmin;
    max-width: 85vmin;
    max-height: 85vmin;
  }

  .card {
    height: 23vmin;
  }

  .card-name {
    font-size: 4vmin;
  }
}

.card-preview-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99;
}

.card-preview-modal img {
  width: 75vw;
  max-height: 85vh;
  border-radius: 12px;
  box-shadow: 0 0 25px rgba(255,255,255,0.4);
}
