/* styles.css — 無界聯盟 League of Dreamers CI · Light 亮色主題 */
:root {
  /* 無界四色系統 */
  --ink: #2D2926;        /* 質感黑：文字 / 邊框（40%） */
  --sand: #EDE0C4;       /* 米色：主底（30%） */
  --mandarin: #E05A1A;   /* 朱橘：強調（20%） */
  --white: #FFFFFF;      /* 白：留白（10%） */

  /* 語意對應 */
  --brand-color: var(--ink);      /* 主文字 / 邊框 */
  --accent: var(--mandarin);      /* 行動強調 */
  --bg-light: #FFFFFF;
  --bg-sand: #EDE0C4;
}

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

body {
  font-family: 'Noto Sans TC', 'PingFang TC', sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-sand) 100%);
  color: var(--brand-color);
  position: relative;
  overflow: hidden;
  transition: background 2s ease;
}

/* 音樂播放時的背景變化 */
body.music-playing {
  background: linear-gradient(135deg, var(--white) 0%, #F6EFDD 50%, var(--sand) 100%);
}

body.music-playing .mountain {
  animation: wave 20s ease-in-out infinite alternate;
}

body.music-playing .sun {
  animation: float 8s ease-in-out infinite;
}

body.music-playing .small-sun {
  animation: float 10s ease-in-out infinite reverse;
}

/* 聲音波形動畫 */
.sound-waves {
  width: 100%;
  height: 40px;
  margin: 1rem 0;
  position: relative;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s ease;
  overflow: hidden;
}

body.music-playing .sound-waves {
  opacity: 0.5;
}

.wave-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  width: 100%;
}

.wave {
  flex: 1;
  height: 2px;
  background-color: var(--accent);
  margin: 0 0.5px;
  border-radius: 1px;
  animation: sound-wave-horizontal 1.5s infinite ease-in-out;
  max-width: 3px;
}

.wave:nth-child(odd) { animation-delay: 0.2s; }
.wave:nth-child(even) { animation-delay: 0.6s; }
.wave:nth-child(3n) { animation-delay: 0.9s; }
.wave:nth-child(3n+1) { animation-delay: 0.3s; }
.wave:nth-child(5n) { animation-delay: 0.7s; }

@keyframes sound-wave-horizontal {
  0%, 100% { height: 2px; }
  50% { height: 20px; }
}

@media (max-width: 768px) {
  .sound-waves { height: 30px; }
  @keyframes sound-wave-horizontal {
    0%, 100% { height: 2px; }
    50% { height: 15px; }
  }
}

@media (max-width: 480px) {
  .sound-waves { height: 20px; }
  @keyframes sound-wave-horizontal {
    0%, 100% { height: 1px; }
    50% { height: 10px; }
  }
}

.container {
  text-align: center;
  z-index: 10;
  padding: 2.5rem 2rem;
  position: relative;
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(45, 41, 38, 0.06);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(45, 41, 38, 0.08);
  animation: fadeIn 1s ease-out;
  transform-style: preserve-3d;
  perspective: 1000px;
  max-width: 90%;
  width: 600px;
}

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

.mode-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 1rem;
  position: absolute;
  top: -3.5rem;
  left: 0;
  right: 0;
  text-align: center;
  text-shadow: 0 2px 4px rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  padding: 0 1rem;
}

.brand-slogan {
  font-size: 1.05rem;
  color: var(--accent);
  opacity: 0.95;
  margin-top: 0.25rem;
  margin-bottom: 1rem;
  font-weight: 500;
  letter-spacing: 3px;
}

.timer {
  font-size: 10rem;
  font-weight: 700;
  color: var(--ink);
  margin: 1rem 0;
  text-shadow: 2px 2px 4px rgba(45, 41, 38, 0.08);
  transition: all 0.3s ease;
  transform: translateZ(30px);
  animation: pulse 1.5s infinite alternate ease-in-out;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 768px) {
  .timer { font-size: 8rem; }
  .mode-title { font-size: 1.5rem; top: -3rem; }
}

@media (max-width: 480px) {
  .timer { font-size: 6rem; }
  .mode-title { font-size: 1.2rem; top: -2.5rem; }
}

@keyframes pulse {
  from { transform: translateZ(30px) scale(1); }
  to { transform: translateZ(30px) scale(1.03); }
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 2rem;
  perspective: 1000px;
}

.btn {
  border: none;
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  font-family: 'Noto Sans TC', 'PingFang TC', sans-serif;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
  z-index: 1;
  font-size: 1.1rem;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(255, 255, 255, 0.12);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: -1;
}

.btn:hover::before { transform: translateX(0); }
.btn:active { transform: translateY(2px); }

/* 主強調按鈕：朱橘底白字 */
.btn-preset {
  background-color: var(--accent);
  color: var(--white);
  transform: translateZ(5px);
}

