:root{
  --card: rgba(255,255,255,.78);
  --card2: rgba(255,255,255,.62);
  --text: #1b2a3a;
  --muted: rgba(27,42,58,.65);
  --shadow: 0 10px 30px rgba(0,0,0,.12);
  --radius: 18px;

  --orange: #f7b27a;
  --orange2:#f29f60;
  --yellow: #f7e2a3;
  --yellow2:#f3d27a;

  --glass: blur(10px);
}

*{ box-sizing:border-box; }
html,body{ 
  height:100%; 
  max-width: 100vw;
}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color: var(--text);
  overflow-x:hidden;
  position: relative;
}

/* 拖动时锁住页面滚动 */
body.no-scroll{
  overflow: hidden !important;
  touch-action: none !important;
  -webkit-overflow-scrolling: auto;
}

/* Sky + moving clouds */
.sky{
  background: linear-gradient(180deg, #9fd7ff 0%, #cbeeff 55%, #f6fbff 100%);
  position: relative;
}
.cloud-layer{
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .9;
  filter: drop-shadow(0 8px 12px rgba(0,0,0,.08));
}
.cloud-a{ animation: driftA 90s linear infinite; }
.cloud-b{ animation: driftB 140s linear infinite; opacity:.65; }

.cloud-layer::before{
  content:"";
  position:absolute;
  left:-40%;
  top: 10%;
  width: 180%;
  height: 80%;
  background:
    radial-gradient(circle at 10% 15%, rgba(255,255,255,.95) 0 28px, transparent 29px),
    radial-gradient(circle at 14% 18%, rgba(255,255,255,.92) 0 36px, transparent 37px),
    radial-gradient(circle at 18% 15%, rgba(255,255,255,.9) 0 28px, transparent 29px),

    radial-gradient(circle at 35% 28%, rgba(255,255,255,.95) 0 34px, transparent 35px),
    radial-gradient(circle at 40% 25%, rgba(255,255,255,.92) 0 44px, transparent 45px),
    radial-gradient(circle at 45% 28%, rgba(255,255,255,.9) 0 34px, transparent 35px),

    radial-gradient(circle at 65% 20%, rgba(255,255,255,.95) 0 30px, transparent 31px),
    radial-gradient(circle at 70% 17%, rgba(255,255,255,.92) 0 40px, transparent 41px),
    radial-gradient(circle at 75% 20%, rgba(255,255,255,.9) 0 30px, transparent 31px),

    radial-gradient(circle at 20% 55%, rgba(255,255,255,.9) 0 38px, transparent 39px),
    radial-gradient(circle at 26% 58%, rgba(255,255,255,.88) 0 52px, transparent 53px),
    radial-gradient(circle at 34% 55%, rgba(255,255,255,.86) 0 38px, transparent 39px),

    radial-gradient(circle at 55% 62%, rgba(255,255,255,.9) 0 34px, transparent 35px),
    radial-gradient(circle at 60% 60%, rgba(255,255,255,.88) 0 50px, transparent 51px),
    radial-gradient(circle at 67% 62%, rgba(255,255,255,.86) 0 34px, transparent 35px);
  background-repeat:no-repeat;
}

@keyframes driftA{
  0%{ transform: translateX(0); }
  100%{ transform: translateX(18%); }
}
@keyframes driftB{
  0%{ transform: translateX(0); }
  100%{ transform: translateX(-22%); }
}

/* HUD */
.hud{
  position: sticky;
  top: 0;
  z-index: 5;
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap: 10px;
  padding: 12px 12px 8px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: rgba(255,255,255,.25);
  border-bottom: 1px solid rgba(255,255,255,.35);
}
.hud-left{ display:flex; align-items:center; gap:10px; }
.hud-right{ display:flex; align-items:center; gap:10px; }
.hud-item{
  display:flex; align-items:center; gap:8px;
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(27,42,58,.12);
  border-radius: 14px;
  padding: 8px 10px;
}
.icon{ width: 20px; height: 20px; object-fit:contain; }
.hud-text{ font-weight:800; font-size: 14px; }
.hud-meta{ text-align:right; font-size: 12px; color: var(--muted); }
.meta-line b{ color: var(--text); }
.subtle{ opacity:.9; }

.today-earned {
  background: linear-gradient(135deg, rgba(74,222,128,.25) 0%, rgba(34,197,94,.2) 100%);
  border-color: rgba(34,197,94,.35);
}
.today-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
}
.today-points {
  font-weight: 900;
  font-size: 14px;
  color: #16a34a;
}

