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

body {
    font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'PingFang TC', sans-serif;
    background: #FFFFFF;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background: #FFFFFF;
    touch-action: manipulation;
}

/* 主容器 - 全螢幕顯示 */
.phone-container {
    width: 100vw;
    height: 100vh;
    background: #FFFFFF;
    display: flex;
    flex-direction: column;
	justify-content : start;
    position: relative;
    /* 移除任何邊框和陰影 */
    border: none;
    box-shadow: none;
    border-radius: 0;
    overflow-y: auto;
    min-height: 100vh;
}

/* 通話資訊區域 - 上半部分 */
.call-info {
    flex: 0.6;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px 20px;
    background: #FFFFFF;
    min-height: 0;
}

/* Logo 區域 */
.logo-section {
    margin-bottom: 10px;
}

.company-logo {
    height: 30px;
    width: auto;
    max-width: 200px;
}

/* 通話時間 - 根據參考圖片調整更適合的大小 */
.call-duration {
    font-family: 'Montserrat', monospace;
    font-size: 32px;
    font-weight: 600;
    color: #333333;
    line-height: 1;
    margin-bottom: 10px;
    text-align: center;
}

/* 連線中狀態 - 淡桃色背景 */
.call-status-connecting {
    background: #FFE5D0;
    color: #F7A445;
    padding: 8px 20px;
    border-radius: 18px;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
}

/* 通話中狀態 - 淡綠色背景 */
.call-status-talking {
    background: #DBEFE6;
    color: #2C8347;
    padding: 8px 20px;
    border-radius: 18px;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
}

/* 數字鍵盤區域 */
.dialpad-section {
    padding: 10px 12px 10px;
    background: #FFFFFF;
    flex: 0 0 auto;
}

.dialpad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    max-width: 280px;
    margin: 0 auto;
    justify-items: center;
}

/* 數字按鈕 - 精確還原圓形灰色按鈕 */
.dialpad-button {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #EFEFEF;
    border: none;
    font-family: 'Montserrat', sans-serif;
    font-size: 32px;
    font-weight: 500;
    color: #333333;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.dialpad-button:active {
    background: #DADADA;
    transform: scale(0.95);
}

/* 控制按鈕區域 */
.control-section {
    padding: 15px 40px;
    padding-bottom: calc(30px + env(safe-area-inset-bottom, 0px));
    background: #FFFFFF;
    flex: 0 0 auto;
    min-height: 120px;
}

.control-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    align-items: start;
    max-width: 280px;
    margin: 0 auto;
    justify-items: center;
    /* 確保與數字鍵盤完全對齊 */
    grid-template-areas: "left center right";
}

.control-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    min-height: 100px;
}

/* 確保掛機按鈕在中心位置與數字鍵盤第2列對齊 */
.end-call-control {
    grid-area: center;
}

/* 控制按鈕樣式 */
.control-button {
    border: none;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    background: #EFEFEF;
}

.control-button:active {
    transform: scale(0.95);
}

/* 麥克風靜音按鈕 - 與數字按鈕完全相同大小 */
.mute-btn {
    width: 72px;
    height: 72px;
}

/* 撥號按鈕 - 與數字按鈕完全相同大小 */
.call-btn {
    width: 72px;
    height: 72px;
    background: #8AC149;
}

/* 掛機按鈕 - 與數字按鈕完全相同大小 */
.end-call-btn {
    width: 72px;
    height: 72px;
    background: #F44F4F;
}

/* 擴音按鈕 - 與數字按鈕完全相同大小 */
.speaker-btn {
    width: 72px;
    height: 72px;
}

