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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-image: linear-gradient(0deg, #eee 1px, transparent 0),
        linear-gradient(90deg, #eee 1px, transparent 0);
    background-size: 30px 30px;
    color: #333;
    min-height: 100dvh;
    overflow: hidden;
}

body.is-mobile {
    overflow-y: auto;
}

#board {
    position: relative;
    width: 100vw;
    height: 100dvh;
    overflow: hidden;
}

body.is-mobile #board {
    height: auto;
    min-height: 100dvh;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
    color: rgba(0, 0, 0, 0.6);
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    font-size: 14px;
    transition: border-color 0.2s ease;
    background: rgba(255, 255, 255, 0.9);
}

.form-control:focus {
    outline: none;
    border-color: #4a90e2;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn {
    flex: 1;
    padding: 10px 15px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.btn-primary {
    background: #4a90e2;
    color: white;
}

.btn-primary:hover {
    background: #3a7bc8;
}

.btn-secondary {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.7);
}

.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.1);
}

.management-buttons {
    display: flex;
    gap: 8px;
    margin-top: 15px;
}

.management-buttons .btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 12px;
}

.search-box {
    margin-top: 15px;
}

.stats {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.5);
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

/* 右下角浮动按钮容器 */
.floating-buttons {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.floating-add-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #4a90e2;
    color: white;
    border: none;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(74, 144, 226, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.floating-add-btn:hover {
    background: #3a7bc8;
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(74, 144, 226, 0.5);
}

.floating-add-btn:active {
    transform: scale(0.95);
}

.floating-control-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #6c757d;
    color: white;
    border: none;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.floating-control-btn:hover {
    background: #5a6268;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.5);
}

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

@media (max-width: 768px) {
    .floating-buttons {
        bottom: 15px;
        right: 15px;
    }

    .floating-add-btn {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }

    .floating-control-btn {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
}

/* 添加留言对话框 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(5px);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: 12px;
    padding: 25px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.8);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: rgba(0, 0, 0, 0.5);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.05);
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* 控制面板模态框样式 */
.control-panel-modal .modal {
    max-width: 600px;
    width: 95%;
}

.control-panel-modal {
    position: fixed;
    width: 100%;
    box-shadow: none;
    margin: 0;
    padding: 0;
    border: none;
    backdrop-filter: none;
}

@media (max-width: 768px) {
    .control-panel-modal .modal {
        width: 95%;
        max-width: none;
        padding: 15px;
    }
}

/* 卡片样式 */
.card {
    position: absolute;
    width: 220px;
    min-height: 144px;
    border-radius: 12px;
    box-shadow: 0 16px 35px rgba(0, 0, 0, 0.2);
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    overflow: hidden;
    opacity: 0;
    transform-origin: center;
    transition: transform 0.35s ease, opacity 0.35s ease, left 0.35s ease,
        top 0.35s ease, width 0.35s ease, height 0.35s ease,
        border-radius 0.35s ease;
}

.card.dragging {
    transition: none;
    box-shadow: 0 22px 45px rgba(0, 0, 0, 0.35);
}

.card.maximized {
    box-shadow: 0 28px 60px rgba(0, 0, 0, 0.4);
}


.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.7);
    cursor: grab;
    user-select: none;
    touch-action: pan-y;
}

.card-header.dragging {
    cursor: grabbing;
}

.card-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.card-author {
    font-size: 13px;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.7);
}

.card-date {
    font-size: 10px;
    color: rgba(0, 0, 0, 0.4);
}


.card.maximized {
    .card-author {
        font-size: 15px;
    }
    textarea {
        height: 78lvh;
        font-size: 16px;
    }
}

.window-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.window-controls .control {
    position: relative;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #ccc;
    cursor: pointer;
    outline: none;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.window-controls .control.close {
    background: #ff5f57;
    border-color: #e0443e;
}

.window-controls .control.minimize {
    background: #febb2e;
    border-color: #dea123;
}

.window-controls .control.maximize {
    background: #28c840;
    border-color: #1aab2c;
}

.window-controls .control.edit {
    background: #4a90e2;
    border-color: #3a7bc8;
}

.window-controls .control::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.card-header:hover .window-controls .control::after {
    opacity: 0.8;
}

.window-controls .control.close::after {
    content: '×';
    width: auto;
    height: auto;
    background: none;
    font-size: 14px;
    line-height: 1;
    font-weight: 700;
    color: rgba(0, 0, 0, 0.7);
}

.window-controls .control.minimize::after {
    width: 8px;
    height: 3px;
    background: rgba(0, 0, 0, 0.6);
}

.window-controls .control.maximize::after {
    width: 8px;
    height: 8px;
    background: linear-gradient(45deg,
            rgba(0, 0, 0, 0.6) 0%,
            rgba(0, 0, 0, 0.6) 45%,
            transparent 45%,
            transparent 55%,
            rgba(0, 0, 0, 0.6) 55%,
            rgba(0, 0, 0, 0.6) 100%);
}

.window-controls .control.edit::after {
    content: '✎';
    width: auto;
    height: auto;
    background: none;
    font-size: 10px;
    line-height: 1;
    font-weight: 700;
    color: rgba(0, 0, 0, 0.7);
}

.card-body {
    padding: 16px;
    font-size: 16px;
    line-height: 1.4;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.72);
    white-space: pre-wrap;
    word-break: break-word;
    position: relative;
    padding-bottom: 28px;
    
    /* 新增的行数限制样式 */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-height: calc(1.8em * 3); /* 3行的高度 */
}

.card-date {
    font-size: 10px;
    color: rgba(0, 0, 0, 0.4);
    position: absolute;
    bottom: 3px;
    right: 12px;
    white-space: nowrap;
}

/* 编辑模式 */
.card.editing {
    z-index: 1000001 !important;
}

.edit-form {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.edit-form textarea {
    width: 100%;
    min-height: 100px;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
}

.edit-form .edit-buttons {
    display: flex;
    gap: 8px;
}

.edit-form .edit-buttons .btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 12px;
}

@media (max-width: 768px) {
    .card {
        width: 180px;
        min-height: 120px;
        border-radius: 10px;
    }

    .card-body {
        padding: 14px;
        font-size: 14px;
    }

    .card-author {
        font-size: 11px;
    }
}

    .floating-add-btn {
        width: 50px;
        height: 50px;
        font-size: 24px;
        bottom: 15px;
        right: 15px;
    }

    .modal {
        padding: 20px;
    }
}