/* ===================================================================
   OTWP Quiz – Frontend Styles
   =================================================================== */

:root {
    --otwp-red: #c61f26;
    --otwp-red-dark: #99151b;
    --otwp-ink: #20242b;
    --otwp-muted: #5d6776;
    --otwp-line: #d8dee9;
    --otwp-panel: #ffffff;
    --otwp-soft: #f4f6fa;
    --otwp-green: #16a34a;
    --otwp-green-light: #dcfce7;
    --otwp-red-light: #fee2e2;
    --otwp-shadow: 0 10px 30px rgba(26, 32, 44, 0.08);
    --otwp-radius: 14px;
}

/* ---- App container ---- */
.otwp-app {
    max-width: 860px;
    margin: 24px auto 48px;
    padding: 0 16px;
    font-family: "Segoe UI", Arial, Helvetica, sans-serif;
    color: var(--otwp-ink);
    line-height: 1.5;
}

.otwp-app *,
.otwp-app *::before,
.otwp-app *::after {
    box-sizing: border-box;
}

/* ---- Screen visibility ---- */
.otwp-screen {
    animation: otwpFadeIn 0.3s ease;
}

@keyframes otwpFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===== START SCREEN ===== */

.otwp-hero {
    text-align: center;
    padding: 32px 16px 16px;
}

.otwp-hero-title {
    font-size: 28px;
    font-weight: 800;
    margin: 0 0 8px;
    color: var(--otwp-ink);
}

.otwp-hero-sub {
    font-size: 16px;
    color: var(--otwp-muted);
    margin: 0;
}

/* Options */
.otwp-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 24px 0;
}

@media (max-width: 600px) {
    .otwp-options-grid {
        grid-template-columns: 1fr;
    }
}

.otwp-option-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.otwp-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--otwp-muted);
}

.otwp-label-note {
    font-size: 10px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    opacity: 0.7;
}

.otwp-select {
    border: 1.5px solid var(--otwp-line);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 15px;
    font-weight: 600;
    background: var(--otwp-panel);
    color: var(--otwp-ink);
    cursor: pointer;
    appearance: auto;
}

/* Mode cards */
.otwp-mode-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 24px 0;
}

@media (max-width: 600px) {
    .otwp-mode-cards {
        grid-template-columns: 1fr;
    }
}

.otwp-mode-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    border: 2px solid var(--otwp-line);
    border-radius: var(--otwp-radius);
    padding: 28px 20px;
    background: var(--otwp-panel);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    box-shadow: var(--otwp-shadow);
    font-family: inherit;
    color: var(--otwp-ink);
}

.otwp-mode-card:hover,
.otwp-mode-card:focus {
    border-color: var(--otwp-red);
    box-shadow: 0 6px 24px rgba(198, 31, 38, 0.12);
    transform: translateY(-2px);
    outline: none;
}

.otwp-mode-icon {
    font-size: 36px;
}

.otwp-mode-title {
    font-size: 18px;
    font-weight: 800;
}

.otwp-mode-desc {
    font-size: 14px;
    color: var(--otwp-muted);
}

/* ===== LOADING ===== */

.otwp-loader {
    text-align: center;
    padding: 80px 20px;
    color: var(--otwp-muted);
    font-weight: 600;
}

.otwp-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--otwp-line);
    border-top-color: var(--otwp-red);
    border-radius: 50%;
    animation: otwpSpin 0.7s linear infinite;
    margin: 0 auto 16px;
}

@keyframes otwpSpin {
    to { transform: rotate(360deg); }
}

/* ===== TOOLBAR ===== */

.otwp-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.otwp-progress-text {
    font-size: 14px;
    font-weight: 700;
    color: var(--otwp-muted);
}

.otwp-timer {
    margin-left: auto;
    font-size: 16px;
    font-weight: 800;
    color: var(--otwp-red);
    font-variant-numeric: tabular-nums;
}

/* ===== BUTTONS ===== */