/* 控制按鈕圖標 - 在相同大小按鈕中適當縮放 */
.control-icon {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.end-call-icon {
    width: 36px;
    height: 36px;
}

/* 按鈕標籤 - 精確調整字體大小與參考圖一致 */
.control-label {
    font-size: 14px;
    color: #444444;
    text-align: center;
    font-weight: 400;
    line-height: 1.2;
    font-family: 'Noto Sans TC', sans-serif;
    white-space: nowrap;
    overflow: visible;
}

/* 隱藏標籤 - 占據空間但不顯示 */
.hidden-label {
    opacity: 0;
    user-select: none;
    pointer-events: none;
}

/* === RWD 響應式設計 === */

/* 小高度螢幕特別處理 - 防止底部按鈕被遮蔽 */
@media (max-height: 600px) {
    .call-info {
        padding: 20px 24px 15px;
        flex: 1;
        min-height: 0;
    }
    
    .call-duration {
        font-size: 28px;
        margin-bottom: 10px;
    }
    
    .company-logo {
        height: 25px;
        margin-bottom: 12px;
    }
    
    .dialpad-section {
        padding: 8px 12px 8px;
    }
    
    .control-section {
        padding: 10px 40px;
        padding-bottom: calc(15px + env(safe-area-inset-bottom, 0px));
        min-height: 100px;
    }
}

/* 非常小高度螢幕 (iPhone SE 橫向等) */
@media (max-height: 480px) {
    .call-info {
        padding: 15px 24px 10px;
    }
    
    .call-duration {
        font-size: 24px;
        margin-bottom: 10px;
    }
    
    .company-logo {
        height: 22px;
        margin-bottom: 8px;
    }
    
    .call-status-connecting {
        font-size: 14px;
        padding: 6px 16px;
    }
    
    .call-status-talking {
        font-size: 14px;
        padding: 6px 16px;
    }
    
    .dialpad-section {
        padding: 5px 12px 5px;
    }
    
    .dialpad-button {
        width: 60px;
        height: 60px;
        font-size: 26px;
    }
    
    .dialpad-grid {
        gap: 12px;
        max-width: 240px;
    }
    
    .control-section {
        padding: 8px 40px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        min-height: 85px;
    }
    
    .control-group {
        gap: 12px;
        max-width: 240px;
    }
    
    .mute-btn, .speaker-btn, .call-btn, .end-call-btn {
        width: 60px;
        height: 60px;
    }
    
    .control-icon {
        width: 28px;
        height: 28px;
    }
    
    .end-call-icon {
        width: 28px;
        height: 28px;
    }
    
    .control-label {
        font-size: 11px;
    }
}

/* 非常小的螢幕 (舊版小型手機) */
@media (max-width: 320px) {
    .call-duration {
        font-size: 24px;
    }
    
    .company-logo {
        height: 22px;
    }
    
    .dialpad-button {
        width: 58px;
        height: 58px;
        font-size: 26px;
    }
    
    .dialpad-grid {
        gap: 10px;
        max-width: 210px;
    }
    
    .control-group {
        gap: 10px;
        max-width: 210px;
    }
    
    .mute-btn, .speaker-btn, .call-btn, .end-call-btn {
        width: 58px;
        height: 58px;
    }
    
    .control-icon {
        width: 26px;
        height: 26px;
    }
    
    .end-call-icon {
        width: 26px;
        height: 26px;
    }
    
    .control-label {
        font-size: 11px;
    }
    
    .call-info {
        padding: 25px 15px 15px;
    }
    
    .control-section {
        padding: 10px 25px;
        padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
        min-height: 110px;
        margin-bottom: 80px;
    }
    
    .dialpad-section {
        padding: 8px 10px 8px;
    }
}

/* 極小螢幕 (iPhone SE 等) */
@media (max-width: 375px) {
    .call-duration {
        font-size: 26px;
    }
    
    .company-logo {
        height: 25px;
    }
    
    .dialpad-button {
        width: 65px;
        height: 65px;
        font-size: 28px;
    }
    
    .dialpad-grid {
        gap: 12px;
        max-width: 240px;
    }
    
    .control-group {
        gap: 12px;
        max-width: 240px;
    }
    
    .mute-btn, .speaker-btn, .call-btn, .end-call-btn {
        width: 65px;
        height: 65px;
    }
    
    .control-icon {
        width: 32px;
        height: 32px;
    }
    
    .end-call-icon {
        width: 40px;
        height: 40px;
    }
    
    .control-label {
        font-size: 12px;
    }
    
    .call-info {
        padding: 30px 20px 15px;
    }
    
    .control-section {
        padding: 10px 30px;
        padding-bottom: calc(25px + env(safe-area-inset-bottom, 0px));
        min-height: 115px;
    }
}

/* 一般手機螢幕 */
@media (min-width: 376px) and (max-width: 414px) {
    .call-duration {
        font-size: 29px;
    }
    
    .company-logo {
        height: 28px;
    }
}

/* 大手機螢幕 (iPhone Plus, Android 大螢幕) */
@media (min-width: 415px) and (max-width: 767px) {
    .call-duration {
        font-size: 35px;
    }
    
    .company-logo {
        height: 32px;
    }
    
    .dialpad-button {
        width: 78px;
        height: 78px;
        font-size: 34px;
    }
    
    .dialpad-grid {
        gap: 20px;
        max-width: 290px;
    }
    
    .control-group {
        gap: 20px;
        max-width: 290px;
    }
    
    .mute-btn, .speaker-btn, .call-btn, .end-call-btn {
        width: 78px;
        height: 78px;
    }
}

/* iPad 縱向模式 */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
    .call-duration {
        font-size: 40px;
        margin-bottom: 10px;
    }
    
    .company-logo {
        height: 36px;
    }
    
    .dialpad-button {
        width: 90px;
        height: 90px;
        font-size: 38px;
    }
    
    .dialpad-grid {
        gap: 25px;
        max-width: 340px;
    }
    
    .control-group {
        gap: 25px;
        max-width: 340px;
    }
    
    .mute-btn, .speaker-btn, .call-btn, .end-call-btn {
        width: 90px;
        height: 90px;
    }
    
    .control-icon {
        width: 45px;
        height: 45px;
    }
    
    .end-call-icon {
        width: 55px;
        height: 55px;
    }
    
    .control-section {
        padding: 25px 60px;
        padding-bottom: calc(35px + env(safe-area-inset-bottom, 0px));
        min-height: 140px;
    }
    
    .call-info {
        flex: 0.8;
        padding: 50px 40px 30px;
    }
}

