/* Global reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;

  /* Office desk background image */
  background-image: url("office-desk.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

/* Overlay for readability */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.75);
  z-index: -1;
}

header {
  background-color: rgba(44, 62, 80, 0.95);
  color: white;
  text-align: center;
  padding: 40px 20px;
  margin-bottom: 30px;
  border-radius: 8px;
}

header h1 {
  font-size: 2.5em;
}

section {
  background-color: rgba(255, 255, 255, 0.95);
  padding: 30px;
  margin-bottom: 20px;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);

  /* 关键 */
  will-change: transform;
  transform: translateY(var(--float-offset, 0px));
  transition:
    transform 0.28s cubic-bezier(0.22, 0.61, 0.36, 1),
    box-shadow 0.28s ease;
}

/* hover：卡片轻微抬起 */
section:hover {
  transform:
    translateY(calc(var(--float-offset, 0px) - 6px))
    scale(1.002);
  box-shadow: 0 10px 28px rgba(0,0,0,0.18);
}


h2 {
  color: #2c3e50;
  margin-bottom: 15px;
  border-bottom: 2px solid #3498db;
  padding-bottom: 10px;
}

p {
  margin-bottom: 10px;
}

.upload-box {
  border: 2px dashed #3498db;
  padding: 20px;
  text-align: center;
  border-radius: 8px;
  margin-top: 15px;
}

.download-box {
  border: 2px dashed #3498db;
  padding: 18px;
  text-align: center;
  border-radius: 8px;
  margin-top: 15px;
  background-color: #fbfdff;
}

#downloadForm {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 520px;
  margin: 10px auto 0;
}

#downloadForm input {
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 1rem;
}

#downloadBtn {
  padding: 10px 14px;
  background: #3498db;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

#downloadBtn:hover { background: #2b85c6; }

#downloadMessage { margin-top: 10px; color: #666; text-align: center; }

.preview {
  margin-top: 15px;
}

.preview img {
  max-width: 150px;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

#clock {
  margin-top: 10px;
}

/* Chat widget styles */


.chat-messages {
flex: 1;
padding: 12px;
overflow-y: auto;
background: linear-gradient(#ffffff, #f9fbfd);
}


.msg {
padding: 10px 14px;
margin-bottom: 10px;
border-radius: 12px;
font-size: 0.95rem;
max-width: 80%;
}


.msg.owner {
background: #eef2f7;
}


.chat-form {
padding: 10px;
display: flex;
flex-direction: column;
gap: 8px;
background: #fafafa;
border-top: 1px solid #eee;
}


.chat-form input,
.chat-form textarea {
padding: 10px;
border-radius: 8px;
border: 1px solid #dbe7f3;
font-family: inherit;
resize: none;
}
.chat-form input[type="file"] {
  font-size: 0.85rem;
  padding: 6px;
}

.chat-form textarea {
min-height: 70px;
}


.chat-form button {
background: #2c3e50;
color: white;
border: none;
padding: 10px;
border-radius: 8px;
cursor: pointer;
}


#chat-widget:not(.open) .chat-header,
#chat-widget:not(.open) .chat-messages,
#chat-widget:not(.open) .chat-form {
opacity: 0;
transform: translateY(6px);
}


#chat-widget.open .chat-header,
#chat-widget.open .chat-messages,
#chat-widget.open .chat-form {
opacity: 1;
transform: translateY(0);
}


#chat-widget:not(.open) .chat-toggle .chat-status {
  display: none;
}

/* Chat toggle (floating button) */
.chat-toggle {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #2c3e50;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 22px rgba(44,62,80,0.18);
  border: none;
  cursor: pointer;
  z-index: 1000;
  font-size: 20px;
}

.chat-toggle .chat-icon {
  font-size: 22px;
  line-height: 1;
}

.chat-toggle:focus {
  outline: 3px solid rgba(52,152,219,0.18);
}

/* Position and sizing for chat window anchored above the toggle */
.chat-window {
  position: fixed;
  right: 20px;
  bottom: 92px; /* space above the toggle */
  width: 340px;
  max-width: calc(100% - 40px);
  border-radius: 12px;
  z-index: 1000;
  box-shadow: 0 14px 40px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  max-height: 75vh;
  overflow: hidden;
  background: white;
}