/* Layout */
.game-wrap{
  padding: 14px 12px 22px;
  display:flex;
  justify-content:center;
  width: 100%;
  max-width: 100vw;
}
.panel{
  width: min(820px, 96vw);
  max-width: 100%;
  background: var(--card2);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,.55);
  padding: 14px;
}
body.dense .panel{ padding: 10px; }
body.hell .panel{ padding: 8px; }

.hero{ text-align:center; padding: 6px 8px 12px; }
.hero-title{ margin: 8px 0 4px; font-size: 20px; }
.hero-sub{ margin:0 0 12px; color: var(--muted); }

/* Buttons */
.btn{
  border:0;
  border-radius: 16px;
  padding: 11px 14px;
  font-weight: 800;
  font-size: 15px;
  cursor:pointer;
  transition: transform .06s ease, filter .15s ease, opacity .15s ease;
  user-select:none;
}
.btn:active{ transform: translateY(1px) scale(.99); }
.btn[disabled]{ opacity:.6; cursor:not-allowed; }

.btn-primary{
  background: linear-gradient(180deg, var(--orange) 0%, var(--orange2) 100%);
  color:#2a1a0f;
  box-shadow: 0 10px 22px rgba(242,159,96,.28);
}
.btn-primary:hover{ filter: brightness(1.02); }

.btn-shop{
  background: linear-gradient(180deg, var(--yellow) 0%, var(--yellow2) 100%);
  color:#3b2a12;
  box-shadow: 0 10px 22px rgba(243,210,122,.25);
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 14px;
  text-decoration: none;
}

.btn-ghost{
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(27,42,58,.12);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 14px;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
}

.btn-big{ padding: 14px 18px; border-radius: 18px; font-size: 16px; }

.status-row{
  display:flex;
  justify-content:center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.pill{
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(27,42,58,.12);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--muted);
}
.pill b{ color: var(--text); }

/* Board */
.board-shell{
  margin-top: 12px;
  display:flex;
  justify-content:center;
  width: 100%;
  max-width: 100%;
}
.board-area{
  position: relative;
  display:flex;
  justify-content:center;
  width: 100%;
  max-width: 100%;
}

.board{
  width: min(98vw, 720px);
  max-width: 720px;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(27,42,58,.12);
  box-shadow: 0 12px 30px rgba(0,0,0,.10);
  overflow:hidden;
  display:grid;
  touch-action: manipulation;
  user-select:none;
  position: relative;
  z-index: 1;
}
body.dense .board{
  width: min(98vw, 780px);
  max-width: 780px;
}
body.hell .board{
  width: min(98vw, 92vh);
  max-width: 980px;
}

.tile{
  background-repeat:no-repeat;
  border: 1px solid rgba(255,255,255,.35);
  transition: transform .06s ease;
}
.tile:active{ transform: scale(.99); }
.tile.selected{
  outline: 3px solid rgba(242,159,96,.75);
  outline-offset: -3px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.45);
}

/* 参考图卡片 - 修复拖动和自适应尺寸 */
.ref-card{
  position: fixed;
  left: 12px;
  top: 120px;
  /* 使用固定宽高，防止拖动时尺寸变化 */
  width: 120px;
  height: auto;
  /* 限制最大最小尺寸 */
  min-width: 90px;
  max-width: 150px;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(27,42,58,.12);
  box-shadow: 0 10px 22px rgba(0,0,0,.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 80;

  /* 关键：禁止所有触摸默认行为 */
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  
  /* 防止文本选择和长按菜单 */
  -webkit-user-drag: none;
  
  /* GPU 加速，拖动更流畅 */
  will-change: left, top;
  transform: translateZ(0);
  
  /* 防止内容撑开容器 */
  box-sizing: border-box;
}

body.hell .ref-card{ 
  width: 140px; 
  max-width: 160px;
}
.ref-card.hidden{ display:none; }

/* 拖动中的样式 */
.ref-card.dragging{
  opacity: .88;
  box-shadow: 0 16px 32px rgba(0,0,0,.18);
  cursor: grabbing;
}

.ref-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 6px;
  padding: 8px 10px;
  cursor: grab;
}

.ref-card.dragging .ref-top{
  cursor: grabbing;
}

.ref-title{
  font-weight: 900;
  font-size: 12px;
  color: rgba(27,42,58,.85);
  pointer-events: none;
}

