* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background-color: #fff;
    color: #000;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}


/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
    animation: modalfadein 0.3s;
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 0;
    border: none;
    border-radius: 12px;
    width: 85%;
    max-width: 400px;
    max-height: 70%; /* 添加最大高度 */
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    animation: modalslidein 0.3s;
}

@keyframes modalfadein {
    from {opacity: 0;}
    to {opacity: 1;}
}

@keyframes modalslidein {
    from {transform: translateY(-20px); opacity: 0;}
    to {transform: translateY(0); opacity: 1;}
}

.modal-header {
    padding: 16px 20px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; /* 防止头部被压缩 */
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.close {
    color: #6c757d;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
    line-height: 1.5;
    color: #555;
    overflow-y: auto; /* 添加垂直滚动条 */
    flex-grow: 1; /* 占据剩余空间 */
    max-height: 90%; /* 控制内容区域最大高度 */
}

/* 自定义滚动条样式（可选） */
.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.modal-footer {
    padding: 12px 20px 20px;
    text-align: right;
    border-radius: 0 0 12px 12px;
    flex-shrink: 0; /* 防止底部被压缩 */
    border-top: 1px solid #e9ecef;
    background-color: #f8f9fa;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
}


/* 原有样式保持不变 */
.dial-container {
    width: 100%;
    height: 100%;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    max-width: 100%;
    max-height: 100%;
}

.number-display {
    flex: 0 0 20%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    border-bottom: 1px solid #f0f0f0;
}

#phone-number {
    font-size: 56px;
    font-weight: 300;
    letter-spacing: 2px;
    color: #000;
    text-align: center;
    min-height: 70px;
    width: 100%;
    padding: 0 2px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.placeholder {
    color: #999;
    font-size: 28px;
}

/* 修改：使用原生 table 布局 */
.dial-pad {
    flex: 0 0 50%;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
}

.dial-table {
    width: 100%;
    height: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.dial-table td {
    width: 33.33%;
    height: 25%; /* 4行，每行25%高度 */
    text-align: center;
    vertical-align: middle;
    padding: 0;
}

.dial-key {
    width: 100%;
    height: 100%;
    background-color: #fff;
    border: none;
    color: #000;
    font-size: 19px;
    font-weight: 10;
    position: relative;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.1s;
}

.dial-key:active {
    background-color: #f0f0f0;
}

.dial-key .sub-label {
    font-size: 13px;
    color: #666;
    margin-top: 8px;
    font-weight: 200;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.call-section {
    flex: 0 0 20%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
    border-top: 1px solid #f0f0f0;
}

.call-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 32px;
    box-shadow: 0 4px 10px rgba(46, 204, 113, 0.3);
    transition: all 0.2s;
}

.call-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 5px rgba(46, 204, 113, 0.3);
}

.delete-btn {
    background-color: transparent;
    border: none;
    color: #666;
    font-size: 24px;
    width: 60px;
    height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border-radius: 50%;
    position: absolute;
    right: 20px;
    transition: background-color 0.2s;
}

.delete-btn:active {
    background-color: #f0f0f0;
}

.delete-btn .label {
    font-size: 12px;
    margin-top: 5px;
    color: #666;
}

.contacts-btn {
    background-color: transparent;
    border: none;
    color: #666;
    font-size: 24px;
    width: 60px;
    height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border-radius: 50%;
    position: absolute;
    left: 20px;
    transition: background-color 0.2s;
}

.contacts-btn:active {
    background-color: #f0f0f0;
}

.contacts-btn .label {
    font-size: 12px;
    margin-top: 5px;
    color: #666;
}

* {
    -webkit-tap-highlight-color: transparent;
}

@media (max-width: 400px) {
    #phone-number {
        font-size: 48px;
    }
    
    .dial-key {
        font-size: 32px;
    }
    
    .dial-key .sub-label {
        font-size: 11px;
    }
    
    .modal-content {
        width: 90%;
        margin: 20% auto;
    }
}