.otwp-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1.5px solid var(--otwp-line);
    border-radius: 12px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    background: var(--otwp-panel);
    color: var(--otwp-ink);
    font-family: inherit;
}

.otwp-btn:hover {
    border-color: var(--otwp-ink);
}

.otwp-btn-primary {
    background: linear-gradient(180deg, var(--otwp-red), var(--otwp-red-dark));
    color: #fff;
    border-color: transparent;
}

.otwp-btn-primary:hover {
    opacity: 0.9;
    border-color: transparent;
}

.otwp-btn-accent {
    background: linear-gradient(180deg, var(--otwp-red), var(--otwp-red-dark));
    color: #fff;
    border-color: transparent;
    font-size: 16px;
    padding: 12px 24px;
}

.otwp-btn-outline {
    background: transparent;
}

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

.otwp-nav-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}

/* ===== QUESTION CARD ===== */

.otwp-card {
    background: var(--otwp-panel);
    border: 1px solid var(--otwp-line);
    border-left: 5px solid var(--otwp-red);
    border-radius: var(--otwp-radius);
    padding: 20px 24px;
    box-shadow: var(--otwp-shadow);
    position: relative;
}

.otwp-q-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--otwp-red);
    color: #fff;
    font-weight: 800;
    font-size: 16px;
    margin-bottom: 12px;
}

.otwp-q-text {
    font-size: 17px;
    font-weight: 800;
    line-height: 1.4;
    margin-bottom: 16px;
}

/* Disable text selection in try mode to deter copy-paste */
#otwp-try .otwp-q-text,
#otwp-try .otwp-answer-btn {
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
}

/* Answers */
.otwp-answers-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.otwp-answer-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1.5px solid var(--otwp-line);
    border-radius: 10px;
    padding: 12px 16px;
    background: var(--otwp-panel);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    text-align: left;
    font-family: inherit;
    font-size: 15px;
    color: var(--otwp-ink);
    width: 100%;
}

.otwp-answer-btn:hover {
    border-color: var(--otwp-red);
    background: #fff5f5;
}

.otwp-answer-btn.selected {
    border-color: var(--otwp-red);
    background: #fff5f5;
    font-weight: 700;
}

.otwp-answer-btn.correct {
    border-color: var(--otwp-green);
    background: var(--otwp-green-light);
}

.otwp-answer-btn.wrong {
    border-color: #dc2626;
    background: var(--otwp-red-light);
}

.otwp-answer-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--otwp-soft);
    font-weight: 800;
    font-size: 14px;
    flex-shrink: 0;
}

.otwp-answer-btn.selected .otwp-answer-letter {
    background: var(--otwp-red);
    color: #fff;
}

.otwp-answer-btn.correct .otwp-answer-letter {
    background: var(--otwp-green);
    color: #fff;
}

.otwp-answer-btn.wrong .otwp-answer-letter {
    background: #dc2626;
    color: #fff;
}

/* Learn correct indicator */
.otwp-learn-correct {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 10px;
    background: var(--otwp-green-light);
    border: 1.5px solid var(--otwp-green);
    font-weight: 700;
    color: #166534;
    display: none;
}

.otwp-learn-correct.visible {
    display: block;
}

.otwp-learn-correct.wrong {
    background: var(--otwp-red-light);
    border-color: var(--otwp-red);
    color: var(--otwp-red-dark);
}