.ref-open{
  border: 0;
  background: rgba(242,159,96,.18);
  color: rgba(27,42,58,.9);
  font-weight: 900;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.ref-open:active{ transform: translateY(1px); }

.ref-img{
  width: 100%;
  /* 使用固定宽高比确保方形显示 */
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center;
  background: rgba(255,255,255,.65);
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
  user-drag: none;
  /* 确保图片不会撑开容器 */
  max-width: 100%;
  box-sizing: border-box;
}

/* Toast */
.toast{
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  background: rgba(27,42,58,.88);
  color: white;
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 13px;
  opacity: 0;
  pointer-events:none;
  transition: opacity .15s ease;
  z-index: 60;
}
.toast.show{ opacity: 1; }

/* ========================================
   CONFETTI ANIMATION - WIN CELEBRATION
   ======================================== */
.confetti-container{
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  overflow: hidden;
}

.confetti-piece{
  position: absolute;
  width: 10px;
  height: 10px;
  background: #f7b27a;
  top: -10px;
  opacity: 0;
  /* Default duration, overridden by JS for variation */
  animation: confetti-fall 3s ease-out forwards;
}

/* Confetti colors and shapes combined */
.confetti-piece:nth-child(7n+1){ 
  background: #f7b27a; 
}
.confetti-piece:nth-child(7n+2){ 
  background: #f7e2a3; 
  width: 8px; 
  height: 12px; 
  border-radius: 2px;
}
.confetti-piece:nth-child(7n+3){ 
  background: #9fd7ff; 
  width: 6px; 
  height: 6px; 
  border-radius: 50%;
}
.confetti-piece:nth-child(7n+4){ 
  background: #fa8072; 
}
.confetti-piece:nth-child(7n+5){ 
  background: #90ee90; 
  width: 12px; 
  height: 8px; 
  border-radius: 2px;
}
.confetti-piece:nth-child(7n+6){ 
  background: #dda0dd; 
}
.confetti-piece:nth-child(7n){ 
  background: #87ceeb; 
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

@keyframes confetti-fall{
  0%{
    opacity: 1;
    transform: translateY(0) rotate(0deg);
  }
  100%{
    opacity: 0;
    transform: translateY(100vh) rotate(720deg);
  }
}

/* Details history */
.history{
  margin-top: 14px;
  background: rgba(255,255,255,.45);
  border: 1px solid rgba(27,42,58,.10);
  border-radius: 16px;
  overflow:hidden;
}
.history-summary{
  list-style:none;
  cursor:pointer;
  padding: 12px 12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  font-weight: 900;
  user-select:none;
}
.history-summary::-webkit-details-marker{ display:none; }
.history-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width: 34px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(242,159,96,.18);
  border: 1px solid rgba(27,42,58,.10);
  font-size: 12px;
}
.history-inner{
  padding: 10px 10px 12px;
  border-top: 1px solid rgba(27,42,58,.08);
}

.clear-list{
  display:flex;
  flex-direction:column;
  gap: 8px;
}
.clear-item{
  display:flex;
  justify-content:space-between;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,.62);
  border: 1px solid rgba(27,42,58,.10);
  border-radius: 14px;
}
.clear-left{ display:flex; flex-direction:column; gap: 3px; }
.clear-right{
  text-align:right;
  color: var(--muted);
  font-size: 12px;
  display:flex;
  flex-direction:column;
  gap: 3px;
  min-width: 120px;
}
.clear-lv{ font-weight: 900; }
.clear-meta{ color: var(--muted); font-size: 12px; }

.clear-empty{
  color: var(--muted);
  font-size: 13px;
  padding: 10px 12px;
  background: rgba(255,255,255,.55);
  border: 1px dashed rgba(27,42,58,.15);
  border-radius: 14px;
}

.pager{
  margin-top: 10px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
}
.page-indicator{
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

/* Modal：必须盖过 ref-card */
.modal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.25);
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 16px;
  z-index: 200;
}
.modal.hidden{ display:none; }
.modal-card{
  width: min(420px, 94vw);
  background: rgba(255,255,255,.88);
  border-radius: 18px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,.6);
  padding: 16px;
}
.modal-card-wide{ width: min(760px, 96vw); }
.modal-title{ font-weight: 900; font-size: 18px; margin-bottom: 6px; }
.modal-body{ color: var(--muted); margin-bottom: 12px; }
.modal-img{
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  background: rgba(255,255,255,.65);
  border-radius: 14px;
  border: 1px solid rgba(27,42,58,.10);
}

