/* 放很前面 */
*, *::before, *::after {
  box-sizing: border-box;
}

/* 如果懶得全局也可以只改 input */
.input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(5,5,20,0.6);
  color: var(--text-main);
  outline: none;
  font-size: 14px;
  transition: var(--transition);
  box-sizing: border-box;   /* 這行是關鍵 */
}

/* ===== ASTRAIL BASE ===== */
:root {
  --bg-main: #0b0b12;
  --bg-card: rgba(255,255,255,0.06);
  --bg-glass: rgba(255,255,255,0.09);
  --border-glass: rgba(255,255,255,0.22);
  --primary: #6f5bff;
  --primary-hover: #8a7bff;
  --text-main: #ffffff;
  --text-secondary: #cccccc;
  --radius: 16px;
  --transition-fast: 0.15s ease-out;
  --transition: 0.2s ease;
  --shadow-glow-soft: 0 0 18px rgba(143,120,255,0.25);
  --shadow-glow-strong: 0 0 28px rgba(143,120,255,0.55);
}

/* ===== GLOBAL ===== */
html,
body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', 'Noto Sans TC', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-main);
  color: var(--text-main);
  overflow-x: hidden;
}

/* ===== LAYOUT HELPERS ===== */
.page-wrap {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 32px 16px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ===== STARFIELD (淡星空 + 流星) ===== */
.starry-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(ellipse at 50% 15%, rgba(120,110,255,0.18), transparent 55%),
    radial-gradient(ellipse at 80% 80%, rgba(100,150,255,0.13), transparent 45%),
    #0b0b12;
  overflow: hidden;
}

/* 靜態小星星 */
.star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: rgba(255,255,255,0.85);
  border-radius: 50%;
  opacity: 0;
  animation: twinkle 3s infinite ease-in-out;
}

@keyframes twinkle {
  0%, 100% {
    opacity: 0;
    transform: scale(0.6);
  }
  50% {
    opacity: 0.7;
    transform: scale(1);
  }
}

/* 流星 */
.meteor {
  position: absolute;
  width: 120px;
  height: 2px;
  background: linear-gradient(90deg, rgba(255,255,255,0.9), rgba(255,255,255,0));
  opacity: 0;
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.8));
  transform-origin: left center;
  pointer-events: none;
}

.meteor.meteor-run {
  animation: meteor 1.4s linear forwards;
}

@keyframes meteor {
  0% {
    opacity: 0;
    transform: translate3d(-10%, -10%, 0) rotate(12deg) scaleX(0.2);
  }
  10% {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(12deg) scaleX(1);
  }
  100% {
    opacity: 0;
    transform: translate3d(220%, 180%, 0) rotate(12deg) scaleX(0.9);
  }
}

/* ===== GLASS CARD ===== */
.card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: var(--radius);
  padding: 24px 22px;
  box-shadow: var(--shadow-glow-soft);
  margin: 20px auto;
  max-width: 900px;
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    border-color var(--transition-fast),
    background-color var(--transition-fast);
}

/* 卡片浮起效果 */
.card-hover {
  cursor: default;
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow-strong);
  border-color: rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.12);
}

/* ===== TITLES ===== */
.title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 18px;
  color: #ffffff;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(140,120,255,0.4);
}

.subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  opacity: 0.9;
  margin-bottom: 12px;
}

/* ===== INPUTS ===== */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.label {
  font-size: 13px;
  color: #e4e4ff;
  opacity: 0.9;
}

.input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(5,5,20,0.6);
  color: var(--text-main);
  outline: none;
  font-size: 14px;
  transition: var(--transition);
}

.input::placeholder {
  color: rgba(220,220,255,0.4);
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 8px rgba(111,91,255,0.8);
  background: rgba(10,10,28,0.9);
}

/* 密碼欄右邊顯示切換 */
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrap .input {
  padding-right: 40px;
}

.toggle-password {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: rgba(230,230,255,0.8);
  cursor: pointer;
  user-select: none;
  padding: 4px 6px;
  border-radius: 999px;
  transition: var(--transition-fast);
}

.toggle-password:hover {
  background: rgba(255,255,255,0.12);
}

/* ===== BUTTONS ===== */
.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.btn {
  padding: 11px 18px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition:
    background-color var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    border-color var(--transition-fast),
    opacity var(--transition-fast);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* 主按鈕 */
.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(111,91,255,0.65);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 0 16px rgba(138,123,255,0.85);
}

/* 按下去的壓下感 */
.btn-primary:active,
.btn-secondary:active {
  transform: translateY(1px) scale(0.97);
  box-shadow: 0 0 6px rgba(0,0,0,0.6);
}

/* 次要按鈕 */
.btn-secondary {
  background: rgba(255,255,255,0.1);
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.22);
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.16);
  transform: translateY(-1px) scale(1.02);
}

/* 禁用狀態 */
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* ===== BADGES ===== */
.badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.badge-draft { background:#4a8bff33; color:#9ab8ff; }
.badge-final { background:#6f5bff33; color:#c2b8ff; }
.badge-wait { background:#ffaa0033; color:#ffd899; }
.badge-done { background:#4cff8033; color:#b3ffd6; }
.badge-cancel { background:#ff4a6b33; color:#ffb5c5; }

/* ===== SIMPLE TABLE / LIST ===== */
.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-item {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(12,12,30,0.7);
  border: 1px solid rgba(255,255,255,0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

/* ===== IMAGE PREVIEW ===== */
.image-frame {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: radial-gradient(circle at 0 0, rgba(255,255,255,0.1), transparent 55%);
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: 0 0 18px rgba(10,10,30,0.9);
  max-height: 360px;
}

.image-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: transform 0.25s ease-out;
}

.image-frame:hover img {
  transform: scale(1.03);
}

/* ===== SMALL TEXT ===== */
.text-danger {
  color: #ff7a9d;
  font-size: 12px;
}

.text-muted {
  color: var(--text-secondary);
  opacity: 0.85;
  font-size: 12px;
}
