/* Manual view — layout and typography only; content unchanged */
@import 'variables.css';

/* Suit colours (standard playing card scheme) for tier listings */
.suit-spades, .suit-clubs { color: #d8d4cc; }   /* black suits (light on dark bg) */
.suit-hearts, .suit-diamonds { color: #c41e3a; } /* red suits */

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.65;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

nav {
    background-color: var(--bg-elevated);
    padding: 12px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    border-bottom: 2px solid var(--accent-color);
    flex-shrink: 0;
}

nav a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    transition: color var(--transition-fast);
}

nav a:hover {
    color: var(--accent-color);
}

.play-btn-nav {
    background: var(--accent-color);
    color: #fff !important;
    padding: 8px 20px;
    border-radius: var(--radius-sm);
}

.play-btn-nav:hover {
    filter: brightness(1.1);
}

#manual-view {
    display: block;
    overflow-y: auto;
    flex-grow: 1;
    padding: max(28px, var(--safe-top)) max(20px, var(--safe-right)) max(60px, calc(20px + var(--safe-bottom))) max(20px, var(--safe-left));
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

/* Content links: orange (accent) instead of default blue */
#manual-view a:link,
#manual-view a:visited {
    color: var(--accent-color);
    text-decoration: underline;
    text-underline-offset: 2px;
}
#manual-view a:hover,
#manual-view a:focus {
    color: var(--highlight);
}

h1, h2, h3 {
    font-family: var(--font-heading);
    color: var(--accent-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    letter-spacing: 0.03em;
}

h1 {
    text-align: center;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    border-bottom: none;
    margin-bottom: 0;
    text-shadow: 0 0 20px var(--accent-glow);
}

h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-top: 1.75em;
    margin-bottom: 0.5em;
}

h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-top: 1.25em;
    margin-bottom: 0.4em;
}

.subtitle {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 0;
    margin-bottom: 40px;
}

.game-overview {
    text-align: center;
    color: var(--text-muted);
    font-size: 1.05rem;
    max-width: 36em;
    margin: 0 auto 24px auto;
    line-height: 1.5;
}

.flavor-text {
    background-color: #08080a;
    border: 2px solid var(--accent-color);
    padding: 24px 28px;
    font-style: italic;
    color: #ccc;
    margin-bottom: 30px;
    font-size: 1.05em;
    border-radius: var(--radius-md);
    box-shadow: 0 0 24px rgba(201, 77, 40, 0.12);
}

.flavor-text .flavor-text-title {
    margin: 0 0 1rem 0;
    padding: 0;
    border: none;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-color);
    text-align: left;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.flavor-text p {
    margin: 0 0 0.75em 0;
}

.flavor-text p:last-of-type {
    margin-bottom: 0;
}

.tagline {
    font-weight: bold;
    color: var(--accent-color);
    margin-top: 1rem;
    display: block;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
}

th, td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--accent-color);
    font-weight: 600;
}