/* Hide and collapse the chat window when the widget isn't open so it doesn't block page content */
#chat-widget:not(.open) .chat-window {
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px) scale(0.995);
  max-height: 0; /* collapse height */
  pointer-events: none; /* ignore pointer events when closed */
}

#chat-widget.open .chat-window {
  opacity: 1;
  visibility: visible;
  transform: none;
  max-height: 75vh;
  pointer-events: auto;
}

.chat-window {
  transition: opacity 0.22s ease, transform 0.22s ease, max-height 0.28s ease;
}

@media (max-width: 480px) {
  .chat-toggle {
    right: 12px;
    bottom: 12px;
    width: 50px;
    height: 50px;
    font-size: 18px;
  }
  .chat-window {
    right: 12px;
    bottom: 74px;
    width: 92%;
  }
}
/* =============================
   FLOATING IMAGE CAROUSEL TRIGGER
   ============================= */
#carouselTrigger {
  position: fixed;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);

  width: 56px;
  height: 56px;
  border-radius: 50%;

  background: #2c3e50;
  color: white;
  font-size: 22px;

  border: none;
  cursor: pointer;
  z-index: 999;

  box-shadow: 0 8px 22px rgba(44, 62, 80, 0.25);
}

#carouselTrigger:hover {
  background: #3498db;
}

#carouselTrigger:focus {
  outline: 3px solid rgba(52, 152, 219, 0.35);
}

/* =============================
   CAROUSEL VIEWPORT PORTAL
   ============================= */
#carousel-portal {
  position: fixed;
  inset: 0;
  pointer-events: none; /* portal ignores clicks */
  z-index: 9999;
}

/* Re-enable clicks only on button */
#carouselTrigger {
  pointer-events: auto;
}
/* =============================
   IMAGE CAROUSEL – STEP 2 STATIC
   ============================= */

#carousel-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  /* size is computed in JS to match image scale and radius */
  width: auto;
  height: auto;
  min-width: 320px;
  min-height: 220px;

  perspective: 1400px;

  opacity: 0;
  pointer-events: none;

  transition: opacity 220ms ease;
} 

/* Visible + clickable when opened */
#carousel-container.open {
  opacity: 1;
  pointer-events: auto;
}



/* Ring */
.carousel-ring {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

.carousel-ring img {
  position: absolute;
  top: 50%;
  left: 50%;

  /* base sizes (used if JS not available) */
  --carousel-img-w: 220px;
  --carousel-img-h: 200px;

  max-width: var(--carousel-img-w);
  max-height: var(--carousel-img-h);
  width: auto !important;
  height: auto !important;
  object-fit: contain;
  border-radius: 10px;
  
  /* Ensure minimum visibility for very small images */
  min-width: 80px;
  min-height: 80px;

  transform-style: preserve-3d;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  transition: transform 0.4s ease;

  cursor: pointer;
  user-select: none;

}

.carousel-preview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0 6px;
}

.carousel-preview-item,
.carousel-slot {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid #ddd;
  cursor: pointer;
  background: #f5f5f5;
  aspect-ratio: 16 / 10;
  transition: all 0.2s ease;
}

.carousel-preview-item:hover,
.carousel-slot:hover {
  border-color: #3498db;
  transform: scale(1.02);
}

.carousel-preview-item.selected,
.carousel-slot.selected {
  border-color: #2ecc71;
  border-width: 3px;
  box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.2);
}

.carousel-preview-item img,
.carousel-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.carousel-preview-badge,
.slot-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(44, 62, 80, 0.85);
  color: #fff;
  z-index: 10;
}

.carousel-slot .empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: #999;
  font-size: 0.85rem;
}




/* Admin Login: compact + slide-out panel */
.admin-login {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 99999;

  display: flex;
  align-items: center;
  gap: 8px;
}

/* The slide-out panel (to the LEFT of the button) */
.admin-panel {
  display: flex;
  align-items: center;
  gap: 8px;

  /* slide behavior */
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateX(10px);
  pointer-events: none;

  transition: max-width 240ms ease, opacity 180ms ease, transform 240ms ease;
}

