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

html {
    height: 100%;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
}

body {
    font-family: 'Georgia', 'Palatino', 'Times New Roman', serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height */
    position: relative;
    overflow-x: hidden;
}

.settings-button {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background-color: transparent;
    color: black;
    border: none;
    width: 2.5rem;
    height: 2.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: transform 0.2s;
    padding: 0;
}

.language-switcher {
    position: fixed;
    top: 1rem;
    right: 4.5rem;
    display: flex;
    gap: 0.5rem;
    z-index: 2000;
}

.lang-button {
    background-color: transparent;
    border: none;
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    color: #999;
    transition: all 0.2s;
    padding: 0.25rem 0.5rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

.lang-button:hover {
    color: #555;
}

.lang-button.active {
    color: #000;
}

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

.share-button {
    position: fixed;
    top: 1rem;
    left: 1rem;
    background-color: transparent;
    color: black;
    border: none;
    width: 2.5rem;
    height: 2.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: transform 0.2s;
    padding: 0;
}

.share-button svg {
    width: 100%;
    height: 100%;
}

.share-button:hover {
    transform: scale(1.1);
}

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

.share-button.hidden {
    display: none;
}

.settings-button svg {
    width: 100%;
    height: 100%;
}

.settings-button:hover {
    transform: scale(1.1) rotate(30deg);
}

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

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    animation: fadeIn 0.3s ease-out;
}

.modal.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.close-button {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #666;
    line-height: 1;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-button:hover {
    color: #000;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.75rem;
    border: 2px solid #eee;
    border-radius: 8px;
    transition: all 0.2s;
}

.radio-option:hover {
    border-color: #000;
    background-color: #f9f9f9;
}

.radio-option input[type="radio"] {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
}

.radio-option span {
    font-size: 1rem;
    font-weight: 500;
}

.philosopher-selection {
    margin-top: 1rem;
}

.philosopher-search {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 1rem;
    transition: border-color 0.2s;
}

.philosopher-search:focus {
    outline: none;
    border-color: #000;
}

.philosopher-list {
    height: 40vh;
    overflow-y: auto;
    border: 2px solid #eee;
    border-radius: 8px;
    padding: 0.5rem;
    width: 100%;
    box-sizing: border-box;
}

.philosopher-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 6px;
    transition: background-color 0.2s;
    cursor: pointer;
    position: relative;
}

.philosopher-item:hover {
    background-color: #f5f5f5;
}

.philosopher-item input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
    flex-shrink: 0;
}

.philosopher-item label {
    cursor: pointer;
    flex: 1;
    font-size: 0.95rem;
}

.favorite-star {
    font-size: 1.25rem;
    cursor: pointer;
    user-select: none;
    padding: 0.25rem 0.5rem;
    transition: transform 0.2s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.favorite-star svg {
    width: 1.25rem;
    height: 1.25rem;
}

.favorite-star:hover {
    transform: scale(1.2);
}

.favorite-star.active {
    color: black;
}

.modal-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: flex-end;
    padding: 1rem 1.5rem;
    border-top: 1px solid #eee;
    background: white;
    position: sticky;
    bottom: 0;
}

.apply-button {
    background-color: black;
    color: white;
    border: none;
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    border-radius: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.apply-button:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.apply-button:active {
    transform: scale(0.98);
}

html {
    font-size: 16px;
}

body {
    background-color: white;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.container {
    text-align: center;
    max-width: 95%;
    width: 800px;
    padding: 1rem;
}

@media (min-width: 768px) {
    .container {
        padding: 2rem;
        max-width: 90%;
    }
}

.main-button {
    background-color: black;
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    border-radius: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
    min-width: 160px;
}

@media (min-width: 768px) {
    .main-button {
        padding: 1rem 2.5rem;
        font-size: 1.125rem;
        min-width: 150px;
    }
}

.main-button:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.main-button:active {
    transform: scale(0.98);
}

.hidden {
    display: none;
}

#quoteView {
    animation: fadeIn 0.5s ease-in;
    transition: opacity 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.quote-text {
    color: black;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    font-weight: 500;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: none;
    padding: 0 0.5rem;
    text-align: center;
}

@media (min-width: 768px) {
    .quote-text {
        font-size: 1.75rem;
        line-height: 1.7;
        margin-bottom: 1.5rem;
        padding: 0;
    }
}

.author-row {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .author-row {
        flex-direction: row;
        gap: 1rem;
        margin-bottom: 2rem;
    }
}

.quote-author {
    color: black;
    font-size: 1rem;
    font-style: italic;
    opacity: 0.7;
    text-align: center;
    padding: 0 0.5rem;
}

@media (min-width: 768px) {
    .quote-author {
        font-size: 1.25rem;
        padding: 0;
    }
}

.details-button {
    position: fixed;
    bottom: 6rem;
    left: 50%;
    transform: translateX(-50%);
    background: none;
    border: none;
    color: black;
    font-size: 1rem;
    cursor: pointer;
    opacity: 0.3;
    padding: 0.75rem 1.25rem;
    transition: opacity 0.2s;
    z-index: 1000;
}

@media (min-width: 768px) {
    .details-button {
        font-size: 0.875rem;
        bottom: 7rem;
        padding: 0.4rem 0.75rem;
    }
}

.details-button:hover {
    opacity: 0.6;
}

.quote-details {
    color: black;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    opacity: 0.6;
    line-height: 1.4;
    word-wrap: break-word;
}

@media (min-width: 768px) {
    .quote-details {
        font-size: 1rem;
        margin-bottom: 2rem;
    }
}

.retry-button {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: black;
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    border-radius: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
    min-width: 180px;
    z-index: 1000;
    white-space: nowrap;
}

@media (min-width: 768px) {
    .retry-button {
        padding: 1rem 2.5rem;
        font-size: 1.125rem;
        bottom: 2.5rem;
        min-width: 150px;
    }
}

.retry-button:hover {
    transform: translateX(-50%) scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.retry-button:active {
    transform: translateX(-50%) scale(0.98);
}

.copyright {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    text-align: center;
    padding: 0.75rem 0;
    background: transparent;
    z-index: 100;
}

.copyright p {
    margin: 0;
    font-size: 0.75rem;
    color: rgba(0, 0, 0, 0.4);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

.copyright a {
    color: rgba(0, 0, 0, 0.4);
    text-decoration: none;
    transition: color 0.2s;
}

.copyright a:hover {
    color: rgba(0, 0, 0, 0.7);
    text-decoration: underline;
}

@media (min-width: 768px) {
    .copyright p {
        font-size: 0.875rem;
    }
}