/* Passage of Time — terms list */
.passage-terms {
    margin: 0 0 24px 0;
    padding: 16px 20px;
    background: var(--bg-elevated, #1e1e28);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--accent-color);
}

.passage-terms dt {
    margin: 0;
    font-weight: 600;
    font-size: 0.95rem;
}

.passage-terms dt:not(:first-child) {
    margin-top: 14px;
}

.passage-terms .game-term {
    color: var(--accent-color);
    font-family: var(--font-heading);
    letter-spacing: 0.02em;
}

.passage-terms dd {
    margin: 4px 0 0 0;
    padding: 0;
    font-size: 0.95rem;
    color: var(--text-muted, #b0b0b8);
    line-height: 1.5;
}

/* Reference card images (same size as grimoire table cards; click to preview) */
.reference-cards-wrap {
    margin: 16px 0 24px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-start;
    justify-content: flex-start;
}

.reference-card-img {
    display: block;
    width: 120px;
    height: auto;
    aspect-ratio: 56 / 80;
    object-fit: contain;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    flex-shrink: 0;
}

.grimoire-intro {
    margin-bottom: 12px;
    font-size: 0.9rem;
    color: var(--text-muted, #888);
}

/* Let table scroll horizontally on narrow screens so Effect column has room to wrap nicely */
.grimoire-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 24px;
}

.grimoire-table {
    min-width: 480px;
}

/* Effect column: min-width so it doesn't squash to 2–3 words per line on phone */
.grimoire-effect {
    min-width: 200px;
    max-width: 420px;
}

.grimoire-table .grimoire-card-img {
    display: block;
    width: 120px;
    height: auto;
    aspect-ratio: 56 / 80;
    object-fit: contain;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.grimoire-table td:first-child {
    width: 132px;
    padding: 10px 14px 10px 12px;
    vertical-align: middle;
}

.grimoire-table .grimoire-card-img {
    cursor: pointer;
}

.grimoire-jokers-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.grimoire-jokers-wrap .grimoire-card-img {
    width: 56px;
    flex-shrink: 0;
}

/* Quick reference table (same as in-game RULES) */
.manual-ref-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 24px;
}

.manual-ref-table {
    width: 100%;
    min-width: 320px;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: var(--bg-elevated, #1e1e28);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.manual-ref-table th,
.manual-ref-table td {
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--border-color);
}

.manual-ref-table th {
    color: var(--accent-color);
    font-weight: 600;
    font-family: var(--font-heading);
}

.manual-ref-table td:first-child {
    font-weight: 700;
    color: var(--magic-color, #a78bfa);
    width: 2em;
}

.manual-ref-table td:nth-child(2) {
    font-weight: 600;
    width: 5.5em;
}

.manual-ref-effect {
    min-width: 180px;
}

/* Big card preview (hover or click) */
.grimoire-card-preview {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.grimoire-card-preview.visible {
    pointer-events: auto;
    opacity: 1;
    visibility: visible;
}

.grimoire-card-preview-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    cursor: pointer;
}

.grimoire-card-preview-img {
    position: relative;
    z-index: 1;
    max-width: min(85vw, 320px);
    width: 320px;
    height: auto;
    aspect-ratio: 56 / 80;
    object-fit: contain;
    border-radius: var(--radius-md);
    border: 2px solid var(--accent-color);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    pointer-events: none;
}

.manual-class-search-wrap {
    margin-bottom: 14px;
}

.manual-class-search-input {
    width: 100%;
    max-width: 320px;
    padding: 10px 14px;
    font-family: var(--font-body);
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text-color);
}

.manual-class-search-input::placeholder {
    color: var(--text-muted, #888);
}

.manual-class-search-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.classes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.class-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.class-name {
    display: block;
    color: var(--accent-color);
    font-weight: bold;
    font-size: 0.95em;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: 6px;
}

.class-card .class-desc {
    margin: 0 0 12px 0;
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.5;
}

.manual-class-card-img-wrap {
    margin-top: auto;
    min-height: 120px;
    display: flex;
    align-items: flex-end;
}

.manual-class-card-img {
    display: block;
    width: 100%;
    max-width: 160px;
    height: auto;
    aspect-ratio: 3 / 4;
    object-fit: contain;
    object-position: bottom left;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.rules-list, .setup-list {
    padding-left: 22px;
}

.setup-list li::marker,
.rules-list li::marker {
    color: var(--accent-color);
}

.faq-list,
.manual-bullets {
    padding-left: 22px;
    margin-bottom: 1em;
    list-style-type: disc;
}

.faq-list li::marker,
.manual-bullets li::marker {
    color: var(--accent-color);
}

.faq-list li,
.manual-bullets li {
    margin-bottom: 12px;
    line-height: 1.5;
}

/* Phase C: ritual actions — clear card-style blocks */
.ritual-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1rem 0;
}

.ritual-action {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-color);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
}

.ritual-action-name {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    color: var(--accent-color);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.ritual-action-tag {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted, #888);
    background: rgba(255, 255, 255, 0.08);
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
}

.ritual-action-summary {
    margin: 0 0 0.5rem 0;
    line-height: 1.5;
}

.ritual-action-detail {
    margin: 0;
    padding: 0.5rem 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.95em;
    line-height: 1.45;
    color: var(--text-color);
}

.ritual-action-detail:empty {
    display: none;
}

.rules-list li, .setup-list li {
    margin-bottom: 10px;
}

#layout-tool, #class-tool {
    background: var(--bg-elevated);
    border: 2px solid var(--accent-color);
    padding: 20px;
    margin-bottom: 30px;
    text-align: center;
    border-radius: var(--radius-md);
}

.tool-btn {
    background: var(--accent-color);
    color: #fff;
    border: none;
    padding: 10px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    margin: 6px;
    border-radius: var(--radius-sm);
    transition: filter var(--transition-fast);
}

.tool-btn:hover {
    filter: brightness(1.1);
}

.tool-btn.secondary {
    background: #444;
}

.diagram-display {
    position: relative;
    width: 100%;
    min-height: clamp(280px, 40vh, 380px);
    height: clamp(280px, 40vh, 380px);
    background: #08080a;
    border: 1px dashed var(--border-color);
    margin-top: 20px;
    display: none;
    border-radius: var(--radius-sm);
}

.diagram-display.active {
    display: block;
}

.d-node {
    position: absolute;
    width: clamp(56px, 12vw, 72px);
    min-width: 56px;
    border-radius: 50%;
    border: 2px solid #555;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(0.6rem, 2vw, 0.75rem);
    flex-direction: column;
    z-index: 2;
    padding: 4px;
    box-sizing: border-box;
}

.d-node-name {
    display: block;
    line-height: 1.2;
    text-align: center;
}

.d-node.starter {
    border-color: var(--ice-color);
    box-shadow: 0 0 12px var(--ice-color);
}

.d-node.twin {
    border-color: var(--accent-color);
    box-shadow: 0 0 12px var(--accent-color);
}

.d-shadow-box {
    margin-top: 4px;
    min-height: 24px;
    padding: 2px 4px;
    background: #0a0a0c;
    border: 1px solid var(--ghost-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2px;
}

.d-shadow-box.d-shadow-split {
    padding: 0;
    flex-direction: row;
    justify-content: stretch;
    gap: 0;
}

.d-shadow-split .d-shadow-left,
.d-shadow-split .d-shadow-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    min-height: 20px;
}

.d-shadow-split .d-shadow-left {
    border-right: 1px solid var(--ghost-color);
    border-radius: 3px 0 0 3px;
}

.d-shadow-split .d-shadow-right {
    border-radius: 0 3px 3px 0;
}

.d-shadow-split .d-shadow-left .ghost-mini,
.d-shadow-split .d-shadow-right .ghost-mini {
    position: static;
}

.d-shadow-box .ghost-mini {
    position: static;
    width: 16px;
    height: 22px;
    font-size: 0.55rem;
}

.center-deck {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 1;
}

.twin-label {
    font-size: 0.65rem;
    color: var(--accent-color);
    margin-top: 2px;
}

.card-shape {
    width: clamp(24px, 5vw, 32px);
    height: clamp(34px, 7vw, 44px);
    background: #25252a;
    border: 1px solid #555;
    margin: 0 auto;
    border-radius: 4px;
}

.card-shape.dark-pile {
    background: #0a0a0c;
    border-color: #666;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
}

.candle-mini {
    width: 8px;
    height: 12px;
    background: #fff;
    border: 1px solid #333;
    margin-top: 2px;
}

.ghost-mini {
    width: 20px;
    height: 28px;
    background: #333;
    border: 1px solid var(--ghost-color);
    color: #fff;
    font-size: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

#selection-area {
    display: none;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 20px;
}

.choice-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 20px;
    cursor: pointer;
    border-radius: var(--radius-sm);
}

.choice-card:hover {
    border-color: var(--accent-color);
}

.choice-name {
    display: block;
    font-size: 1.2em;
    font-weight: bold;
    color: var(--accent-color);
    margin-bottom: 10px;
}

#result-area {
    display: none;
    margin-top: 20px;
    padding: 15px;
    background: #0a0a0c;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: var(--radius-sm);
}

#result-area .picked-classes-heading {
    margin: 0 0 12px 0;
    font-weight: 600;
    color: var(--accent-color);
    font-size: 1em;
}