.admin-login.is-open .admin-panel {
  max-width: 520px;      /* enough for two inputs + message */
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.admin-panel input {
  width: 170px;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.9rem;
  background: rgba(255,255,255,0.92);
}

.admin-login-msg {
  font-size: 0.85rem;
  color: #666;
  max-width: 220px;
  white-space: nowrap;
}

/* Button style (keeps your existing vibe) */
.admin-login-btn {
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: #2c3e50;
  color: #fff;
}

/* =============================
   RESUME SPLIT (LEFT/RIGHT)
   ============================= */
.resume-split{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}

.right-card{
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 14px;
  padding: 16px;
  background: rgba(255,255,255,0.88);
   display: flex;            /* ✅ 新增 */
  flex-direction: column;
}

/* Tabs */
.tabs{
  display:flex;
  gap: 10px;
  margin-bottom: 14px;
}

.tab-btn{
  flex: 1;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.14);
  background: rgba(255,255,255,0.9);
  cursor: pointer;
  font-weight: 600;
}

.tab-btn.active{
  border-color: rgba(0,0,0,0.24);
  background: rgba(0,0,0,0.04);
}

.tab-panel{ display:none; }
.tab-panel.active{ display:block; }

.panel-head{ margin-bottom: 12px; }
.panel-title{ font-size: 18px; font-weight: 800; }
.panel-sub{ opacity: 0.75; margin-top: 4px; }
.panel-foot{ margin-top: 12px; }

/* Game area */
.game-mount{
  border: 2px dashed rgba(52,152,219,0.35);
  border-radius: 12px;
  padding: 14px;
  min-height: 180px;
  background: #fbfdff;
}

/* Question box */
.q-box{
  border: 2px dashed rgba(52,152,219,0.35);
  border-radius: 12px;
  padding: 14px;
  background: #fbfdff;
}

.q-text{ font-weight: 700; margin-bottom: 10px; }

.q-label{
  display:block;
  margin: 10px 0 6px;
  font-weight: 700;
}

.q-input{
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  outline: none;
  font-size: 1rem;
}

.q-actions{
  display:flex;
  gap: 10px;
  margin-top: 10px;
}

.btn-primary{
  flex:1;
  padding: 10px 14px;
  background: #3498db;
  color: white;
  border: none;
  border-radius: 10px;
  cursor:pointer;
  font-weight: 700;
}

.btn-primary:hover{ background:#2b85c6; }

.btn-ghost{
  flex:1;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  background: transparent;
  cursor:pointer;
  font-weight: 700;
}

.q-feedback{
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0,0,0,0.03);
  display:none;
  white-space: pre-line; /* 让反馈换行更清晰 */
}

.q-ref-wrap{
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0,0,0,0.03);
}

.q-ref-title{ font-weight: 800; margin-bottom: 6px; }

/* 先给一个兜底：屏幕窄时上下排列（以后做手机适配会用到） */
@media (max-width: 900px){
  .resume-split{ grid-template-columns: 1fr; }
}

/* ===== Two independent floating cards ===== */
.resume-split{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}

/* 左右都是独立卡片 */
.left-card,
.right-card{
  background: rgba(255,255,255,0.88);
  border-radius: 18px;
  border: 1px solid rgba(0,0,0,0.10);
  box-shadow: 0 10px 26px rgba(0,0,0,0.10);
  padding: 22px;
}

/* 左侧标题与横线只在左卡片内 */
.left-card h2{ margin-top: 0; }

/* ===== Pill (oval) labels on right ===== */
.pill-tabs{
  display:flex;
  gap: 14px;
  margin-bottom: 18px;
}

.pill-tab{
  flex: 1;
  padding: 14px 14px;
  border-radius: 9999px;            /* ✅ 椭圆 */
  border: 1px solid rgba(0,0,0,0.14);
  background: rgba(255,255,255,0.95);
  cursor: pointer;
  font-weight: 800;
  text-align: center;
}

.pill-tab.active{
  background: rgba(52,152,219,0.12);
  border-color: rgba(52,152,219,0.55);
}

/* 原来的 tab 按钮如果还在，不用了也没关系，但避免影响 */
.tabs{ display:none !important; }

