/* ========================================
   背单词应用 - 样式文件
   ======================================== */

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

body {
    font-family: -apple-system, BlMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    overflow: hidden;
    justify-content: flex-start;
    box-sizing: border-box;
}

html {
    overflow: hidden;
}

::-webkit-scrollbar {
    display: none;
}

.header {
    width: 100%;
    max-width: 400px;
    margin-bottom: 10px;
    color: white;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 14px;
    padding: 12px 16px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 50px;
}

.last-word {
    padding: 8px 0;
    text-align: left;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 50px;
    visibility: visible;
}

.last-word.hidden {
    opacity: 0;
}

.last-word-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.last-word-english {
    font-size: 18px;
    font-weight: 600;
}

.last-word-chinese {
    font-size: 15px;
    opacity: 0.9;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 300px;
}

.last-word-type {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin-right: 8px;
}

.settings-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 8px;
    line-height: 1;
    display: flex;
    align-items: center;
    align-self: stretch;
}

.stats {
    display: flex;
    justify-content: space-around;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 12px;
    color: white;
    font-size: 14px;
    margin-top: 10px;
}

.container {
    width: 100%;
    max-width: 400px;
    height: calc(100vh - 310px);
    position: relative;
}

.card {
    position: absolute;
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 80px rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 25px;
    padding-top: 35px;
    cursor: grab;
    user-select: none;
    touch-action: none;
}

.card-0 {
    transform: scale(1);
    z-index: 10;
}

.card-1 {
    transform: scale(0.97) translateY(15px);
    z-index: 9;
}

.card-2 {
    transform: scale(0.94) translateY(28px);
    z-index: 8;
}

.card-3 {
    transform: scale(0.91) translateY(39px);
    z-index: 7;
}

.card-4 {
    transform: scale(0.88) translateY(48px);
    z-index: 6;
}

.card-5 {
    transform: scale(0.85) translateY(56px);
    z-index: 5;
}



.card.swiping-up {
    transform: translateY(-150%) rotate(-5deg) scale(1) !important;
    z-index: 10 !important;
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
}

.card.swiping-down {
    transform: translateY(150%) rotate(5deg) scale(1) !important;
    z-index: 10 !important;
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
}

.word {
    font-size: 42px;
    font-weight: bold;
    color: #333;
    margin-bottom: 12px;
    text-align: left;
    width: 100%;
}

.translation {
    font-size: 22px;
    color: #666;
    text-align: left;
    line-height: 1.5;
    width: 100%;
}

.translation-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.word-type-wrapper {
    flex-shrink: 0;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
}

.word-type {
    display: flex;
    align-items: center;
    background: #f0f0f0;
    color: #666;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.6;
    min-height: 26px;
}

.translation-text {
    flex: 1;
    min-width: 0;
    line-height: 1.5;
}

.divider-line {
    width: 100%;
    height: 1px;
    background: #eee;
    margin-top: 15px;
    margin-bottom: 12px;
}

.phrases {
    width: 100%;
    text-align: left;
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.phrases::-webkit-scrollbar {
    display: none;
}

.phrase-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 8px;
    padding: 6px 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.phrase-text {
    font-size: 16px;
    color: #333;
    font-style: italic;
}

.phrase-translation {
    font-size: 14px;
    color: #666;
    text-align: left;
}

.actions {
    position: fixed;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 24px);
    max-width: 400px;
    display: flex;
    gap: 24px;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 16px 24px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    box-sizing: border-box;
}

.action-btn {
    padding: 12px 24px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    margin: 0 8px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
}

.action-btn:focus, .action-btn:active {
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.down-btn:hover, .up-btn:hover {
    background: rgba(192, 192, 192, 0.6);
    border-color: rgba(192, 192, 192, 0.8);
}

.reset-btn {
    background: rgba(231, 76, 60, 0.8);
    border: 1px solid rgba(231, 76, 60, 0.4);
}

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

.swipe-hint {
    position: fixed;
    bottom: 130px;
    color: white;
    font-size: 14px;
    opacity: 0.8;
    text-align: center;
}

.loading {
    color: white;
    font-size: 18px;
}

.empty-state {
    text-align: center;
    color: white;
}

.empty-state h2 {
    font-size: 24px;
    margin-bottom: 20px;
}

.empty-state p {
    font-size: 16px;
    margin-bottom: 30px;
    opacity: 0.9;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: flex-start;
    padding-top: 60px;
    z-index: 100;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 360px;
    padding: 24px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

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

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 4px;
}

.modal-section {
    margin-bottom: 20px;
}

.modal-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
    display: block;
}

.modal-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
}

.modal-select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    background: white;
}

.modal-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.modal-btn-primary {
    background: #667eea;
    color: white;
}

.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    display: none;
    gap: 12px;
}

.loading-spinner.show {
    display: flex;
}

.loading-spinner span {
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite both;
}

.loading-spinner span:nth-child(1) { animation-delay: -0.32s; }
.loading-spinner span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}