/* Flag button – inline below answers */
.otwp-flag-btn {
    align-self: flex-start;
    background: none;
    border: 1px solid var(--otwp-line);
    border-radius: 6px;
    color: var(--otwp-muted);
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    padding: 5px 10px;
    margin-top: 6px;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.otwp-flag-btn:hover {
    border-color: var(--otwp-red);
    color: var(--otwp-red);
    background: #fff0f0;
}

/* Resign modal – cheat warning notice */
.otwp-resign-cheat-notice {
    margin: 10px 0 4px;
    padding: 10px 14px;
    background: #fffbeb;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    font-size: 13px;
    color: #92400e;
    line-height: 1.4;
}

/* ===== RESULTS ===== */

.otwp-results-hero {
    text-align: center;
    padding: 32px 16px;
    background: var(--otwp-panel);
    border-radius: var(--otwp-radius);
    border: 1px solid var(--otwp-line);
    box-shadow: var(--otwp-shadow);
    margin-bottom: 24px;
}

.otwp-results-hero h2 {
    font-size: 22px;
    margin: 0 0 12px;
}

.otwp-results-score {
    font-size: 48px;
    font-weight: 800;
    color: var(--otwp-red);
}

.otwp-results-percent {
    font-size: 20px;
    font-weight: 700;
    color: var(--otwp-muted);
    margin-bottom: 8px;
}

.otwp-results-message {
    font-size: 16px;
    margin-top: 8px;
}

.otwp-results-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.otwp-result-row {
    display: grid;
    grid-template-columns: 38px 1fr;
    gap: 12px;
    border: 1px solid var(--otwp-line);
    border-radius: 10px;
    padding: 12px 16px;
    background: var(--otwp-panel);
}

.otwp-result-row.is-correct {
    border-left: 5px solid var(--otwp-green);
}

.otwp-result-row.is-wrong {
    border-left: 5px solid #dc2626;
}

.otwp-result-no {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    color: #fff;
}

.otwp-result-row.is-correct .otwp-result-no {
    background: var(--otwp-green);
}

.otwp-result-row.is-wrong .otwp-result-no {
    background: #dc2626;
}

.otwp-result-text {
    font-weight: 700;
    margin-bottom: 4px;
}

.otwp-result-info {
    font-size: 13px;
    color: var(--otwp-muted);
}

/* ===== MODAL ===== */

.otwp-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    padding: 16px;
}

.otwp-modal-content {
    background: var(--otwp-panel);
    border-radius: var(--otwp-radius);
    padding: 28px;
    max-width: 480px;
    width: 100%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.otwp-modal-content h3 {
    margin: 0 0 8px;
    font-size: 20px;
}

.otwp-modal-content p {
    color: var(--otwp-muted);
    margin: 0 0 16px;
    font-size: 14px;
}

.otwp-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--otwp-muted);
    padding: 4px;
}

.otwp-textarea {
    width: 100%;
    border: 1.5px solid var(--otwp-line);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

.otwp-modal-actions {
    margin-top: 12px;
}

.otwp-flag-message {
    margin-top: 10px;
    font-size: 14px;
    font-weight: 600;
}

.otwp-flag-message.success {
    color: var(--otwp-green);
}

.otwp-flag-message.error {
    color: #dc2626;
}

/* ---- Empty-group notice ---- */
.otwp-empty-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #fffbeb;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 16px 20px;
    margin: 0 0 20px;
    font-size: 14px;
    line-height: 1.5;
}

.otwp-empty-icon {
    font-size: 22px;
    flex-shrink: 0;
    line-height: 1;
}

.otwp-empty-notice strong {
    display: block;
    font-size: 15px;
    margin-bottom: 4px;
    color: #92400e;
}

.otwp-empty-notice p {
    margin: 0;
    color: #78350f;
}

/* ---- Disabled mode card ---- */
.otwp-mode-card--disabled,
.otwp-mode-card:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* ===== HERO LOGO ===== */

.otwp-hero-logo {
    display: block;
    max-height: 120px;
    max-width: 120px;
    width: auto;
    height: auto;
    margin: 0 auto 16px;
    object-fit: contain;
}

/* ===== RESULTS TIME ===== */

.otwp-results-time {
    font-size: 15px;
    font-weight: 700;
    color: var(--otwp-muted);
    margin-top: 4px;
    margin-bottom: 4px;
}

/* ===== LEADERBOARD LINK (start screen) ===== */

.otwp-leaderboard-link {
    text-align: center;
    margin: 12px 0 0;
    font-size: 14px;
    font-weight: 600;
}

.otwp-lb-link-icon {
    margin-right: 4px;
}

.otwp-lb-anchor {
    color: var(--otwp-red);
    text-decoration: none;
}