/* panels */
.tab-panel{ display:none; }
.tab-panel.active{ display:block; }

/* keep your existing game/question styles (if already exist, this won't hurt) */

.game-mount{
  border: 2px dashed rgba(52,152,219,0.35);
  border-radius: 12px;
  padding: 14px;
  min-height: 180px;
  background: #fbfdff;
}

/* ===== Mini games UI ===== */
.game-title { font-weight: 900; font-size: 18px; margin-bottom: 8px; }
.game-row { display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin: 10px 0; }
.game-pill { padding: 8px 12px; border-radius: 9999px; border: 1px solid rgba(0,0,0,0.14); background: rgba(255,255,255,0.9); font-weight: 800; }
.game-muted { opacity: .75; }
.game-area { margin-top: 10px; }

.tetris-wrap canvas {
  width: 240px; height: 480px; /* 视觉大小（实际像素由 JS 设定） */
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.12);
  background: #fff;
}

.m3-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  max-width: 360px;
}
.m3-cell {
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.10);
  display:flex; align-items:center; justify-content:center;
  font-weight: 900;
  cursor: pointer;
  user-select: none;
}
.m3-cell.selected { outline: 3px solid rgba(52,152,219,0.6); }

.card24-row {
  display:flex; gap:10px; flex-wrap:wrap; margin: 10px 0;
}
.card24 {
  width: 64px; height: 84px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.12);
  background: rgba(255,255,255,0.95);
  display:flex; align-items:center; justify-content:center;
  font-weight: 900;
  font-size: 20px;
}
.card24 input, .card24 textarea { width: 100%; }

.game-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.15);
}
/* ===== Right cover + close button ===== */
.pill-tabs{
  position: relative;
  display: flex;
  gap: 14px;
  align-items: center;
}

.pill-close{
  margin-left: auto;
  width: 25px;
  height: 25px;
  border-radius: 9999px;
  border: 2px solid rgba(0,0,0,0.14);
  background: rgba(255,255,255,0.85);
  font-weight: 900;
  cursor: pointer;
  display: none; /* 默认隐藏，打开面板时显示 */
  align-items: center; /* centers the ✕ when made visible */
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  color: #2c3e50;
  transition: background 0.18s ease, color 0.18s ease, transform 0.08s ease;
}

.pill-close:hover{
  background: rgba(10, 145, 241, 0.95);
  color: #fff;
  transform: translateY(-1px);
}

.right-cover{
  position: relative;
  height: 100%;                 /* ✅ 撑满 right-card */
  min-height: 100%;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.10);
  background: rgba(255,255,255,0.85);

  display: flex;                /* ✅ 用 flex 居中封面内容 */
  align-items: center;
  justify-content: center;
}


.cover-img{
  max-width: 92%;
  max-height: 88%;
  object-fit: contain;   /* 保证不变形 */
  display: block;
}


/* tab panels 默认隐藏 */
.tab-panel{ display:none; }
.tab-panel.active{ display:block; }
/* =========================
   STEP 3: Right card layout
   让封面/面板吃满右侧高度
========================= */

/* ✅ 只让右侧成为纵向 flex 容器 */
.right-card{
  display: flex;
  flex-direction: column;
}

/* ✅ tabs 不撑高，只占自身高度 */
.pill-tabs{
  flex: 0 0 auto;
}

/* ✅ 封面和面板：占满 tabs 下面剩余空间 */
#rightCover,
.tab-panel{
  flex: 1 1 auto;
  min-height: 0;      /* ✅ 非常关键：允许内部滚动，不把卡片撑爆 */
}

/* ✅ 封面容器：真正吃满可用高度 */
.right-cover{
  height: auto;       /* 覆盖你之前写的 height:100% */
  min-height: 0;      /* 覆盖 min-height:100% */
  width: 100%;
}

/* ✅ 封面图像：填满封面区域（竖图更适合） */
.cover-img{
  width: 100%;
  height: 100%;
  max-width: none;    /* 覆盖 max-width:92% */
  max-height: none;   /* 覆盖 max-height:88% */
  object-fit: contain; /* 不变形；想铺满可改成 cover */
}