/* ========================================
   RESPONSIVE DESIGN - MOBILE FIRST
   ======================================== */

/* Very small mobile screens (320px - 480px) */
@media (max-width: 480px){
  /* HUD improvements */
  .hud{ 
    align-items:flex-start; 
    flex-direction:column;
    padding: 10px 8px 6px;
    gap: 8px;
  }
  
  .hud-left{ 
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
  }
  
  .hud-right{ 
    width:100%; 
    flex-wrap: wrap;
    justify-content:space-between;
    gap: 6px;
  }
  
  .hud-meta{ 
    text-align:left;
    font-size: 11px;
    width: 100%;
    order: -1;
  }
  
  .hud-item{
    padding: 6px 8px;
    border-radius: 12px;
  }
  
  .icon{ width: 18px; height: 18px; }
  .hud-text{ font-size: 13px; }
  
  .today-earned {
    padding: 6px 8px;
  }
  
  .today-label {
    font-size: 10px;
  }
  
  .today-points {
    font-size: 13px;
  }
  
  /* Buttons in HUD */
  .btn-shop, .btn-ghost {
    padding: 7px 10px;
    font-size: 13px;
    border-radius: 12px;
  }
  
  /* Game wrap and panel */
  .game-wrap{
    padding: 10px 6px 16px;
  }
  
  .panel{
    width: 100%;
    padding: 10px;
    border-radius: 14px;
  }
  
  /* Hero section */
  .hero{ 
    padding: 4px 6px 10px;
  }
  
  .hero-title{ 
    font-size: 18px;
    margin: 6px 0 3px;
  }
  
  .hero-sub{ 
    font-size: 13px;
    margin: 0 0 10px;
  }
  
  .btn-big{ 
    padding: 12px 16px; 
    font-size: 15px;
    border-radius: 16px;
  }
  
  .status-row{
    gap: 6px;
    margin-top: 8px;
  }
  
  .pill{
    padding: 6px 10px;
    font-size: 12px;
  }
  
  /* Board area */
  .board-shell{
    margin-top: 10px;
  }
  
  .board{
    width: min(96vw, 100%);
    border-radius: 14px;
  }
  
  /* Reference card for mobile - 固定尺寸防止拖动时变形 */
.ref-card{ 
  /* 移动端使用固定宽度 */
  width: 100px;
  min-width: 80px;
  max-width: 120px;
  left: 8px;
  border-radius: 12px;
}

  
  body.hell .ref-card{ 
    width: 110px; 
    min-width: 90px;
    max-width: 130px;
  }
  
  .ref-img{ 
    /* 确保图片尺寸稳定 */
    width: 100%;
    aspect-ratio: 1 / 1;
  }
  
  .ref-top{
    padding: 6px 8px;
  }
  
  .ref-title{
    font-size: 11px;
  }
  
  .ref-open{
    font-size: 11px;
    padding: 5px 8px;
  }
  
  /* History section */
  .history{
    margin-top: 10px;
    border-radius: 14px;
  }
  
  .history-summary{
    padding: 10px;
    font-size: 14px;
  }
  
  .history-badge{
    min-width: 30px;
    padding: 4px 8px;
    font-size: 11px;
  }
  
  .history-inner{
    padding: 8px;
  }
  
  .clear-item{
    padding: 8px 10px;
    gap: 8px;
    border-radius: 12px;
  }
  
  .clear-right{
    font-size: 11px;
    min-width: 100px;
  }
  
  .clear-meta{
    font-size: 11px;
  }
  
  /* Modal improvements */
  .modal{
    padding: 12px;
  }
  
  .modal-card{
    width: min(360px, 94vw);
    padding: 14px;
    border-radius: 16px;
  }
  
  .modal-card-wide{ 
    width: min(94vw, 100%);
  }
  
  .modal-title{ 
    font-size: 16px;
    margin-bottom: 5px;
  }
  
  .modal-body{ 
    font-size: 13px;
    margin-bottom: 10px;
  }
  
  .modal-img{
    max-height: 60vh;
    border-radius: 12px;
  }
  
  /* Toast */
  .toast{
    bottom: 18px;
    font-size: 12px;
    padding: 8px 12px;
  }
}