#result-area .picked-class-entry {
    margin-bottom: 14px;
    padding: 12px;
    background: rgba(255,255,255,0.04);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-color);
}

#result-area .picked-class-entry:last-child {
    margin-bottom: 0;
}

#result-area .picked-class-player-label {
    display: block;
    font-size: 0.8em;
    color: var(--text-muted, #888);
    margin-bottom: 4px;
}

#result-area .picked-class-player-input {
    display: block;
    width: 100%;
    max-width: 200px;
    margin-bottom: 8px;
    padding: 6px 8px;
    font: inherit;
    font-size: 0.95em;
    color: var(--text-color);
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-sizing: border-box;
}

#result-area .picked-class-player-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

#result-area .picked-class-name {
    display: block;
    color: var(--accent-color);
    font-size: 1.05em;
    margin-bottom: 6px;
}

#result-area .picked-class-desc {
    margin: 0;
    font-size: 0.95em;
    line-height: 1.4;
    color: var(--text-color);
}

@media print {
    nav { display: none; }
    #manual-view { display: block; }
}

@media (max-width: 640px) {
    #selection-area { grid-template-columns: 1fr; }
    .classes-grid { grid-template-columns: 1fr; }
    nav { padding: 12px max(12px, var(--safe-left)) 12px max(12px, var(--safe-right)); }
}

@media (min-width: 641px) and (max-width: 900px) {
    .diagram-display { height: clamp(300px, 38vh, 360px); min-height: 300px; }
}

/* 9-player layout: circle with 3 flames (P1, P4, P7) */
.diagram-9.diagram-display {
    min-height: clamp(280px, 40vh, 380px);
    height: clamp(280px, 40vh, 380px);
}

.diagram-9 .d-node {
    width: clamp(48px, 10vw, 60px);
    min-width: 48px;
    font-size: clamp(0.55rem, 1.6vw, 0.7rem);
}

.diagram-9 .d-node-name { font-size: inherit; }
.diagram-9 .candle-mini { width: 8px; height: 12px; }
.diagram-9 .d-shadow-box .ghost-mini { width: 14px; height: 20px; font-size: 0.55rem; }

/* 12-player layout: smaller nodes so all fit in the circle */
.diagram-12.diagram-display {
    min-height: clamp(320px, 45vh, 420px);
    height: clamp(320px, 45vh, 420px);
}

.diagram-12 .d-node {
    width: clamp(44px, 9vw, 56px);
    min-width: 44px;
    font-size: clamp(0.5rem, 1.5vw, 0.65rem);
}

.diagram-12 .d-node-name { font-size: inherit; }
.diagram-12 .candle-mini { width: 6px; height: 10px; }
.diagram-12 .d-shadow-box .ghost-mini { width: 12px; height: 18px; font-size: 0.5rem; }
