/* emotion.css 完整浅蓝色系样式 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap');

:root {
    --sky-blue: #e3f6ff;
    --primary-blue: #4dabf7;
    --accent-teal: #12b886;
    --soft-purple: #9775fa;
    --text-dark: #2b2d42;
    --text-light: #f8f9fa;
    --card-bg: rgba(255, 255, 255, 0.95);
}

/* 基础样式 */
body {
    background: linear-gradient(135deg, #f0f9ff 0%, #e3f6ff 100%);
    color: var(--text-dark);
    font-family: 'Inter', system-ui, sans-serif;
    margin: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#container {
    width: 90%;
    max-width: 800px;
    padding: 4rem 0;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* 视频区域 */
.video-wrapper {
    position: relative;
    border: 2px solid var(--primary-blue);
    border-radius: 12px;
    overflow: hidden;
    background: white;
    box-shadow: 0 4px 20px rgba(77, 171, 247, 0.15);
    flex: 1;
    /*max-height: 50vh;*/
}

#video {
    width: 100%;
    height: 100%;
    display: block;
}

.scan-line {
    position: absolute;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-blue), transparent);
    animation: scan 3s infinite linear;
}

/* 状态卡片 */
.status-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 4px solid var(--primary-blue);
    box-shadow: 0 4px 20px rgba(77, 171, 247, 0.1);
    color: var(--text-dark);
}

.sensor-label {
    color: var(--primary-blue);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.glowing-text {
    color: var(--accent-teal);
    font-size: 1.5rem;
    font-weight: 600;
}

/* 状态网格 */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

.status-grid div {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* 计时器区域 */
.timer-wrapper {
    position: relative;
    width: 100px;
    height: 100px;

    display: flex;
    justify-content: center;
    align-items: center;
}

.progress-ring {
    position: absolute;
    width: 100%;
    height: 100%;
}

.progress-ring circle {
    stroke: var(--accent-teal);
    stroke-width: 4;
    fill: transparent;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    transition: stroke-dashoffset 0.3s ease;
}

#remaining-time {
    position: relative;
    z-index: 1;
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    color: var(--accent-teal);
    font-weight: 600;
    word-wrap: break-word; /* 长单词或 URL 强制换行 */
    overflow-wrap: break-word; /* 更现代的替代方案 */
    white-space: normal; /* 确保文本正常换行 */
    margin: 0 auto;
}

/* 控制按钮区域 */
#control-box {
    display: flex;

    align-items: center;
    gap: 2rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(77, 171, 247, 0.1);
    justify-content: space-around;
    width: 100%;
    box-sizing: border-box;
}

#toggle-button {
    width: 100px;
    height: 100px;
    border: none;
    border-radius: 50%;
    background: var(--primary-blue);
    color: white;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(77, 171, 247, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

#toggle-button span {
    position: relative;
    z-index: 1;
}

.button-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(77, 171, 247, 0.2);
    animation: pulse 2s infinite;
    z-index: 0;
}

/* 动画 */
@keyframes scan {
    0% {
        top: -2px;
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        top: 100%;
        opacity: 0;
    }
}

@keyframes pulse {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* 交互效果 */
#toggle-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(77, 171, 247, 0.4);
}


/* 新增的测试文字样式 */
#test-message {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-blue);
    /*margin-bottom: 1.5rem;*/
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(77, 171, 247, 0.1);
    border-left: 4px solid var(--accent-teal);
    animation: fadeIn 1s ease-in-out;
}

/* 新增的淡入动画 */
@keyframes fadeIn {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    #container {
        width: 95%;
        padding: 1rem 0;
    }

    /*#video {*/
    /*    height: 500px;*/
    /*}*/
    .status-card {
        padding: 1rem;
    }

    .status-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    #toggle-button {
        width: 80px;
        height: 80px;
        font-size: 16px;
    }

    .result-text {
        font-size: 1rem;
    }

    #control-box {
        gap: 1rem;
        padding: 1rem;
    }

    .status-grid div {
        padding: 0 0 0 1rem;
    }

    .glowing-text {
        font-size: 1rem;
    }
}

.alert-message {
    color: #dc3545;
    background: #ffeef0;
    padding: 0.5rem;
    border-radius: 4px;
    margin: 0.5rem 0;
    border: 1px solid #ffc9d2;
    font-size: 0.9rem;
    text-align: center;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Top controls (Start/Stop) */
#top-controls{
    display: flex;
    justify-content: center;
    gap: 12px;
    width: 100%;
    margin: 0 0 12px;
}

.control-btn{
    padding: 10px 16px;
    border-radius: 10px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,.08);
}

.control-btn.start{
    background: var(--primary-blue);
    color: #fff;
}

.control-btn.stop{
    background: #ef4444;
    color: #fff;
}

.control-btn:disabled{
    opacity: 0.45;
    cursor: not-allowed;
}

/* Improve message spacing */
#test-message p{
    margin: 0 0 10px;
    line-height: 1.7;
}
#test-message p:last-child{
    margin-bottom: 0;
}

/* Suggested Emotion red state */
.danger-text{
    color: #ef4444 !important;
}

#top-bar{
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin: 0 0 12px;
}

#test-message{
  font-size: 14px;
  line-height: 1.7;
  opacity: .9;
}

.modal-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}

.modal-card{
  width: min(520px, 100%);
  background: #fff;
  border-radius: 14px;
  padding: 18px 18px 14px;
  position: relative;
  box-shadow: 0 12px 36px rgba(0,0,0,.18);
}

.modal-close{
  position: absolute;
  right: 10px;
  top: 8px;
  border: none;
  background: transparent;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

.modal-card p{ margin: 8px 0; }
.danger-text{ color: #dc3545 !important; font-weight: 700; }


/* 如果你希望提示语和按钮同一行，把 top-bar 改成 row：
#top-bar{ flex-direction: row; align-items: center; justify-content: space-between; }
#test-message{ margin-right: 12px; }
*/