/* iPad 橫向和小型平板 */
@media (min-width: 1024px) and (max-width: 1366px) {
    .phone-container {
        max-width: 500px;
        margin: 0 auto;
        height: 100vh;
    }
    
    .call-duration {
        
    }
    
    .company-logo {
        height: 40px;
    }
    
    .dialpad-button {
        width: 90px;
        height: 90px;
        font-size: 42px;
    }
    
    .dialpad-grid {
        gap: 30px;
        max-width: 360px;
    }
    
    .control-group {
        gap: 30px;
        max-width: 360px;
    }
    
    .mute-btn, .speaker-btn, .call-btn, .end-call-btn {
        width: 90px;
        height: 90px;
    }
    
    .control-icon {
        width: 50px;
        height: 50px;
    }
    
    .end-call-icon {
        width: 60px;
        height: 60px;
    }
    
    .control-section {
        padding: 35px 80px;
        padding-bottom: calc(45px + env(safe-area-inset-bottom, 0px));
        min-height: 160px;
    }
    
    .call-info {
        padding: 60px 50px 40px;
    }
    
    .control-label {
        font-size: 16px;
    }
}

/* 桌面螢幕 */
@media (min-width: 1367px) {
    body {
        overflow: hidden;
    }
    
    .phone-container {
        max-width: 400px;
        margin: 0 auto;
        height: 100vh;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }
    
    .call-info {
        flex: 0 0 auto;
        padding: 25px 24px 20px;
    }
    
    .call-duration {
        font-size: 32px;
    }
    
    .company-logo {
        height: 35px;
        max-width: 100%;
        object-fit: contain;
    }
    
    .dialpad-section {
        flex: 1 1 auto;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 10px 12px;
    }
    
    .control-section {
        flex: 0 0 auto;
        padding: 15px 24px 30px;
        margin-bottom: 80px;
    }
    
    /* 確保控制按鈕與數字按鈕大小一致 */
    .mute-btn, .speaker-btn, .call-btn, .end-call-btn {
        width: 72px;
        height: 72px;
    }
    
    /* 調整圖標大小適合按鈕 */
    .control-icon, .end-call-icon {
        width: 36px;
        height: 36px;
    }
    
    /* 確保控制按鈕Grid與數字鍵盤對齊 */
    .control-group {
        gap: 20px;
        max-width: 280px;
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        align-items: center;
        justify-items: center;
    }
    
    /* 確保控制項完整顯示 */
    .control-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-height: 100px;
        width: 100%;
    }
    
    .control-label {
        font-size: 14px;
        margin-top: 8px;
        text-align: center;
        white-space: nowrap;
        overflow: visible;
        color: #666666;
    }
}