.otwp-lb-anchor:hover {
    text-decoration: underline;
}

.otwp-lb-anchor-btn {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: inherit;
    color: var(--otwp-red);
    cursor: pointer;
    text-decoration: underline;
}

/* ===== INLINE RANKING SECTION (below mode cards) ===== */
.otwp-inline-ranking-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 2px solid var(--otwp-line);
}

.otwp-inline-ranking-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.otwp-inline-ranking-head .otwp-lb-link-icon {
    font-size: 30px;
    line-height: 1;
}

.otwp-inline-ranking-title {
    margin: 0 0 2px;
    font-size: 18px;
    font-weight: 700;
    color: var(--otwp-ink);
}

.otwp-inline-ranking-head .otwp-lb-sub {
    margin: 0;
    font-size: 12px;
    opacity: 0.65;
}

.otwp-lb-app--inline {
    margin: 0;
    padding: 0;
    max-width: none;
    box-shadow: none;
    border-radius: 0;
    background: transparent;
}

/* ===== TIMER STATES ===== */

.otwp-timer--warning {
    color: #d97706; /* amber */
    animation: otwpTimerPulse 2s ease infinite;
}

.otwp-timer--danger {
    color: #dc2626; /* red */
    animation: otwpTimerPulse 0.8s ease infinite;
}

@keyframes otwpTimerPulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.55; }
}

/* ===== NICKNAME MODAL ===== */

.otwp-nickname-trophy {
    font-size: 48px;
    text-align: center;
    margin-bottom: 8px;
}

.otwp-nickname-field {
    width: 100%;
    border: 2px solid var(--otwp-line);
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.2s;
    margin-bottom: 4px;
    outline: none;
}

.otwp-nickname-field:focus {
    border-color: var(--otwp-red);
}

.otwp-nickname-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.otwp-nickname-hint {
    margin: 10px 0 0;
    font-size: 13px;
    color: var(--otwp-muted);
    background: #f4f6fa;
    border-radius: 8px;
    padding: 8px 12px;
}

/* ===== LEADERBOARD SHORTCODE ===== */

/* ===== LEADERBOARD ===== */

.otwp-lb-app {
    max-width: 1160px;
}

.otwp-lb-header {
    text-align: center;
    padding: 24px 16px 16px;
}

.otwp-lb-title {
    font-size: 26px;
    font-weight: 800;
    margin: 0 0 6px;
    color: var(--otwp-ink);
}

.otwp-lb-sub {
    font-size: 15px;
    color: var(--otwp-muted);
    margin: 0 0 24px;
}

/* ---- 3-column grid ---- */
.otwp-lb-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

@media (max-width: 860px) {
    .otwp-lb-columns {
        grid-template-columns: 1fr;
    }
}

.otwp-lb-column {
    background: var(--otwp-panel);
    border: 1px solid var(--otwp-line);
    border-radius: var(--otwp-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.otwp-lb-col-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--otwp-soft);
    border-bottom: 3px solid var(--otwp-red);
    color: var(--otwp-ink);
}

.otwp-lb-col-trophy {
    font-size: 26px;
    line-height: 1;
    flex-shrink: 0;
}

.otwp-lb-col-title {
    font-size: 16px;
    font-weight: 800;
    margin: 0;
    line-height: 1.1;
    color: var(--otwp-ink);
}

.otwp-lb-col-sub {
    font-size: 11px;
    color: var(--otwp-muted);
}

.otwp-lb-col-content {
    flex: 1;
    padding: 10px 12px;
}