/* Small tablets and large phones (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px){
  .hud{
    padding: 10px;
    gap: 8px;
  }
  
  .hud-left, .hud-right{
    flex-wrap: wrap;
  }
  
  .panel{
    width: min(740px, 96vw);
  }
  
  .board{
    width: min(96vw, 680px);
  }
  
  .ref-card{
    /* 平板端固定尺寸 */
    width: 110px;
    min-width: 90px;
    max-width: 130px;
    top: 110px;
  }
}

/* Landscape orientation for mobile devices */
@media (max-height: 600px) and (orientation: landscape){
  .hud{
    padding: 6px 8px 4px;
  }
  
  .hud-item{
    padding: 5px 8px;
  }
  
  .hero{
    padding: 3px 6px 8px;
  }
  
  .hero-title{
    font-size: 16px;
    margin: 4px 0 2px;
  }
  
  .hero-sub{
    font-size: 12px;
    margin: 0 0 8px;
  }
  
  .btn-big{
    padding: 10px 14px;
    font-size: 14px;
  }
  
  .board{
    width: min(90vw, 55vh);
    max-width: none;
  }
  
  .ref-card{
    /* 横屏模式固定尺寸 */
    width: 90px;
    min-width: 70px;
    max-width: 110px;
    left: 8px;
    top: 70px;
  }
  
  .ref-img{
    /* 确保图片尺寸稳定 */
    width: 100%;
    aspect-ratio: 1 / 1;
  }
  
  .modal-img{
    max-height: 70vh;
  }
}

/* Extra small devices (max-width: 360px) */
@media (max-width: 360px){
  .hud-item{
    padding: 5px 7px;
  }
  
  .icon{ width: 16px; height: 16px; }
  .hud-text{ font-size: 12px; }
  
  .btn-shop, .btn-ghost {
    padding: 6px 8px;
    font-size: 12px;
  }
  
  .hero-title{
    font-size: 16px;
  }
  
  .hero-sub{
    font-size: 12px;
  }
  
  .btn-big{
    padding: 10px 14px;
    font-size: 14px;
  }
  
  .ref-card{
    /* 超小屏幕固定尺寸 */
    width: 80px;
    min-width: 70px;
    max-width: 100px;
  }
  
  .ref-img{
    /* 确保图片尺寸稳定 */
    width: 100%;
    aspect-ratio: 1 / 1;
  }
  
  /* Smaller confetti on very small screens */
  .confetti-piece{
    width: 7px;
    height: 7px;
  }
  
  .confetti-piece:nth-child(7n+2){ 
    width: 6px; 
    height: 9px;
  }
  .confetti-piece:nth-child(7n+3){ 
    width: 5px; 
    height: 5px;
  }
  .confetti-piece:nth-child(7n+5){ 
    width: 9px; 
    height: 6px;
  }
  .confetti-piece:nth-child(7n){ 
    width: 6px;
    height: 6px;
  }
}

/* ========================================
   LOGIN PAGE - MODERN UI STYLES
   ======================================== */

/* Login page specific body styles */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Improved cloud layers for desktop */
.login-page .cloud-layer {
  overflow: hidden;
}

.login-page .cloud-layer::before {
  width: 200%;
  height: 100%;
  left: -50%;
  top: 0;
  background-size: 100% 100%;
  background:
    /* Top row - smaller clouds */
    radial-gradient(ellipse 120px 80px at 8% 12%, rgba(255,255,255,.95), transparent 70%),
    radial-gradient(ellipse 160px 100px at 15% 15%, rgba(255,255,255,.9), transparent 70%),
    radial-gradient(ellipse 100px 70px at 22% 10%, rgba(255,255,255,.85), transparent 70%),
    
    radial-gradient(ellipse 140px 90px at 38% 18%, rgba(255,255,255,.95), transparent 70%),
    radial-gradient(ellipse 180px 120px at 45% 22%, rgba(255,255,255,.9), transparent 70%),
    radial-gradient(ellipse 120px 80px at 52% 16%, rgba(255,255,255,.85), transparent 70%),
    
    radial-gradient(ellipse 130px 85px at 68% 14%, rgba(255,255,255,.95), transparent 70%),
    radial-gradient(ellipse 170px 110px at 75% 18%, rgba(255,255,255,.9), transparent 70%),
    radial-gradient(ellipse 110px 75px at 82% 12%, rgba(255,255,255,.85), transparent 70%),
    
    /* Middle row - medium clouds */
    radial-gradient(ellipse 150px 100px at 5% 45%, rgba(255,255,255,.9), transparent 70%),
    radial-gradient(ellipse 200px 130px at 12% 48%, rgba(255,255,255,.85), transparent 70%),
    radial-gradient(ellipse 140px 90px at 20% 42%, rgba(255,255,255,.8), transparent 70%),
    
    radial-gradient(ellipse 160px 105px at 55% 50%, rgba(255,255,255,.9), transparent 70%),
    radial-gradient(ellipse 210px 140px at 62% 54%, rgba(255,255,255,.85), transparent 70%),
    radial-gradient(ellipse 150px 95px at 70% 48%, rgba(255,255,255,.8), transparent 70%),
    
    /* Bottom row - larger clouds */
    radial-gradient(ellipse 180px 120px at 25% 78%, rgba(255,255,255,.88), transparent 70%),
    radial-gradient(ellipse 240px 160px at 35% 82%, rgba(255,255,255,.82), transparent 70%),
    radial-gradient(ellipse 160px 100px at 45% 76%, rgba(255,255,255,.78), transparent 70%),
    
    radial-gradient(ellipse 170px 115px at 75% 80%, rgba(255,255,255,.88), transparent 70%),
    radial-gradient(ellipse 220px 150px at 85% 84%, rgba(255,255,255,.82), transparent 70%),
    radial-gradient(ellipse 140px 95px at 95% 78%, rgba(255,255,255,.78), transparent 70%);
  background-repeat: no-repeat;
}