/* 橫向模式適配 (手機橫向) */
@media (orientation: landscape) and (max-height: 500px) {
    .phone-container {
        flex-direction: row;
        width: 100vw;
        height: 100vh;
        overflow: hidden;
    }
    
    .call-info {
        flex: 0 0 30%;
        padding: 15px;
        justify-content: center;
        min-width: 200px;
    }
    
    .dialpad-section {
        flex: 0 0 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 15px 10px;
    }
    
    .control-section {
        flex: 0 0 20%;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 8px 5px;
        min-width: 120px;
		flex-wrap: wrap;
    }
    
    .control-group {
        display: flex;
        flex-direction: column;
        gap: 15px;
        justify-content: center;
        align-items: center;
    }
    
    .call-duration {
        font-size: 19px;
        margin-bottom: 8px;
    }
    
    .company-logo {
        height: 18px;
        margin-bottom: 8px;
    }
    
    .call-status-connecting {
        font-size: 14px;
        padding: 6px 16px;
    }
    
    .call-status-talking {
        font-size: 14px;
        padding: 6px 16px;
    }
    
    .dialpad-button {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
    
    .dialpad-grid {
        gap: 12px;
        max-width: 180px;
    }
    
    .mute-btn, .speaker-btn, .call-btn, .end-call-btn {
        width: 48px;
        height: 48px;
    }
    
    .control-icon {
        width: 22px;
        height: 22px;
    }
    
    .end-call-icon {
        width: 22px;
        height: 22px;
    }
    
    .control-label {
        font-size: 10px;
        max-width: 55px;
        line-height: 1.1;
    }
}

/* 超寬螢幕適配 */
@media (min-width: 1920px) {
    .phone-container {
        max-width: 420px;
    }
    
    .call-duration {
        font-size: 35px;
    }
    
    .company-logo {
        height: 42px;
    }
    
    .dialpad-button {
        width: 90px;
        height: 90px;
        font-size: 45px;
    }
    
    .dialpad-grid {
        gap: 32px;
        max-width: 380px;
    }
    
    .control-group {
        gap: 32px;
        max-width: 380px;
    }
    
    .mute-btn, .speaker-btn, .call-btn, .end-call-btn {
        width: 90px;
        height: 90px;
    }
    
    .control-icon {
        width: 60px;
        height: 60px;
    }
    
    .end-call-icon {
        width: 60px;
        height: 60px;
    }
    
    .control-label {
        font-size: 18px;
        margin-top: 12px;
    }
}


/* 減少動畫模式 */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
    
    .dialpad-button:active,
    .control-button:active {
        transform: none;
    }
}

/* 觸控設備優化 */
@media (hover: none) and (pointer: coarse) {
    .dialpad-button,
    .control-button {
        min-height: 44px;
        min-width: 44px;
    }
    
    .dialpad-button:hover,
    .control-button:hover {
        background: initial;
    }
    
    /* iOS Safari 底部安全區域特別處理 */
    .control-section {
        padding-bottom: calc(15px + env(safe-area-inset-bottom, 20px)) !important;
    }
}

/* 確保在所有設備上底部有足夠空間 */
@supports (padding: max(0px)) {
    .control-section {
        padding-bottom: max(20px, calc(15px + env(safe-area-inset-bottom, 0px))) !important;
    }
}

/* 小平板橫向特別處理 */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    .phone-container {
        flex-direction: row;
        max-width: 100vw;
        height: 100vh;
    }
    
    .call-info {
        flex: 0 0 35%;
        padding: 30px 25px;
        justify-content: center;
        min-width: 250px;
    }
    
    .dialpad-section {
        flex: 0 0 45%;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 13px 10px;
    }
    
    .control-section {
        flex: 0 0 20%;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 25px 15px;
        min-width: 140px;
    }
    
    .control-group {
        display: flex;
        flex-direction: column;
        gap: 20px;
        align-items: center;
    }
    
    .call-duration {
        font-size: 29px;
        margin-bottom: 10px;
    }
    
    .company-logo {
        height: 26px;
        margin-bottom: 12px;
    }
    
    .call-status-connecting {
        font-size: 15px;
        padding: 7px 18px;
    }
    
    .call-status-talking {
        font-size: 15px;
        padding: 7px 18px;
    }
    
    .dialpad-button {
        width: 65px;
        height: 65px;
        font-size: 28px;
    }
    
    .dialpad-grid {
        gap: 18px;
        max-width: 260px;
    }
    
    .mute-btn, .speaker-btn, .call-btn, .end-call-btn {
        width: 65px;
        height: 65px;
    }
    
    .control-icon {
        width: 32px;
        height: 32px;
    }
    
    .end-call-icon {
        width: 32px;
        height: 32px;
    }
    
    .control-label {
        font-size: 12px;
        max-width: 70px;
    }
	  
	html.android .phone-container {
		transform: scale(0.8);
		transform-origin: top left;
		width: 100vw;
		height: 100vh;
		overflow: visible; /* 讓縮小後的內容可以顯示 */
	}
	html.android .dialpad-section{
		align-items: baseline;
	}
	html.android .control-section {
		padding : 15px 15px;
	}

}