/* ---- Podium (top 3) – vertical rows ---- */
.otwp-lb-podium {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.otwp-lb-podium-card {
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 10px;
    padding: 10px 12px;
    border: 2px solid transparent;
    transition: transform 0.15s;
}

.otwp-lb-podium-card:hover {
    transform: translateY(-2px);
}

.otwp-lb-gold {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border-color: #fbbf24;
}

.otwp-lb-silver {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border-color: #94a3b8;
}

.otwp-lb-bronze {
    background: linear-gradient(135deg, #fef9f0, #fde8c8);
    border-color: #f59e0b;
}

.otwp-lb-podium-medal {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
}

.otwp-lb-gold .otwp-lb-podium-medal {
    font-size: 28px;
}

/* Name + rank label stacked vertically */
.otwp-lb-podium-body {
    flex: 1;
    min-width: 0; /* allow flex child to shrink below content size for truncation */
}

.otwp-lb-podium-nick {
    font-size: 14px;
    font-weight: 700;
    color: var(--otwp-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.otwp-lb-gold .otwp-lb-podium-nick {
    font-size: 15px;
}

.otwp-lb-podium-pos {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--otwp-muted);
    margin-top: 2px;
}

/* Score + time aligned right */
.otwp-lb-podium-stats {
    flex-shrink: 0;
    text-align: right;
}

.otwp-lb-podium-score {
    font-size: 13px;
    font-weight: 700;
    color: var(--otwp-ink);
}

.otwp-lb-pct {
    font-weight: 400;
    color: var(--otwp-muted);
    font-size: 11px;
}

.otwp-lb-podium-time {
    font-size: 11px;
    color: var(--otwp-muted);
    margin-top: 1px;
}

/* ---- Compact list (rank 4+) ---- */
.otwp-lb-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.otwp-lb-list-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 4px;
    border-top: 1px solid var(--otwp-line);
    font-size: 13px;
}

.otwp-lb-list-row::before {
    content: counter(list-item) ".";
    counter-increment: list-item;
    font-size: 11px;
    color: var(--otwp-muted);
    min-width: 20px;
    text-align: right;
    flex-shrink: 0;
}

.otwp-lb-list-nick {
    font-weight: 700;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.otwp-lb-list-score {
    font-size: 12px;
    color: var(--otwp-muted);
    white-space: nowrap;
}

.otwp-lb-list-time {
    font-size: 11px;
    color: var(--otwp-muted);
    white-space: nowrap;
}

/* ---- Pagination ---- */
.otwp-lb-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 0 2px;
}

.otwp-lb-page-btn {
    background: var(--otwp-soft);
    border: 2px solid var(--otwp-line);
    border-radius: 8px;
    padding: 5px 14px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
    white-space: nowrap;
}

.otwp-lb-page-btn:hover:not(:disabled) {
    border-color: var(--otwp-red);
    background: #fff0f0;
    color: var(--otwp-red);
}

.otwp-lb-page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.otwp-lb-page-info {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
    min-width: 90px;
    text-align: center;
}

/* ---- Group tabs (tabs layout) ---- */
.otwp-lb-tabs {
    display: flex;
    gap: 8px;
    margin: 0 0 20px;
    border-bottom: 2px solid var(--otwp-line);
}

.otwp-lb-tab {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 10px 18px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    color: var(--otwp-muted);
    font-family: inherit;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}

.otwp-lb-tab:hover { color: var(--otwp-red); }

.otwp-lb-tab.active {
    color: var(--otwp-red);
    border-bottom-color: var(--otwp-red);
}

/* ---- Table (widget / tabs) ---- */
.otwp-lb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin-bottom: 16px;
}

.otwp-lb-table thead tr {
    border-bottom: 2px solid var(--otwp-line);
}

.otwp-lb-table th {
    padding: 8px 10px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--otwp-muted);
}

.otwp-lb-table td {
    padding: 10px;
    border-bottom: 1px solid var(--otwp-line);
    vertical-align: middle;
}

.otwp-lb-rank { width: 36px; text-align: center; font-size: 16px; }
.otwp-lb-nick { font-weight: 700; }
.otwp-lb-time { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--otwp-muted); }
.otwp-lb-date { font-size: 12px; color: var(--otwp-muted); }