.btn-preset:hover {
  background-color: var(--ink);
  color: var(--white);
  transform: translateZ(10px) scale(1.05);
  box-shadow: 0 4px 8px rgba(45, 41, 38, 0.15);
}

/* 次要按鈕：白底黑字黑邊 */
.btn-adjust {
  background-color: var(--white);
  color: var(--ink);
  border: 1px solid var(--ink);
  transform: translateZ(5px);
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
  border-radius: 0.3rem;
}

.btn-adjust:hover {
  background-color: var(--sand);
  color: var(--ink);
  transform: translateZ(10px) scale(1.05);
  box-shadow: 0 4px 8px rgba(45, 41, 38, 0.12);
}

.action-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  perspective: 1000px;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.btn-action {
  padding: 0.75rem 2rem;
  font-size: 1.25rem;
  transform: translateZ(15px);
}

.btn-start {
  background-color: var(--accent);
  color: var(--white);
}

.btn-start:hover {
  background-color: var(--ink);
  color: var(--white);
  transform: translateZ(20px) scale(1.05);
  box-shadow: 0 4px 12px rgba(45, 41, 38, 0.2);
}

.btn-reset {
  background-color: var(--white);
  color: var(--ink);
  border: 1px solid var(--ink);
}

.btn-reset:hover {
  background-color: var(--sand);
  color: var(--ink);
  transform: translateZ(20px) scale(1.05);
  box-shadow: 0 4px 12px rgba(45, 41, 38, 0.15);
}

.btn-music {
  background-color: var(--white);
  color: var(--accent);
  border: 2px solid var(--accent);
}

.btn-music:hover {
  background-color: var(--sand);
  color: var(--ink);
  transform: translateZ(20px) scale(1.05);
  box-shadow: 0 4px 12px rgba(45, 41, 38, 0.15);
}

.btn-music.playing {
  background-color: var(--accent);
  color: var(--white);
}

.mode-buttons {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.btn-mode {
  background-color: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  border: 1px solid var(--ink);
  transform: translateZ(5px);
  padding: 0.5rem 1rem;
}

.btn-mode.active {
  background-color: var(--accent);
  color: var(--white);
  border-color: var(--accent);
}

.btn-mode:hover {
  background-color: var(--sand);
  color: var(--ink);
  transform: translateZ(10px) scale(1.05);
}

.btn-mode.active:hover {
  background-color: var(--ink);
  color: var(--white);
}

.background {
  position: absolute;
  bottom: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 1;
  overflow: hidden;
}

.mountain {
  fill: var(--ink);
  fill-opacity: 0.07;
  animation: wave 15s ease-in-out infinite alternate;
  width: 100%;
  position: absolute;
  bottom: 0;
}

@keyframes wave {
  0% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  100% { transform: translateX(-5px); }
}

.sun {
  fill: var(--mandarin);
  fill-opacity: 0.7;
  animation: float 6s ease-in-out infinite;
  transform-origin: center;
  transform-box: fill-box;
}

.small-sun {
  fill: var(--mandarin);
  fill-opacity: 0.45;
  animation: float 8s ease-in-out infinite reverse;
  transform-origin: center;
  transform-box: fill-box;
}

@media (max-width: 768px) {
  .sun { r: 30; }
  .small-sun { r: 15; }
}

@media (max-width: 480px) {
  .sun { r: 20; }
  .small-sun { r: 10; }
}

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

/* 左下角無界聯盟字標 */
.brand {
  position: absolute;
  left: 1.25rem;
  bottom: 1.25rem;
  z-index: 10;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  text-decoration: none;
  transition: all 0.3s ease;
}

.brand:hover { transform: scale(1.04); }

.brand-zh {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 2px;
}

.brand-en {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--mandarin);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.powered-by {
  position: absolute;
  bottom: -48px;
  left: 0; right: 0;
  text-align: center;
  z-index: 10;
}

.lod-mark {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.5;
}

/* 粒子背景 */
.particles {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

.particle {
  position: absolute;
  background-color: rgba(224, 90, 26, 0.10);
  border-radius: 50%;
  animation: particleFloat linear infinite;
}

@keyframes particleFloat {
  0% { transform: translateY(0) rotate(0deg); }
  100% { transform: translateY(-100vh) rotate(360deg); }
}

/* 光暈動畫 */
.glow {
  position: absolute;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(224, 90, 26, 0.16) 0%, rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
  z-index: 0;
  opacity: 0.7;
  animation: glowPulse 8s infinite alternate ease-in-out;
}

.glow:nth-child(2) {
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(237, 224, 196, 0.5) 0%, rgba(255, 255, 255, 0) 70%);
  animation-delay: 2s;
  animation-duration: 10s;
}

@keyframes glowPulse {
  0% { transform: translate(10%, 10%) scale(1); opacity: 0.5; }
  50% { transform: translate(-10%, -5%) scale(1.2); opacity: 0.7; }
  100% { transform: translate(-5%, 15%) scale(0.9); opacity: 0.6; }
}