/* 大平板橫向特別處理 */
@media (min-width: 1024px) and (orientation: landscape) {
	.phone-container {
        flex-direction: row;
        max-width: 100vw;
        height: 100vh;
    }
    
    .call-info {
        flex: 0 0 35%;
        padding: 30px 25px;
        justify-content: center;
        min-width: 250px;
    }
    
    .dialpad-section {
        flex: 0 0 45%;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 13px 10px;
    }
    
    .control-section {
        flex: 0 0 20%;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 25px 15px;
        min-width: 140px;
    }
    
    .control-group {
        display: flex;
        flex-direction: column;
        gap: 20px;
        align-items: center;
    }
    
    .call-duration {
        font-size: 29px;
        margin-bottom: 10px;
    }
    
    .company-logo {
        height: 26px;
        margin-bottom: 12px;
    }
    
    .call-status-connecting {
        font-size: 15px;
        padding: 7px 18px;
    }
    
    .call-status-talking {
        font-size: 15px;
        padding: 7px 18px;
    }
    
    .dialpad-button {
        width: 65px;
        height: 65px;
        font-size: 28px;
    }
    
    .dialpad-grid {
        gap: 18px;
        max-width: 260px;
    }
    
    .mute-btn, .speaker-btn, .call-btn, .end-call-btn {
        width: 65px;
        height: 65px;
    }
    
    .control-icon {
        width: 32px;
        height: 32px;
    }
    
    .end-call-icon {
        width: 32px;
        height: 32px;
    }
    
    .control-label {
        font-size: 12px;
        max-width: 70px;
    }
}

/* === 彈跳視窗樣式 === */
.modal {
  position: fixed !important;
  z-index: 9999 !important;
  left: 0 !important;
  top: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background-color: rgba(0, 0, 0, 0.8) !important;
  display: flex;
  justify-content: center !important;
  align-items: center !important;
  visibility: visible !important;
  opacity: 1 !important;
  overflow: visible !important;
  pointer-events: auto !important;
}

.modal-content {
  background: #ffffff !important;
  border-radius: 12px !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12), 0 2px 10px rgba(0, 0, 0, 0.08) !important;
  width: 320px !important;
  height: 180px !important;
  max-width: 350px !important;
  min-width: 280px !important;
  max-height: 200px !important;
  min-height: 160px !important;
  margin: 0 auto !important;
  animation: modalSlideIn 0.3s cubic-bezier(0.2, 0, 0.2, 1) !important;
  position: relative !important;
  z-index: 10000 !important;
  pointer-events: auto !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  border: 1px solid #e5e7eb !important;
  overflow: hidden !important;
}

.modal-body {
  padding: 32px 28px 20px !important;
  text-align: center !important;
  flex-grow: 1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.modal-body p {
  margin: 0 !important;
  font-size: 16px !important;
  color: #374151 !important;
  font-weight: 400 !important;
  line-height: 1.5 !important;
  text-shadow: none !important;
  font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

.modal-footer {
  padding: 0 28px 28px !important;
  text-align: center !important;
  flex-shrink: 0 !important;
}

.modal-btn {
  background: #0d7377 !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 8px !important;
  padding: 12px 32px !important;
  font-size: 15px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  min-width: 120px !important;
  transition: all 0.2s cubic-bezier(0.2, 0, 0.2, 1) !important;
  margin: 0 auto !important;
  display: inline-block !important;
  box-shadow: 0 2px 8px rgba(13, 115, 119, 0.2) !important;
  font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  letter-spacing: 0.5px !important;
}

.modal-btn:hover {
  background: #0a5d61 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(13, 115, 119, 0.3) !important;
}

.modal-btn:active {
  transform: translateY(0) scale(0.98) !important;
  box-shadow: 0 1px 4px rgba(13, 115, 119, 0.2) !important;
  background: #0a5d61 !important;
}

.modal-btn:focus {
  outline: none !important;
  box-shadow: 0 2px 8px rgba(13, 115, 119, 0.2), 0 0 0 3px rgba(13, 115, 119, 0.1) !important;
}