.otwp-lb-top1 { background: #fffbeb; }
.otwp-lb-top2 { background: #f8fafc; }
.otwp-lb-top3 { background: #fef9f0; }

.otwp-lb-row:last-child td { border-bottom: none; }

/* ---- Empty state ---- */
.otwp-lb-empty {
    text-align: center;
    padding: 32px 20px;
    color: var(--otwp-muted);
    font-size: 14px;
}

/* ---- Own pending notice ---- */
.otwp-lb-own-pending {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #eff6ff;
    border: 1px solid #93c5fd;
    border-radius: 8px;
    padding: 14px 18px;
    font-size: 14px;
    margin-top: 16px;
}

.otwp-lb-own-pending span { font-size: 22px; flex-shrink: 0; }

.otwp-lb-own-pending strong {
    display: block;
    font-size: 15px;
    color: #1e40af;
    margin-bottom: 2px;
}

.otwp-lb-own-pending p { margin: 0; color: #1d4ed8; }

/* ---- Widget-specific ---- */
.otwp-widget { font-family: "Segoe UI", Arial, Helvetica, sans-serif; }

.otwp-widget-title {
    font-size: 16px;
    font-weight: 800;
    margin: 0 0 12px;
    color: var(--otwp-ink);
}

.otwp-widget-ranking { }

.otwp-widget-group {
    margin-bottom: 20px;
}

.otwp-widget-group-title {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--otwp-ink);
}

.otwp-widget-group-title small {
    font-weight: 400;
    font-size: 12px;
    color: var(--otwp-muted);
}

.otwp-lb-table--widget th,
.otwp-lb-table--widget td { padding: 6px 8px; font-size: 13px; }

/* ---- Sidebar area wrapper ---- */
.otwp-sidebar-area { margin: 16px 0; }

/* ---- Tile selectors ---- */
.otwp-tile-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.otwp-tile {
    flex: 1 1 auto;
    min-width: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 14px;
    background: var(--otwp-soft);
    border: 2px solid var(--otwp-line);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
}

.otwp-tile:hover {
    border-color: var(--otwp-red);
    background: #fff0f0;
}

.otwp-tile--active {
    border-color: var(--otwp-red);
    background: var(--otwp-red);
    color: #fff;
}

.otwp-tile-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
}

.otwp-tile-sub {
    font-size: 11px;
    opacity: .8;
    line-height: 1.2;
}

/* 25-question "Rankingowy" tile */
.otwp-tile-ranking-wrap {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.otwp-tile-ranking-wrap .otwp-tile {
    width: 100%;
}

.otwp-tile--ranking {
    border-color: #b8922a;
    background: linear-gradient(160deg, #fffbeb, #fef3c7);
}

.otwp-tile--ranking:hover {
    border-color: #92700f;
    background: linear-gradient(160deg, #fef3c7, #fde68a);
}

.otwp-tile--ranking.otwp-tile--active {
    border-color: #92700f;
    background: linear-gradient(160deg, #f59e0b, #d97706);
    color: #fff;
}

.otwp-tile-ranking-badge {
    display: block;
    background: linear-gradient(90deg, #b8922a, #f59e0b, #b8922a);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

/* ---- Ranking-ineligible notice in results ---- */
.otwp-results-ineligible {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 16px;
    background: var(--otwp-red-light);
    border: 1px solid var(--otwp-red);
    border-radius: 8px;
    font-size: 13px;
    color: var(--otwp-red-dark);
    font-weight: 600;
}

/* ---- Tab-away warning overlay ---- */
.otwp-tab-warning {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.80);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: otwpFadeIn 0.2s ease;
}

.otwp-tab-warning-box {
    background: #fff;
    border-radius: 18px;
    padding: 40px 36px 32px;
    max-width: 500px;
    width: 92%;
    text-align: center;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
    border-top: 7px solid #f59e0b;
}

.otwp-tab-warning--block .otwp-tab-warning-box {
    border-top-color: var(--otwp-red);
}

.otwp-tab-warning-icon {
    font-size: 64px;
    line-height: 1;
    margin-bottom: 16px;
}

.otwp-tab-warning-title {
    font-size: 21px;
    font-weight: 800;
    color: var(--otwp-ink);
    margin: 0 0 12px;
}

.otwp-tab-warning-msg {
    font-size: 15px;
    color: var(--otwp-muted);
    line-height: 1.7;
    margin: 0 0 20px;
}

.otwp-tab-warning-badge {
    display: inline-block;
    background: var(--otwp-red-light);
    color: var(--otwp-red-dark);
    font-size: 13px;
    font-weight: 700;
    padding: 6px 16px;
    border-radius: 99px;
    margin-bottom: 20px;
    border: 1px solid var(--otwp-red);
}

.otwp-tab-warning-btn {
    min-width: 200px;
}

/* ---- Footer disclaimer ---- */
.otwp-footer {
    margin-top: 32px;
    padding: 16px 20px;
    border-top: 1px solid var(--otwp-line);
    text-align: center;
}

.otwp-footer-disclaimer {
    font-size: 12px;
    color: var(--otwp-muted);
    line-height: 1.6;
    margin: 0;
}

.otwp-footer-report-link {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: 12px;
    color: var(--otwp-red);
    cursor: pointer;
    text-decoration: underline;
}

/* ================================================================== */
/*  Mode card – "coming soon" variant                                 */
/* ================================================================== */

.otwp-mode-card--soon {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(0.4);
}

.otwp-mode-soon-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--otwp-red);
    color: #fff;
    padding: 2px 7px;
    border-radius: 99px;
    vertical-align: middle;
    margin-left: 4px;
}

/* ================================================================== */
/*  Print mode screen                                                 */
/* ================================================================== */

/* Print screen: neutralise app horizontal padding */
#otwp-print {
    margin-left: -16px;
    margin-right: -16px;
}

/* Toolbar stays on white/app background */
.otwp-print-toolbar {
    display: flex;
    gap: 10px;
    padding: 14px 16px 18px;
    border-bottom: 1px solid var(--otwp-line);
    flex-wrap: wrap;
}


/* Each A4 sheet simulation */
.otwp-print-sheet {
    width: 100%;
    max-width: 210mm;
    background: #fff;
    margin: 20px auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--otwp-line);
    border-radius: var(--otwp-radius);
    padding: 28px 24px 24px;
    box-sizing: border-box;
    position: relative;
    font-family: "Segoe UI", Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: var(--otwp-ink);
    line-height: 1.45;
}

/* ---- Headbox ---- */
.otwp-ph-headbox {
    border: 2px solid var(--otwp-line);
    border-top: 4px solid var(--otwp-red);
    border-radius: var(--otwp-radius);
    padding: 10px 12px;
    margin-bottom: 10px;
    background: var(--otwp-soft);
}

.otwp-ph-head-top {
    display: flex;
    gap: 14px;
    align-items: center;
}

.otwp-ph-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    flex: 0 0 auto;
}

.otwp-ph-titleblock {
    flex: 1;
}

.otwp-ph-eyebrow {
    font-size: 9px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--otwp-red);
    font-weight: 800;
    margin-bottom: 2px;
}

.otwp-ph-h1 {
    font-size: 17px;
    font-weight: 800;
    line-height: 1.15;
    margin: 0;
}

.otwp-ph-subline {
    margin-top: 3px;
    font-size: 11px;
    color: var(--otwp-muted);
    font-weight: 600;
}

.otwp-ph-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

.otwp-ph-field {
    border: 1.5px solid var(--otwp-line);
    border-radius: 8px;
    padding: 5px 10px;
    min-height: 36px;
    background: #fff;
}

.otwp-ph-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--otwp-muted);
    font-weight: 800;
    margin-bottom: 3px;
}

