* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #eee;
}
.container {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: 25%;
    background: #fff;
    padding: 20px;
    border-right: 1px solid #eee;
    overflow-y: auto;
    max-height: 100vh;
    position: sticky;
    top: 0;
    align-self: flex-start;
}
.sidebar h2 {
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: #17e;
}
.task-title-mobile {
    display: none;
}
.toggle-icon {
    display: none;
}
.sidebar p {
    margin-bottom: 15px;
    color: #566;
    font-size: 0.9rem;
}
.main-content {
    flex: 1;
    background: #fff;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.sidebar[style*="display: none"] + .main-content {
    width: 100%;
    max-width: 100%;
}
.content-box {
    max-width: 800px;
    width: 100%;
}
.content-box h1 {
    color: #17e;
    margin-bottom: 20px;
    font-size: 2rem;
}
.content-box p {
    margin-bottom: 15px;
    color: #566;
    font-size: 1rem;
}
button[type="submit"],
.btn {
    padding: 12px 24px;
    background: #17e;
    color: #fff;
    border: none;
    border-radius: 24px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-top: 20px;
}
button[type="submit"]:hover,
.btn:hover {
    background: #15b;
}
button[type="submit"]:disabled,
.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}
form {
    width: 100%;
}
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}
.form-group input[type="text"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}
.form-group textarea {
    min-height: 100px;
    resize: vertical;
}
.form-group input[type="radio"],
.form-group input[type="checkbox"] {
    margin-right: 8px;
}
.browser {
    flex: 1;
    background: #fff;
    display: flex;
    flex-direction: column;
}
.browser-header {
    background: #eee;
    border-bottom: 1px solid #ddd;
    padding: 12px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.search-container {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}
.search-box {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    background: #fff;
}
.search-box:focus {
    border-color: #17e;
    box-shadow: 0 2px 8px rgba(17, 119, 238, 0.2);
}
.back-container {
    max-width: 600px;
    margin: 0 auto;
}
.back-button {
    padding: 12px 24px;
    background: #17e;
    color: #fff;
    border: none;
    border-radius: 24px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.back-button:hover {
    background: #15b;
}
.browser-content {
    flex: 1;
    padding: 20px;
}
.serp-container {
    max-width: 600px;
}
.ai-overview {
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
}
.ai-overview h3 {
    color: #17e;
    font-size: 1.1rem;
    margin-bottom: 12px;
}
.ai-overview-container {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 400px;
    gap: 20px;
    max-width: 1000px;
    max-height: 200px;
    overflow: hidden;
    position: relative;
}
.ai-overview.expanded .ai-overview-container {
    max-height: none;
    overflow: visible;
}
.ai-main-content {
    min-width: 0;
}
.ai-side-panel {
    position: sticky;
    top: 80px;
    align-self: start;
    max-height: calc(100vh - 200px);
    overflow: auto;
    background: #eee;
    border-bottom: 10px solid #eee;
    border-radius: 6px;
    padding: 8px;
}
.ai-overview-block {
    margin-bottom: 16px;
}
.ai-overview-block:last-child {
    margin-bottom: 0;
}
.ai-overview-block.hidden {
    display: none;
}
.ai-expand-btn {
    width: 100%;
    max-width: 700px;
    padding: 12px 20px;
    margin-top: 16px;
    background: #17e;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.ai-expand-btn:hover {
    background: #15b;
}
.block-filter-btn {
    display: inline-block;
    background: #17e;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 4px 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-left: 5px;
}
.block-filter-btn.q-variant {
    font-size: 10px;
    font-weight: bold;
}
.block-filter-btn.arrow-variant {
    font-size: 12px;
    font-weight: bold;
}
.block-filter-btn.circles-variant {
    font-size: 8px;
    letter-spacing: -2px;
}
.block-filter-btn:hover {
    background: #15b;
}
.block-filter-btn.active {
    background: #3a5;
}
.show-all-sources-btn {
    display: inline-block;
    background: #17e;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 4px 8px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.show-all-sources-btn:hover {
    background: #15b;
}
.reference-card {
    display: flex;
    gap: 12px;
    padding: 12px;
    margin-bottom: 12px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}
.reference-card:hover {
    background: #eee;
    border-color: #17e;
    text-decoration: none;
    color: inherit;
}
.reference-content {
    flex: 1;
    min-width: 0;
}
.reference-content h3 {
    margin: 0 0 8px 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #17e;
    line-height: 1.3;
}
.reference-content .snippet {
    margin: 0 0 8px 0;
    font-size: 0.8rem;
    color: #566;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.reference-content .source {
    font-size: 0.75rem;
    color: #062;
    font-weight: 500;
    background-repeat: no-repeat;
    padding-left: 20px;
}
.ai-list {
    margin: 12px 0;
}
.ai-list-item {
    margin-bottom: 12px;
    padding-left: 16px;
    position: relative;
}
.ai-list-item:before {
    content: "•";
    position: absolute;
    left: 0;
    color: #566;
}
.ai-list-item-title {
    font-weight: 600;
    margin-bottom: 4px;
}
.ai-list-item-content {
    color: #566;
    margin-bottom: 8px;
}
.show-more-btn {
    width: 100%;
    max-width: 600px;
    padding: 12px 20px;
    margin-top: 24px;
    background: #17e;
    color: #fff;
    border: none;
    border-radius: 24px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.show-more-btn:hover {
    background: #15b;
}
.serp-result {
    margin-bottom: 32px;
    cursor: pointer;
}
.serp-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.serp-result:hover .serp-title {
    text-decoration: underline;
}
.serp-sourcename {
    color: #000;
    font-size: 0.875rem;
}
.serp-url {
    color: #062;
    font-size: 0.775rem;
    margin-bottom: 4px;
}
.serp-title {
    color: #10a;
    font-size: 1.225rem;
    font-weight: normal;
    text-decoration: none;
}
.serp-snippet {
    color: #455;
    font-size: 0.875rem;
}
.landing-page {
    max-width: 800px;
}
pagebody {
    min-height: 400px;
    overflow: hidden;
    display: block;
}
.hidden {
    display: none;
}
.loading {
    text-align: center;
    padding: 40px;
    color: #566;
}
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 32px;
    padding: 20px 0;
}
.pagination button {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.pagination button:hover:not(:disabled) {
    background: #f8f9fa;
    border-color: #17e;
}
.pagination button.active {
    background: #17e;
    color: white;
    border-color: #17e;
}
.pagination button:disabled {
    background: #f8f9fa;
    color: #999;
    cursor: not-allowed;
    border-color: #eee;
}
.pagination-info {
    color: #666;
    font-size: 14px;
    margin: 0 16px;
}
.checklist-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.checklist-modal.active {
    display: flex;
}
.checklist-popup {
    background: #fff;
    border-radius: 12px;
    max-width: 90%;
    max-height: 90vh;
    width: 800px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}
.checklist-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
    background: #f9f9f9;
}
.checklist-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}
.checklist-close:hover {
    background: #e0e0e0;
    color: #333;
}
.checklist-content {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}
.references-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.references-modal.active {
    display: flex;
}
.references-popup {
    background: #fff;
    border-radius: 12px;
    max-width: 90%;
    max-height: 90vh;
    width: 600px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}
.references-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
    background: #f9f9f9;
}
.references-header h3 {
    margin: 0;
    color: #17e;
    font-size: 1.2rem;
}
.references-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}
.references-close:hover {
    background: #e0e0e0;
    color: #333;
}
.references-content {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}
.error {
    color: #e33;
    margin-bottom: 10px;
}
.content-box ul {
    margin-left: 0;
    list-style: none;
}
@media (max-width: 768px) {
    body.page-serp {
        display: flex;
        flex-direction: column;
        height: 100vh;
        overflow: hidden;
    }
    body.page-serp .container {
        flex-direction: column;
        flex: 1;
        display: flex;
        overflow: hidden;
    }
    body.page-serp .sidebar {
        width: 100%;
        max-height: none;
        position: relative;
        flex-shrink: 0;
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto;
        gap: 10px 10px;
    }
    body.page-serp .browser {
        flex: 1;
        overflow-y: auto;
    }
    body.page-serp .sidebar h2 {
        grid-column: 1;
        grid-row: 1;
        margin-bottom: 0;
        font-size: 1rem;
        align-self: center;
        cursor: pointer;
        user-select: none;
    }
    body.page-serp .task-title-desktop {
        display: none;
    }
    body.page-serp .task-title-mobile {
        display: inline;
    }
    body.page-serp .toggle-icon {
        font-size: 0.8em;
        display: inline-block !important;
        transition: transform 0.2s ease;
        margin-left: 5px;
    }
    body.page-serp .sidebar form {
        grid-column: 2;
        grid-row: 1;
        margin: 0;
    }
    body.page-serp .sidebar form button[type="submit"] {
        margin-top: 0;
        padding: 8px 16px;
        font-size: 14px;
        white-space: nowrap;
    }
    body.page-serp .task-instructions {
        grid-column: 1 / -1;
        grid-row: 2;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    body.page-serp .task-instructions.expanded {
        max-height: 1000px;
    }
    body.page-serp .task-instructions p:first-child {
        margin-top: 10px;
    }
    body.page-quest .container {
        flex-direction: column;
    }
    body.page-quest .sidebar {
        width: 100%;
    }
    body.page-quest .main-content {
        padding: 20px;
    }
    body.page-explainer .container {
        flex-direction: column;
    }
    body.page-explainer .sidebar {
        width: 100%;
    }
    body.page-explainer .main-content {
        padding: 20px;
    }
    .container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
    }
    .main-content {
        padding: 20px;
    }
    .ai-overview-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .ai-side-panel {
        position: relative;
        top: 0;
    }
    .browser-content {
        padding: 15px;
    }
    .serp-container {
        max-width: 100%;
    }
    .checklist-popup {
        max-width: 95%;
        max-height: 85vh;
    }
  :root { --safe-bottom: env(safe-area-inset-bottom, 0px); }
  body.page-serp {
    height: 100vh;
    height: 100dvh;
  }
  body.page-serp .container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
  }
  body.page-serp .browser {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
  }
  body.page-serp .browser-content {
    padding-bottom: calc(24px + var(--safe-bottom));
  }
  .checklist-popup {
    max-height: 85vh;
    max-height: 85dvh;
  }
  .references-popup {
    max-height: 90vh;
    max-height: 90dvh;
  }
}
