/* 
  EpiPen Sequence Training — vibe-coded module
  Edit colors and spacing here.
*/

:root{
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface2:#fbfbff;
  --ink:#1b1e28;
  --muted:#6b7184;

  --border:#e4e6f2;
  --shadow: 0 10px 24px rgba(20,22,33,.08);
  --radius: 16px;

  --primary:#7c6cff;   /* soft purple */
  --primary2:#b7b0ff;
  --good:#2e8b57;
  --bad:#c43c3c;
  --warn:#ffeab8;
  --goodBg:#e7f6ee;
  --badBg:#fdecec;

  --gap: 16px;
  --pad: 18px;
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

*{ box-sizing:border-box; }
html,body{ height:100%; margin: 0; padding: 0; }
body{
  margin:0;
  font-family: var(--font);
  color:var(--ink);
  background: radial-gradient(1200px 600px at 15% 0%, #ebeaff 0%, rgba(235,234,255,0) 60%),
              radial-gradient(1200px 600px at 85% 0%, #e9fbff 0%, rgba(233,251,255,0) 60%),
              var(--bg);
}

.app{
  min-height:100vh;
  display:flex;
  flex-direction:column;
  width: 100%;
}

.topbar{
  padding: 18px 22px 10px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.65);
  backdrop-filter: blur(10px);
  position: sticky;
  top:0;
  z-index: 5;
}

.brand{
  display:flex;
  flex-direction:column;
  gap:4px;
}
.brand__title{
  font-weight: 800;
  letter-spacing: .2px;
  font-size: 20px;
}
.brand__subtitle{
  color: var(--muted);
  font-size: 13px;
}

.topbar__right{
  position:absolute;
  right: 22px;
  top: 18px;
  display:flex;
  align-items:center;
  gap:10px;
}

.badge{
  padding: 7px 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary2), #d1ccff);
  color: #241f50;
  font-weight: 700;
  font-size: 12px;
  border: 1px solid rgba(124,108,255,.25);
}

.progress{
  margin-top: 12px;
  display:flex;
  align-items:center;
  gap: 12px;
}
.progress__track{
  flex: 1;
  height: 10px;
  background: #eef0fb;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow:hidden;
}
.progress__fill{
  height:100%;
  background: linear-gradient(90deg, var(--primary), #9be7ff);
  border-radius: 999px;
  width:0%;
  transition: width .25s ease;
}
.progress__meta{
  min-width: 120px;
  text-align:right;
  color: var(--muted);
  font-size: 12px;
}

.content{
  padding: 32px 22px;
  flex:1;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.panel{
  display:grid;
  grid-template-columns: 1fr 340px;
  gap: var(--gap);
  align-items:start;
}

.panel__main{
  display:flex;
  flex-direction:column;
  gap: var(--gap);
}

.panel__side{
  display:flex;
  flex-direction:column;
  gap: var(--gap);
}

.card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--pad);
}

.card--main{
  min-height: auto;
}

.card__title{
  font-size: 28px;
  font-weight: 800;
  margin:0 0 8px;
  line-height: 1.3;
}

.card__subtitle{
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.grid2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.pill{
  display:inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f2f3ff;
  border: 1px solid rgba(124,108,255,.25);
  color: #2a275d;
  font-weight: 700;
  font-size: 12px;
}

.kv{
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.kv h4{
  margin:0 0 12px;
  font-size: 15px;
  font-weight: 700;
}
.kv ul{ margin:0; padding-left: 20px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.kv li{ margin: 4px 0; }
.kv p{ margin:0; color: var(--muted); font-size: 14px; }

.hr{
  height:1px;
  background: var(--border);
  margin: 20px 0;
}

.diagram{
  background: linear-gradient(180deg, #f5f6ff, #ffffff);
  border: 1px dashed rgba(124,108,255,.35);
  border-radius: 14px;
  padding: 20px;
  color: #4a4680;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.diagram strong {
  font-size: 15px;
}

.video-container {
  background: #000;
  border: 1px solid rgba(124,108,255,.25);
  padding: 0;
  min-height: 0;
  display: block;
  overflow: hidden;
  border-radius: 12px;
  aspect-ratio: 16 / 9;
}

.video-container iframe {
  width: 100% !important;
  height: 100% !important;
  border: none;
}

.video-container video {
  width: 100% !important;
  height: 100% !important;
  border: none;
  display: block;
}

.actions{
  display:flex;
  flex-wrap:wrap;
  gap: 12px;
  align-items:center;
}

button{
  font-family: inherit;
  border:0;
  cursor:pointer;
}

.btn{
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 800;
  border: 1px solid transparent;
  transition: transform .04s ease, background .2s ease, border-color .2s ease;
  font-size: 14px;
}
.btn:active{ transform: translateY(1px); }

.primary{
  background: var(--primary);
  color:white;
}
.primary:hover{ background: #6c5bff; }

.secondary{
  background: #f2f3ff;
  color:#2a275d;
  border-color: rgba(124,108,255,.25);
}
.secondary:hover{ background: #eceeff; }

.ghost{
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 12px;
  font-weight: 700;
}
.ghost:hover{ background:#ffffff; }

.muted{ color: var(--muted); font-size: 13px; }

.notice{
  border-radius: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  background: var(--surface2);
  display:flex;
  gap: 12px;
  align-items:flex-start;
}
.notice.good{
  background: var(--goodBg);
  border-color: rgba(46,139,87,.25);
}
.notice.bad{
  background: var(--badBg);
  border-color: rgba(196,60,60,.25);
}
.notice__title{
  font-weight: 900;
  font-size: 15px;
}
.notice__text{
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.quiz{
  display:flex;
  flex-direction:column;
  gap: 10px;
}
.option{
  display:flex;
  gap:10px;
  align-items:flex-start;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}
.option:hover{
  border-color: rgba(124,108,255,.35);
}
.option input{ margin-top: 3px; }
.option.correct{
  background: var(--goodBg);
  border-color: rgba(46,139,87,.25);
}
.option.wrong{
  background: var(--badBg);
  border-color: rgba(196,60,60,.25);
}

.sidecard__title{
  font-weight: 900;
  margin:0 0 10px;
  font-size: 14px;
}
.sidecard__text{
  margin:0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.sidecard__list{
  margin:0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
.sidecard__list li {
  margin: 4px 0;
}
.yellow{
  background: #fff8dd;
  border: 1px solid rgba(255, 199, 0, .25);
}

.ordering{
  display:flex;
  flex-direction:column;
  gap: 10px;
}
.orderItem{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: white;
}
.handle{
  width: 12px;
  height: 18px;
  border-radius: 6px;
  background: #e7e9fb;
  border: 1px solid var(--border);
}
.orderText{
  flex: 1;
  font-weight: 700;
  font-size: 14px;
}
.orderBtns{
  display:flex;
  gap: 6px;
}
.small{
  padding: 7px 9px;
  border-radius: 10px;
  font-weight: 800;
  background: #f2f3ff;
  border: 1px solid rgba(124,108,255,.25);
  color:#2a275d;
  font-size: 12px;
}
.small:hover{ background:#eceeff; }

.footer{
  padding: 16px 22px;
  display:flex;
  justify-content:space-between;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,.55);
  backdrop-filter: blur(10px);
  font-size: 13px;
}

@media (max-width: 1024px){
  .content {
    padding: 24px 18px;
  }
  .panel{ grid-template-columns: 1fr; }
  .topbar__right{ position: static; margin-top: 10px; justify-content:flex-end; }
  .progress__meta{ min-width:auto; }
  .card__title{ font-size: 24px; }
  .card__subtitle{ font-size: 15px; }
  .video-container {
    aspect-ratio: 16 / 9;
  }
}

@media (max-width: 640px){
  .content {
    padding: 16px 12px;
  }
  .brand__title{ font-size: 16px; }
  .card__title{ font-size: 20px; }
  .card__subtitle{ font-size: 14px; }
  .grid2{ grid-template-columns: 1fr; }
  .btn{ padding: 10px 16px; font-size: 13px; }
  .video-container {
    aspect-ratio: 16 / 9;
    min-height: 200px;
  }
}

/* === Animations & Motion === */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

@keyframes checkmark {
  0% {
    transform: scale(0) rotate(-45deg);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes progressFill {
  from {
    width: 0;
  }
}

/* 主卡片动画 */
#mainCard {
  animation: fadeIn 0.35s ease-out;
}

/* 侧卡片动画 */
#sideCard1 {
  animation: slideInLeft 0.4s ease-out;
}

#sideCard2 {
  animation: slideInLeft 0.45s ease-out;
}

/* 按钮动画 */
.btn {
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease-out;
  transform: translateZ(0);
}

.btn:active {
  transform: scale(0.96);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(124, 108, 255, 0.2);
}

.btn.primary:active {
  background: #6a5ae6;
}

/* 按钮涟漪效果 */
.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.btn:active::after {
  animation: ripple 0.6s ease-out;
}

@keyframes ripple {
  to {
    width: 300px;
    height: 300px;
    opacity: 0;
  }
}

/* 进度条动画 */
#progressFill {
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  animation: progressFill 0.8s ease-out;
}

/* 通知框动画 */
.notice {
  animation: slideInLeft 0.35s ease-out;
}

.notice.good {
  animation: slideInLeft 0.35s ease-out;
}

.notice.bad {
  animation: bounce 0.6s ease-out;
}

/* 选项框动画 */
.option {
  transition: all 0.2s ease-out;
  animation: fadeIn 0.3s ease-out;
}

.option:hover {
  background: rgba(124, 108, 255, 0.04);
  transform: translateX(4px);
}

/* 排序项动画 */
.orderItem {
  animation: fadeIn 0.25s ease-out;
  transition: all 0.2s ease-out;
}

.orderItem:hover {
  background: rgba(124, 108, 255, 0.08);
  transform: translateX(4px);
}

/* 药丸标签动画 */
.pill {
  animation: slideInLeft 0.3s ease-out;
}

/* 图表/图像淡入 */
.diagram img {
  animation: fadeIn 0.4s ease-out;
}

/* 视频容器动画 */
.video-container {
  animation: fadeIn 0.5s ease-out;
}

/* 成功状态动画 */
.option.correct::before {
  content: '✓';
  animation: checkmark 0.5s ease-out;
}

/* 页面过渡 */
.card {
  animation: fadeIn 0.35s ease-out;
}
