/* Spec 157: the rules screen of the tabletop demo - the Rules Arbiter as a transcript with page citations,
   frequent questions as rows, the pawn on a score track while the pages are read, a square field and one
   plain line that a language model answers. Loaded after tabletop-screens.css only with the tabletop look. */

/* 1. The rules screen frame: a flat details bar, a tab, a chat panel without gradient or shadow. */
html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .pdf-details {
    background: var(--tt-surface);
    border: 0;
    border-bottom: 1px solid var(--tt-line);
    border-radius: 0;
    box-shadow: none;
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .pdf-details-title {
    font-family: var(--tt-font-display);
    font-weight: 700;
    color: var(--tt-ink);
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .pdf-tab {
    background: transparent;
    color: var(--tt-muted);
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: 0;
    box-shadow: none;
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .pdf-tab.pdf-tab-active {
    background: var(--tt-page);
    color: var(--tt-ink);
    border-color: var(--tt-line);
    box-shadow: inset 0 3px 0 var(--tt-accent);
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-panel {
    background: var(--tt-page);
    border: 0;
    border-left: 1px solid var(--tt-line);
    border-radius: 0;
    box-shadow: none;
}

/* 2. The header: the arbiter's name and the game, no avatar bubble, no gradient. */
html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-header {
    background: var(--tt-field);
    border: 0;
    border-bottom: 1px solid var(--tt-line);
    border-radius: 0;
    box-shadow: none;
    color: var(--tt-ink);
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-header-avatar {
    display: none;
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-header-info {
    min-width: 0;
    flex: 1 1 auto;
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-header-name {
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
    font-family: var(--tt-font-text);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
    color: var(--tt-ink);
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-header-status {
    font-family: var(--tt-font-display);
    font-size: 16px;
    font-weight: 700;
    color: var(--tt-ink);
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-header-status::before {
    content: none;
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-header :is(.chat-icon-btn, .chat-player-chip) {
    background: transparent;
    color: var(--tt-ink);
    border: 1px solid transparent;
    border-radius: 0;
    box-shadow: none;
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-header :is(.chat-icon-btn, .chat-player-chip):hover {
    border-color: var(--tt-line);
    color: var(--tt-accent);
    transform: none;
}

/* 3. The empty state: a left-aligned intro and the frequent questions as rows. */
html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-messages {
    background: var(--tt-page);
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .tt-arbiter-empty {
    align-items: stretch;
    justify-content: flex-start;
    text-align: left;
    padding: 18px 16px;
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .tt-arbiter-intro {
    margin: 0 0 18px;
    font-size: 15px;
    line-height: 1.5;
    color: var(--tt-ink);
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-suggestions {
    display: grid;
    gap: 0;
    width: 100%;
    border-top: 1px solid var(--tt-line);
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-suggestions-title {
    font-family: var(--tt-font-text);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
    color: var(--tt-ink);
    text-align: left;
    padding: 10px 0 6px;
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-suggestion {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    text-align: left;
    background: transparent;
    color: var(--tt-ink);
    border: 0;
    border-bottom: 1px solid var(--tt-line);
    border-radius: 0;
    box-shadow: none;
    padding: 10px 0;
    font-size: 14px;
    line-height: 1.4;
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-suggestion::after {
    content: "\2192";
    flex: none;
    color: var(--tt-accent);
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-suggestion:hover {
    background: transparent;
    border-color: var(--tt-line);
    color: var(--tt-accent);
    transform: none;
}

/* 4. The transcript: the question as a heading, the answer as plain text, no bubbles or avatars. */
html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .msg-row {
    display: block;
    padding: 0 16px;
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .msg-avatar {
    display: none;
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .msg-bubble {
    max-width: none;
    background: transparent;
    color: var(--tt-ink);
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .user-row {
    padding-top: 16px;
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .user-row .msg-bubble {
    font-family: var(--tt-font-display);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.25;
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .bot-row {
    padding-top: 8px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--tt-line);
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .bot-row .msg-bubble {
    font-size: 15px;
    line-height: 1.6;
}

/* 5. Citations: the page and section from the source button's label, underlined in the accent. */
html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-ref-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    align-items: baseline;
    margin-bottom: 10px;
    background: transparent;
    border: 0;
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-ref-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
    color: var(--tt-muted);
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-ref-btn {
    width: auto;
    height: auto;
    min-width: 0;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    font-size: 0;
    cursor: pointer;
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-ref-btn::after {
    content: attr(aria-label);
    font-size: 13px;
    font-weight: 700;
    color: var(--tt-accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-ref-btn:hover {
    transform: none;
}

/* 6. Waiting: the pawn walks a score track, the pages being read stand beside it. */
html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .tt-wait {
    display: grid;
    gap: 10px;
    padding: 14px 16px 16px;
    border-bottom: 1px solid var(--tt-line);
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .tt-hop {
    position: relative;
    display: flex;
    gap: 4px;
    width: max-content;
    padding-top: 18px;
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .tt-hop span {
    width: 22px;
    height: 10px;
    background: var(--tt-field);
    border: 1px solid var(--tt-line);
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .tt-hop span:nth-child(5n) {
    background: var(--tt-accent-soft);
    border-color: var(--tt-accent);
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .tt-hop i {
    position: absolute;
    left: 3px;
    top: 0;
    width: 16px;
    height: 16px;
    background: var(--tt-accent);
    -webkit-mask: var(--tt-pawn) center / contain no-repeat;
    mask: var(--tt-pawn) center / contain no-repeat;
    animation: tt-walk 1.8s ease-in-out infinite;
}

@keyframes tt-walk {
    0% { transform: translate(0, 0); }
    10% { transform: translate(13px, -6px); }
    20% { transform: translate(26px, 0); }
    30% { transform: translate(39px, -6px); }
    40% { transform: translate(52px, 0); }
    50% { transform: translate(65px, -6px); }
    60% { transform: translate(78px, 0); }
    70% { transform: translate(91px, -6px); }
    80%, 100% { transform: translate(104px, 0); }
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .tt-pages {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-size: 13px;
    color: var(--tt-muted);
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .tt-page {
    font-family: var(--tt-font-display);
    font-weight: 700;
    font-size: 13px;
    color: var(--tt-ink);
    background: var(--tt-field);
    border: 1px solid var(--tt-line);
    padding: 1px 8px;
}

@media (prefers-reduced-motion: reduce) {
    html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .tt-hop i {
        animation: none;
    }
}

/* 7. The field and the plain line under it. */
html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-input-area {
    background: var(--tt-field);
    border: 0;
    border-top: 1px solid var(--tt-line);
    border-radius: 0;
    box-shadow: none;
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-textarea {
    background: var(--tt-page);
    color: var(--tt-ink);
    border: 1px solid var(--tt-line);
    border-bottom: 2px solid var(--tt-muted);
    border-radius: 0;
    box-shadow: none;
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-textarea:focus {
    outline: none;
    border-color: var(--tt-accent);
    box-shadow: inset 0 0 0 1px var(--tt-accent);
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .tt-arbiter-note {
    margin: 0;
    padding: 6px 16px 10px;
    background: var(--tt-field);
    font-size: 12px;
    line-height: 1.4;
    color: var(--tt-muted);
}

/* Spec 244 rule 4: the free questions left, above the disclosure line. */
html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-free-left {
    margin: 0;
    padding: 6px 16px 0;
    background: var(--tt-field);
    font-size: 12px;
    line-height: 1.4;
    color: var(--tt-ink);
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-free-left .news-premium-link {
    margin-left: 6px;
}

/* Spec 178 rule 7: the app's own parts of the rules screen - the reader tools, the panels under the rulebook,
   the page grid, the conversation history and the notices - lie flat on the board like the rest. */
html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .pdf-reader-tools {
    background: var(--tt-field);
    border-bottom: 1px solid var(--tt-line);
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) :is(.pdf-notes-panel, .chat-history-panel, .pdf-reader-panel-header) {
    background: var(--tt-field);
    color: var(--tt-ink);
    border-color: var(--tt-line);
    box-shadow: none;
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) :is(.pdf-notes-header h4, .pdf-reader-panel-header h4) {
    font-family: var(--tt-font-display);
    font-weight: 700;
    color: var(--tt-ink);
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) :is(.pdf-notes-empty, .chat-history-note, .chat-history-empty, .chat-history-date) {
    color: var(--tt-muted);
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) :is(.pdf-notes-list li, .chat-history-item) {
    background: var(--tt-page);
    color: var(--tt-ink);
    border: 1px solid var(--tt-line);
    border-radius: 0;
    box-shadow: none;
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-history-item-active {
    border-color: var(--tt-accent);
    box-shadow: inset 3px 0 0 var(--tt-accent);
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-history-open {
    color: var(--tt-ink);
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) :is(.pdf-note-title, .pdf-note-content, .pdf-setup-text) {
    color: var(--tt-ink);
}

/* The handle between the rulebook and its panel: a flat band with a square grip. */
html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .pdf-notes-resizer {
    background: var(--tt-side);
    border-color: var(--tt-line);
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .pdf-notes-resizer::before {
    background: var(--tt-muted);
    border-radius: 0;
}

/* The page grid: flat thumbnails with a line, the current page framed in the accent. */
html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .pdf-page-thumb {
    color: var(--tt-ink);
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .pdf-page-thumb img {
    border: 1px solid var(--tt-line);
    box-shadow: none;
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .pdf-page-thumb.current {
    border-color: var(--tt-accent);
    color: var(--tt-accent);
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) :is(.pdf-section-link, .pdf-reader-panel-header) {
    color: var(--tt-ink);
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) :is(.pdf-section-link:hover, .pdf-section-link:focus-visible) {
    background: var(--tt-accent-soft);
    color: var(--tt-ink);
}

/* Notices beside the chat: a field with the rule; the reading progress is a score track. */
html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-warning-card {
    background: var(--tt-area);
    color: var(--tt-ink);
    border: 0;
    border-top: 3px solid var(--tt-rule);
    border-radius: 0;
    box-shadow: none;
}

/* Spec 187: cut like every other field. */
@supports (corner-shape: bevel) {
    html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-warning-card {
        border-radius: 14px;
        corner-shape: bevel;
    }
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) :is(.chat-warning-title, .chat-warning-card p, .rag-progress-text) {
    color: var(--tt-ink);
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-warning-title {
    font-family: var(--tt-font-display);
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .rag-progress {
    background:
        repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), var(--tt-line) calc(10% - 1px) 10%),
        var(--tt-field);
    border: 1px solid var(--tt-line);
    border-radius: 0;
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .rag-progress-bar {
    background: var(--tt-accent);
    border-radius: 0;
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-no-passage-notice {
    background: var(--tt-field);
    color: var(--tt-muted);
    border: 1px solid var(--tt-line);
    border-left: 3px solid var(--tt-accent);
    border-radius: 0;
}

/* The chat's pickers and its rows above the field: flat bands; the options are square toggles. */
html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) :is(.chat-player-picker, .chat-player-confirm, .chat-expansions) {
    background: var(--tt-field);
    color: var(--tt-ink);
    border-color: var(--tt-line);
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-player-option {
    background: var(--tt-page);
    color: var(--tt-ink);
    border: 1px solid var(--tt-line);
    border-radius: 0;
    box-shadow: none;
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-player-option:hover {
    border-color: var(--tt-accent);
    color: var(--tt-accent);
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-player-option-active {
    background: var(--tt-accent-soft);
    border-color: var(--tt-accent);
    color: var(--tt-ink);
    box-shadow: inset 0 0 0 1px var(--tt-accent);
}

html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .chat-dictation-error {
    background: var(--tt-field);
    color: var(--tt-danger);
    border-top: 1px solid var(--tt-line);
}

/* The sections, the page grid and the text view cover the rulebook with the page colour. */
html.tabletop:not(#tabletop) .page:is(.theme-dark, .theme-light) .pdf-reader-panel {
    background: var(--tt-page);
    color: var(--tt-ink);
}
