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

:root {
    --bg-primary: #000000;
    --bg-secondary: #1c1c1e;
    --bg-tertiary: #2c2c2e;
    --text-primary: #ffffff;
    --text-secondary: #98989d;
    --text-tertiary: #636366;
    --accent: #0a84ff;
    --accent-hover: #409cff;
    --separator: rgba(84, 84, 88, 0.65);
    --shadow: rgba(0, 0, 0, 0.3);
}

body {
    font-family: monospace !important;
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
    line-height: 1.4;
    overscroll-behavior: none;
}

* {
    font-family: inherit !important;
}

.app {
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    display: flex;
    flex-direction: column;
    position: relative;
    padding-bottom: env(safe-area-inset-bottom);
}

/* Views */
.view {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: calc(100vh - 65px);
    padding-bottom: calc(100px + env(safe-area-inset-bottom));
}

.view.active {
    display: flex;
}

/* Header */
.header {
    padding: max(env(safe-area-inset-top), 12px) 0 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 0.5px solid var(--separator);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 34px;
    font-weight: 700;
    letter-spacing: -0.8px;
    padding: 8px 20px 12px;
    margin: 0;
}

/* Search Section */
.search-container {
    background: var(--bg-primary);
    padding: 16px 16px 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.search-bar {
    display: flex;
    gap: 0;
    margin-bottom: 12px;
    position: relative;
    align-items: center;
}

.search-bar input {
    flex: 1;
    padding: 10px 16px;
    padding-right: 40px;
    background: var(--bg-secondary);
    border: none;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 17px;
    font-weight: 400;
    outline: none;
    transition: background 0.2s ease;
}

.search-bar input:focus {
    background: var(--bg-tertiary);
}

.search-bar input::placeholder {
    color: var(--text-tertiary);
}

.btn-clear-search {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    padding: 6px;
    color: var(--text-tertiary);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn-clear-search.visible {
    display: flex;
}

.btn-clear-search:active {
    background: var(--bg-tertiary);
    transform: scale(0.9);
}

.btn-clear-search svg {
    display: block;
}

.search-results {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 20px;
}

.search-result-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 12px;
    margin-bottom: 8px;
    transition: all 0.15s ease;
    border: none;
    -webkit-tap-highlight-color: transparent;
    align-items: center;
}

.search-result-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
    flex-shrink: 0;
}

.screen-cover {
    width: 60px;
    height: 90px;
    object-fit: cover;
    border-radius: 6px;
    background: var(--bg-tertiary);
    flex-shrink: 0;
}

.screen-info {
    flex: 1;
    min-width: 0;
}

.screen-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: -0.3px;
}

.screen-author {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 2px;
    font-weight: 400;
}

.screen-year {
    font-size: 13px;
    color: var(--text-tertiary);
    font-weight: 400;
}

/* Manual Entry Button */
.btn-manual-entry {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    margin-top: 16px;
    background: var(--bg-secondary);
    border: 2px dashed var(--separator);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn-manual-entry:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--bg-tertiary);
}

.btn-manual-entry:active {
    transform: scale(0.98);
    opacity: 0.8;
}

