/* 手机端样式 - 移动端优化 */

:root {
  --primary-color: #4A90E2;
  --success-color: #2ECC71;
  --danger-color: #E74C3C;
  --bg-dark: #1a1a2e;
  --bg-card: #16213e;
  --text-light: #ffffff;
  --text-muted: #a0a0a0;
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg-dark);
  color: var(--text-light);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 2rem 1.5rem;
}

.logo {
  font-size: 2.5rem;
  font-weight: bold;
  margin-bottom: 2rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 输入区域 */
.input-section {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  padding: 2rem;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.input-section h2 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.input-group {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.input-group input {
  flex: 1;
  padding: 1rem;
  font-size: 1.2rem;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: white;
  text-align: center;
  letter-spacing: 4px;
  font-weight: bold;
  transition: border-color 0.3s ease;
}

.input-group input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.input-group input::placeholder {
  letter-spacing: normal;
  font-weight: normal;
  color: var(--text-muted);
}

/* 分隔线 */
.divider {
  display: flex;
  align-items: center;
  margin: 1.5rem 0;
  color: var(--text-muted);
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.divider span {
  padding: 0 1rem;
}

/* 按钮样式 */
.btn {
  padding: 1rem 2rem;
  font-size: 1rem;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
}

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

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

.btn-primary:active {
  background: #357ABD;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.btn-secondary:active {
  background: rgba(255, 255, 255, 0.2);
}

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

.btn-danger:active {
  background: #c0392b;
}

.btn .icon {
  font-size: 1.3rem;
}

/* 提示 */
.tips {
  margin-top: 2rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  max-width: 400px;
  text-align: center;
}

.tips p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* 连接中状态 */
#connecting-state {
  text-align: center;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 2rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#connecting-state h2 {
  margin-bottom: 0.5rem;
}

#connecting-state p {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

#connecting-state .btn {
  max-width: 200px;
}

/* 投屏中状态 */
#casting-state {
  justify-content: flex-start;
  padding-top: calc(var(--safe-top) + 1rem);
  padding-bottom: calc(var(--safe-bottom) + 1rem);
}

.casting-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.casting-header h2 {
  font-size: 1.5rem;
}

#cast-timer {
  font-size: 1.2rem;
  color: var(--success-color);
  font-weight: bold;
  font-family: monospace;
}

.preview-container {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  margin-bottom: 2rem;
}

#local-preview {
  width: 100%;
  display: block;
  aspect-ratio: 9/16;
  object-fit: cover;
}

.preview-label {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  background: rgba(0, 0, 0, 0.6);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.8rem;
  backdrop-filter: blur(10px);
}

.controls {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.status-info {
  width: 100%;
  max-width: 400px;
  background: rgba(255, 255, 255, 0.05);
  padding: 1rem;
  border-radius: 12px;
}

.status-info p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0.3rem 0;
}

.status-info span {
  color: var(--text-light);
  font-weight: bold;
}

/* 错误提示 */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--danger-color);
  color: white;
  padding: 1rem 2rem;
  border-radius: 50px;
  font-size: 0.9rem;
  box-shadow: 0 10px 30px rgba(231, 76, 60, 0.3);
  z-index: 1000;
  animation: slideUp 0.3s ease;
}

.toast.hidden {
  display: none;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translate(-50%, 20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* 工具类 */
.hidden {
  display: none !important;
}

/* 响应式 */
@media (max-height: 600px) {
  .container {
    padding: 1rem;
  }
  
  .logo {
    margin-bottom: 1rem;
    font-size: 2rem;
  }
  
  .input-section {
    padding: 1.5rem;
  }
}