.otwp-ph-line {
    border-bottom: 1px dashed var(--otwp-line);
    height: 13px;
}

/* ---- Instruction box ---- */
.otwp-ph-instruction {
    border: 1px solid var(--otwp-line);
    border-radius: 10px;
    padding: 8px 12px;
    background: var(--otwp-soft);
    margin: 8px 0 12px;
}

.otwp-ph-instruction-title {
    font-weight: 800;
    margin-bottom: 4px;
    text-transform: uppercase;
    font-size: 9px;
    letter-spacing: 0.07em;
    color: var(--otwp-muted);
}

.otwp-ph-instruction ul {
    margin: 0;
    padding-left: 16px;
}

.otwp-ph-instruction li {
    margin: 3px 0;
    line-height: 1.35;
    font-size: 10px;
}

/* ---- Question cards ---- */
.otwp-ph-questions {
    display: grid;
    gap: 6px;
}

.otwp-ph-qcard {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 8px;
    border: 1px solid var(--otwp-line);
    border-left: 4px solid var(--otwp-red);
    border-radius: 8px;
    padding: 6px 8px;
    break-inside: avoid;
    align-items: start;
}

.otwp-ph-qno {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--otwp-red);
    color: #fff;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    margin-top: 1px;
}

.otwp-ph-qtext {
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 4px;
    font-size: 11px;
}