.login-page .cloud-a::before {
  animation: driftA 120s linear infinite;
}

.login-page .cloud-b::before {
  animation: driftB 180s linear infinite;
}

/* Center container for login */
.login-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  z-index: 2;
}

/* Login card - glassmorphism style */
.login-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 28px;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.12),
    0 8px 25px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.6);
  padding: 40px 36px;
  animation: cardFloat 0.6s ease-out;
}

@keyframes cardFloat {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Brand section */
.login-brand {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  margin-bottom: 16px;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.login-title {
  margin: 0;
  font-size: 32px;
  font-weight: 900;
  background: linear-gradient(135deg, #1b2a3a 0%, #3a5a7c 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.login-tagline {
  margin: 8px 0 0;
  font-size: 15px;
  color: var(--muted);
  font-weight: 500;
}

/* Form styles */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.form-icon {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.form-input {
  padding: 14px 18px;
  font-size: 16px;
  font-family: inherit;
  border: 2px solid rgba(27, 42, 58, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  transition: all 0.2s ease;
  outline: none;
}

.form-input::placeholder {
  color: rgba(27, 42, 58, 0.4);
}

.form-input:hover {
  border-color: rgba(27, 42, 58, 0.2);
  background: rgba(255, 255, 255, 0.9);
}

.form-input:focus {
  border-color: var(--orange);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(247, 178, 122, 0.2);
}

/* Login button */
.btn-login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 24px;
  font-size: 17px;
  border-radius: 16px;
  margin-top: 8px;
  position: relative;
  overflow: hidden;
}

.btn-login::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, transparent 50%);
  pointer-events: none;
}

.btn-arrow {
  width: 20px;
  height: 20px;
  transition: transform 0.2s ease;
}

.btn-login:hover .btn-arrow {
  transform: translateX(4px);
}

.btn-login.loading {
  pointer-events: none;
}

.btn-login.loading span {
  opacity: 0.6;
}

.btn-login.loading .btn-arrow {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Error message */
.login-error {
  text-align: center;
  color: #d94a4a;
  font-size: 14px;
  font-weight: 600;
  min-height: 20px;
  padding: 0 8px;
}

.login-error:not(:empty) {
  padding: 12px 16px;
  background: rgba(217, 74, 74, 0.1);
  border-radius: 12px;
  border: 1px solid rgba(217, 74, 74, 0.2);
}

/* Footer hint */
.login-footer {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(27, 42, 58, 0.08);
}

.login-hint {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.hint-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
  color: rgba(27, 42, 58, 0.45);
}

/* Responsive for login page */
@media (max-width: 480px) {
  .login-card {
    padding: 32px 24px;
    border-radius: 24px;
  }
  
  .login-title {
    font-size: 28px;
  }
  
  .login-logo {
    width: 60px;
    height: 60px;
  }
}

@media (min-width: 1024px) {
  .login-page .cloud-layer::before {
    width: 250%;
    left: -75%;
  }
}

@media (min-width: 1440px) {
  .login-page .cloud-layer::before {
    width: 300%;
    left: -100%;
  }
}