.btn-manual-entry svg {
    flex-shrink: 0;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 20px;
    right: 20px;
    left: auto;
    display: flex;
    background: rgba(28, 28, 30, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 0.5px solid var(--separator);
    border-radius: 32px;
    padding: 8px 24px;
    z-index: 1000;
    width: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    gap: 24px;
}

@media (orientation: landscape) {
    .bottom-nav {
        bottom: 20px;
        right: calc(20px + env(safe-area-inset-right, 0px));
    }
}

.nav-item {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    gap: 2px;
    min-width: 44px;
}

.nav-item svg {
    width: 24px;
    height: 24px;
    stroke-width: 1.5;
    transition: all 0.2s ease;
}

.nav-item span {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: -0.1px;
}

.nav-item.active {
    color: var(--accent);
}

.nav-item.active svg {
    transform: translateY(-1px);
}

.nav-item:active {
    transform: scale(0.95);
    opacity: 0.6;
}

/* Content */
.content {
    flex: 1;
    padding: 16px;
    position: relative;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Filter section for Books view */
.filter-section {
    padding: 12px 16px;
    margin: -16px -16px 16px -16px;
    border-bottom: 0.5px solid var(--separator);
}

.filter-section .search-bar {
    margin-bottom: 12px;
}

.search-input {
    width: 100%;
    padding: 10px 14px;
    padding-right: 40px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 15px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.search-input::placeholder {
    color: var(--text-tertiary);
}

.search-input:focus {
    outline: none;
    background: var(--bg-tertiary);
}

.tag-filters {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tag-filters::-webkit-scrollbar {
    display: none;
}

.tag-filter {
    flex-shrink: 0;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 18px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.tag-filter:active {
    transform: scale(0.96);
    opacity: 0.8;
}

.tag-filter.active {
    background: var(--accent);
    color: #ffffff;
}

.tag-separator {
    display: inline-flex;
    align-items: center;
    color: var(--text-tertiary);
    font-size: 14px;
    padding: 0 4px;
    flex-shrink: 0;
}

.tag-filter.manual-tag {
    background: var(--bg-tertiary);
}

.tag-filter.manual-tag.active {
    background: #ff9500;
    color: #ffffff;
}

.screen-list {
    display: block;
    min-height: 100%;
}

.screen-list.empty::after {
    content: 'No screens';
    display: block;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 16px;
    font-weight: 400;
    padding: 80px 20px;
}

.screen-card {
    display: flex;
    gap: 14px;
    padding: 14px;
    background: var(--bg-secondary);
    border-radius: 14px;
    margin-bottom: 10px;
    border: none;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.screen-card:active {
    background: var(--bg-tertiary);
    transform: scale(0.98);
}

.screen-card .screen-cover {
    width: 80px;
    height: 120px;
}

.screen-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.screen-card-header {
    flex: 1;
}

.screen-card .screen-title {
    font-size: 17px;
    margin-bottom: 4px;
    white-space: normal;
    letter-spacing: -0.4px;
    line-height: 1.3;
}

.screen-card .screen-author {
    font-size: 15px;
    margin-bottom: 6px;
}

.screen-description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-top: 8px;
}

.screen-card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.action-group {
    display: flex;
    gap: 4px;
}

.btn {
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    -webkit-tap-highlight-color: transparent;
    min-height: 36px;
}

.btn:active {
    transform: scale(0.95);
    opacity: 0.7;
    transition: transform 0.05s;
}

.btn-danger {
    background: #ff453a;
    color: var(--text-primary);
}

.btn-danger:hover {
    background: #ff6961;
}

.btn-primary {
    background: var(--accent);
    color: var(--text-primary);
}

.btn-primary:active {
    background: var(--accent-hover);
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-icon {
    padding: 8px;
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon svg {
    display: block;
}

.btn-icon.active {
    background: var(--accent);
    color: var(--text-primary);
    cursor: default;
}

.btn-icon.active:active {
    transform: none;
    opacity: 1;
}

.btn-icon:disabled {
    pointer-events: none;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(84, 84, 88, 0.4);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(84, 84, 88, 0.6);
}

/* Loading state */
.loading {
    text-align: center;
    padding: 24px;
    color: var(--text-tertiary);
    font-size: 15px;
    font-weight: 400;
}

/* Error message */
.error-message {
    text-align: center;
    padding: 24px;
    color: #ff453a;
    font-size: 15px;
    font-weight: 500;
    background: rgba(255, 69, 58, 0.1);
    border-radius: 12px;
    margin: 8px 0;
    line-height: 1.5;
}

/* Keyboard open state */
body.keyboard-open .bottom-nav {
    display: none;
}

/* Settings View */
.settings-content {
    max-width: 500px;
    margin: 0 auto;
}

.settings-section {
    background: var(--bg-secondary);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 16px;
}

.settings-section h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.settings-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 20px;
}

.settings-description a {
    color: var(--accent);
    text-decoration: none;
}

.settings-description a:active {
    opacity: 0.7;
}

.settings-field {
    margin-bottom: 20px;
}

.settings-field label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.settings-field input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    transition: background 0.2s ease;
}

.settings-field input:focus {
    background: var(--bg-primary);
}

.field-hint {
    display: block;
    font-size: 13px;
    color: var(--text-tertiary);
    margin-top: 6px;
}

.btn-primary {
    background: var(--accent);
    color: var(--text-primary);
    margin-right: 8px;
}

.btn-primary:active {
    background: var(--accent-hover);
}

.sync-status {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.status-message-text {
    flex: 1;
}

.status-dismiss-btn {
    background: none;
    border: none;
    color: inherit;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.status-dismiss-btn:hover {
    opacity: 1;
}

.status-dismiss-btn:active {
    opacity: 0.5;
}

.sync-info {
    background: rgba(10, 132, 255, 0.1);
    color: var(--accent);
}

.sync-success {
    background: rgba(52, 199, 89, 0.1);
    color: #34c759;
}

.sync-error {
    background: rgba(255, 69, 58, 0.1);
    color: #ff453a;
}

/* Rating Styles */
.screen-rating {
    font-size: 14px;
    color: var(--accent);
    font-weight: 600;
    margin-top: 4px;
}

.detail-rating {
    margin: 16px 0;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 10px;
}

.detail-rating label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.star-rating {
    display: flex;
    gap: 8px;
    align-items: center;
}

.star {
    font-size: 32px;
    cursor: pointer;
    color: var(--text-tertiary);
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.star:active {
    transform: scale(0.9);
}

.star.filled {
    color: var(--accent);
}

.star:hover {
    transform: scale(1.1);
}

/* Tags Styles */
.screen-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.tag-badge {
    display: inline-block;
    padding: 3px 8px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    color: var(--accent);
}

.detail-tags {
    margin: 16px 0;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 10px;
}

.detail-tags label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    font-size: 13px;
    color: var(--accent);
    font-weight: 500;
}

.tag-remove {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.tag-remove:hover {
    color: var(--text-primary);
}

.tag-remove:active {
    transform: scale(0.9);
}

.tag-input {
    flex: 1;
    min-width: 120px;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: background 0.2s ease;
}

.tag-input:focus {
    background-color: var(--bg-primary);
}

.tag-input::placeholder {
    color: var(--text-tertiary);
}

.tag-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
    margin-top: 8px;
}

.tag-suggestions-panel {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    margin-top: 8px;
    border: 1px solid var(--separator);
    width: 100%;
}

.tag-suggestions-panel.visible {
    display: flex;
    animation: slideIn 0.2s ease;
}

.suggestion-chip {
    padding: 6px 12px;
    background: var(--bg-secondary);
    border-radius: 16px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    border: 1px solid var(--separator);
    transition: all 0.2s ease;
}

.suggestion-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--bg-primary);
}

/* Sort Controls */
.sort-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-right: 20px;
}

.sort-select {
    padding: 6px 10px;
    background: var(--bg-secondary);
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.sort-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-sort {
    width: 32px;
    height: 32px;
    background: var(--bg-secondary);
    border: none;
    border-radius: 8px;
    color: var(--accent);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.btn-sort:active {
    transform: scale(0.95);
    background: var(--bg-tertiary);
}

.btn-sort:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    .settings-section {
        padding: 16px;
    }
    
    .settings-section h2 {
        font-size: 18px;
    }
    
    .star-rating {
        gap: 4px;
    }
    
    .star {
        font-size: 28px;
    }
}

/* Book Detail Modal */
.screen-detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding-top: calc(20px + env(safe-area-inset-top));
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    padding-left: calc(20px + env(safe-area-inset-left));
    padding-right: calc(20px + env(safe-area-inset-right));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.screen-detail-modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 20px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    padding: 24px;
    animation: modalSlideIn 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 18px;
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 1;
    -webkit-tap-highlight-color: transparent;
}

.modal-close:active {
    transform: scale(0.9);
    background: var(--bg-primary);
}

.detail-cover-container {
    text-align: center;
    margin-bottom: 24px;
}

.detail-cover {
    max-width: 200px;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 8px 24px var(--shadow);
}

.detail-info {
    padding: 0 8px;
}

.detail-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.8px;
    margin-bottom: 8px;
    line-height: 1.2;
}

.detail-author {
    font-size: 19px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.detail-year {
    font-size: 15px;
    color: var(--text-tertiary);
    margin-bottom: 16px;
}

.detail-isbn {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-bottom: 16px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    display: inline-block;
}

.detail-actions {
    display: flex;
    gap: 8px;
    margin: 16px 0;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    justify-content: space-between;
    align-items: center;
}

.detail-actions .action-group {
    display: flex;
    gap: 4px;
}

.detail-actions .btn-icon {
    min-width: 44px;
    min-height: 44px;
}

.action-button-with-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.button-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.detail-description {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

/* Edit mode styles */
.edit-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--separator);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 17px;
    font-family: inherit;
    margin-bottom: 12px;
    outline: none;
    transition: border-color 0.2s;
}

.edit-input:focus {
    border-color: var(--accent);
}

.edit-title {
    font-size: 20px;
    font-weight: 600;
}

.edit-textarea {
    width: 100%;
    min-height: 120px;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--separator);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    line-height: 1.6;
    margin-bottom: 12px;
    outline: none;
    resize: vertical;
    transition: border-color 0.2s;
}

.edit-textarea:focus {
    border-color: var(--accent);
}

.detail-cover-container .edit-input {
    margin-top: 12px;
    font-size: 13px;
}

.btn-small {
    padding: 8px 16px;
    background: var(--accent);
    color: var(--text-primary);
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-small:active {
    opacity: 0.8;
}

@media (max-width: 480px) {
    .modal-content {
        padding: 20px;
        border-radius: 16px;
    }

    .detail-title {
        font-size: 24px;
    }

    .detail-author {
        font-size: 17px;
    }
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.screen-card, .search-result-item {
    animation: slideIn 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Mobile responsiveness */
@media (max-width: 480px) {
    .header h1 {
        font-size: 32px;
    }
    
    .content {
        padding: 12px;
    }
    
    .search-container {
        padding: 12px;
    }
    
    .screen-card {
        padding: 12px;
    }
    
    .screen-card-actions {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .btn-small {
        padding: 7px 10px;
        font-size: 13px;
        flex: 1 1 auto;
        min-width: 70px;
    }
}

/* iPhone notch and safe areas */
@supports (padding: max(0px)) {
    .app {
        padding-bottom: max(65px, env(safe-area-inset-bottom));
    }
}

/* Landscape mode - iPhone */
@media (max-height: 500px) and (orientation: landscape) {
    .app {
        max-width: none;
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    
    .header {
        padding-left: 0;
        padding-right: 0;
    }
    
    .header h1 {
        font-size: 24px;
        padding: 6px 16px 8px;
    }
    
    .search-container {
        padding: 16px 16px 0;
    }
    
    .filter-section {
        padding: 12px 16px;
        margin: -16px -16px 16px -16px;
    }
    
    .screen-card .screen-title {
        font-size: 17px;
    }
    
    .screen-card .screen-author {
        font-size: 15px;
    }
}

/* iPad and larger tablets - both orientations */
@media (min-width: 768px) {
    .app {
        max-width: none;
    }

    .modal-content {
        max-width: 900px;
    }
}

/* Update Banner */
.update-banner {
    position: fixed;
    top: -100px;
    left: 0;
    right: 0;
    background: var(--accent);
    color: var(--text-primary);
    z-index: 10000;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.update-banner.show {
    transform: translateY(100px);
}

.update-banner-content {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    padding-top: max(16px, env(safe-area-inset-top));
}

.update-banner-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.update-dismiss-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.update-dismiss-btn:active {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(0.95);
}

.update-banner-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.update-banner-text strong {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.update-banner-text span {
    font-size: 14px;
    opacity: 0.9;
}

.update-banner .btn {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.3);
    white-space: nowrap;
}

.update-banner .btn:active {
    background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 480px) {
    .update-banner-content {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .update-banner-actions {
        width: 100%;
    }
    
    .update-banner .btn {
        flex: 1;
    }
}

/* Add Book Button (Search Detail) */
.btn-add-book {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 12px 0;
    background: var(--accent);
    color: var(--text-primary);
    border: none;
    border-radius: 32px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 24px;
    margin-bottom: 24px;
}

.btn-add-book span {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: -0.1px;
}

.btn-add-book svg {
    width: 20px;
    height: 20px;
}

.btn-add-book:active {
    transform: scale(0.98);
    opacity: 0.9;
}

/* Pill Selector Container */
.action-group-pill {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    margin-bottom: 24px;
    width: 100%;
}

/* Pill Selector */
.list-pill-selector {
    flex: 1;
    display: flex;
    background: rgba(28, 28, 30, 0.9); /* Match bottom nav bg */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 0.5px solid var(--separator);
    border-radius: 32px;
    padding: 4px;
}

.pill-segment {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 0;
    background: transparent;
    border: none;
    border-radius: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.pill-segment span {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: -0.1px;
}

.pill-segment.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent);
}

.pill-segment svg {
    width: 20px;
    height: 20px;
}

/* Delete Circle Button */
.btn-delete-circle {
    width: 56px; /* Increased to match taller pill selector */
    height: 56px;
    border-radius: 50%;
    background: rgba(255, 69, 58, 0.15); /* Red tint */
    color: #ff453a; /* Red */
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-delete-circle:active {
    transform: scale(0.9);
    background: rgba(255, 69, 58, 0.25);
}

/* Detail Header Layout (Side-by-Side) */
.detail-header-layout {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 8px;
}

.detail-cover-wrapper {
    flex-shrink: 0;
    width: 110px;
}

.detail-cover-wrapper .detail-cover {
    width: 100%;
    max-width: none;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow);
    margin-bottom: 0;
}

.detail-metadata {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: 4px;
    padding-right: 40px; /* Prevent overlap with close button */
}

.detail-metadata .detail-title {
    font-size: 22px;
    margin-bottom: 4px;
    line-height: 1.3;
}

.detail-metadata .detail-author {
    font-size: 17px;
    margin-bottom: 4px;
}

.detail-metadata .detail-year {
    font-size: 15px;
    color: var(--text-tertiary);
    margin-bottom: 8px;
}

.detail-metadata .detail-isbn {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-bottom: 8px;
}

/* Adjust rating and tags in metadata */
.detail-metadata .detail-rating {
    margin-top: 4px;
    margin-bottom: 8px;
}

.detail-metadata .detail-tags {
    margin-top: 4px;
    margin-bottom: 8px;
}

/* Larger screens adjustments */
@media (min-width: 768px) {
    .detail-cover-wrapper {
        width: 140px;
    }
    
    .detail-metadata .detail-title {
        font-size: 28px;
    }
    
    .detail-metadata .detail-author {
        font-size: 20px;
    }
}

/* Edit Circle Button */
.btn-edit-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-edit-circle:active {
    transform: scale(0.9);
    background: var(--separator);
}