/* Answers – each option on its own line */
.otwp-ph-answers {
    display: grid;
    gap: 2px;
    font-size: 10px;
    color: var(--otwp-muted);
    line-height: 1.35;
}

.otwp-ph-answers span {
    display: block;
}

/* ---- Footer ---- */
.otwp-ph-footer {
    margin-top: 10px;
    font-size: 10px;
    color: var(--otwp-muted);
    text-align: right;
}

/* ---- Answer card table ---- */

.otwp-ph-answer-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
    font-size: 13px;
}

.otwp-ph-answer-table th,
.otwp-ph-answer-table td {
    border: 1.4px solid var(--otwp-ink);
    text-align: center;
    padding: 5px 6px;
}

.otwp-ph-answer-table thead th {
    background: #f0f3f9;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.otwp-ph-tnr {
    width: 52px;
    font-weight: 800;
    background: #f0f3f9;
}

.otwp-ph-bubble {
    width: 18px;
    height: 18px;
    border: 2px solid var(--otwp-ink);
    border-radius: 50%;
    margin: 0 auto;
    background: #fff;
}

.otwp-ph-bubble--filled {
    background: var(--otwp-ink);
}

/* ================================================================== */
/*  @page – remove default browser margins (fixes gray borders)       */
/* ================================================================== */

@page {
    margin: 0;
}

/* ================================================================== */
/*  @media print – print layout                                       */
/* ================================================================== */

@media print {
    /* Reset any theme margins / padding on html & body */
    html,
    body {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        background: #fff !important;
    }

    /* Make everything invisible AND strip positioning so
       #otwp-print anchors to the initial containing block */
    body * {
        visibility: hidden;
        position: static !important;
    }

    #otwp-print,
    #otwp-print * { visibility: visible; }

    #otwp-print {
        display: block !important;
        position: absolute !important;
        top: 0;
        left: 0;
        width: 100%;
        padding: 0;
        margin: 0;
    }

    .otwp-no-print,
    .otwp-print-toolbar { display: none !important; }

    /* Each sheet = one page */
    .otwp-print-sheet {
        max-width: none;
        width: auto;
        min-height: auto;
        margin: 0;
        border: none;
        border-radius: 0;
        box-shadow: none;
        padding: 10mm 10mm 8mm 10mm;
        page-break-after: always;
        break-after: page;
    }

    /* Soften headbox for print — no background fill */
    .otwp-ph-headbox {
        background: transparent;
        border-top-color: #c61f26;
    }

    .otwp-ph-field {
        background: transparent;
    }

    .otwp-ph-instruction {
        background: #f4f6fa;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .otwp-ph-qcard {
        break-inside: avoid;
    }

    /* Compact answer table for print so it fits on one A4 page */
    .otwp-ph-answer-table th,
    .otwp-ph-answer-table td {
        padding: 3px 4px;
    }

    .otwp-ph-bubble {
        width: 16px;
        height: 16px;
    }

    /* Preserve bubble fill and backgrounds */
    .otwp-ph-bubble--filled {
        background: #20242b !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .otwp-ph-answer-table thead th,
    .otwp-ph-tnr {
        background: #f0f3f9 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .otwp-ph-qno {
        background: #c61f26 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
