/* Гильдии: оформление в палитре основного трекера. */
.header { align-items: flex-start; }
.stats-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 14px; max-width: 460px; }
.stats-row > .divider, #pet-info-wrapper > .divider { display: none !important; }
.stats-row .stat-item.gold-stat { grid-column: 1; grid-row: 3; }
#pet-info-wrapper { grid-column: 1; grid-row: 4; min-height: 44px; justify-self: start; }
#streak-counter { grid-column: 2; grid-row: 4; margin-left: 0; justify-self: start; align-self: center; }
.header-actions { flex: 0 1 392px; min-width: 0; }
.header-actions .controls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.header-actions .controls button { width: 100%; min-height: 52px; }
.guild-section { width: 100%; margin-top: 16px; }
.guild-section h2 { color: #d4af37; font: inherit; font-size: 13px; font-weight: bold; margin: 0 0 9px; }
.guild-buttons { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.guild-button { min-width: 0; padding: 0; background: transparent; border: 0; color: #bbb; font: 11px 'Courier New', monospace; cursor: pointer; }
.guild-icon-tile { height: 52px; display: flex; align-items: center; justify-content: center; background: #2a2a2a; border: 1px solid #444; border-radius: 8px; box-sizing: border-box; margin-bottom: 6px; }
.guild-icon-tile img { display: block; width: 41px; height: 41px; image-rendering: pixelated; filter: drop-shadow(0 1px 2px rgba(0,0,0,.7)); }
.guild-button:hover .guild-icon-tile { border-color: #ffd166; }
.guild-button:focus-visible, .guilds-text-link:focus-visible { outline: 2px solid #ffd166; outline-offset: 3px; }
.guild-locked .guild-icon-tile img { opacity: .5; filter: grayscale(.6) drop-shadow(0 1px 2px rgba(0,0,0,.7)); }
.guilds-text-link { grid-column: 2; grid-row: 3; justify-self: start; border: 0; background: transparent; color: #d4af37; font: inherit; padding: 0; min-height: 24px; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.guild-shop-icon { width: 60px; height: 60px; image-rendering: pixelated; object-fit: contain; display: block; margin: 0 auto 12px; }
.guild-window, .reader-window, .reader-editor-window, .guild-message-window { box-sizing: border-box; width: min(94vw, 650px); max-width: 650px !important; max-height: 88vh; max-height: 88dvh; overflow-y: auto; padding: 20px !important; text-align: left; }
.reader-editor-window, .guild-message-window { max-width: 530px !important; }
.reader-editor-overlay { z-index: 500100; }
.guild-message-overlay { z-index: 500200; }
.reader-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.reader-heading h2 { display: flex; align-items: center; gap: 8px; margin: 0; padding: 0; border: 0; font-size: 20px; color: #ffd166; overflow-wrap: anywhere; }
.reader-heading h2 img { flex: 0 0 32px; object-fit: contain; image-rendering: pixelated; }
.reader-heading-buttons { display: flex; flex: 0 0 auto; }
.reader-close { flex-shrink: 0; background: transparent; border: 0; color: #d4af37; font: bold 20px 'Courier New', monospace; min-width: 44px; min-height: 44px; cursor: pointer; }
.reader-summary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; color: #d4af37; font-size: 13px; margin-bottom: 16px; }
.reader-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin-bottom: 12px; }
.reader-tabs button, .reader-button { background: #28241f; border: 1px solid #665335; border-radius: 6px; color: #dfd5bf; font: 13px 'Courier New', monospace; padding: 9px 10px; cursor: pointer; min-height: 44px; box-sizing: border-box; }
.reader-tabs button { min-width: 0; padding: 8px 3px; }
.reader-tabs button.active, .reader-primary { background: #493a25; border-color: #d4af37; color: #ffd166; }
.reader-button:hover, .reader-tabs button:hover { border-color: #ffd166; }
.reader-button:disabled { opacity: .45; cursor: default; }
.reader-toolbar, .reader-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.reader-toolbar { margin-bottom: 16px; }
.reader-actions { margin-top: 12px; }
.reader-danger { color: #ee9992; border-color: #6c4141; }
.reader-meta { color: #aaa; font-size: 12px; line-height: 1.6; margin: 5px 0; overflow-wrap: anywhere; }
.reader-card, .reader-book-detail { border: 1px solid #454036; border-radius: 8px; background: #191714; margin-bottom: 12px; padding: 14px; }
.reader-card h3, .reader-book-detail h3 { font-size: 16px; margin: 0 0 7px; color: #eed9aa; overflow-wrap: anywhere; }
.reader-note { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.6; color: #d7d0c2; margin: 8px 0; }
.reader-empty { color: #aaa; font-size: 14px; line-height: 1.6; padding: 18px 4px; }
.reader-pagination { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; margin-top: 12px; }
.reader-help { padding: 12px; background: #191714; border: 1px solid #665335; border-radius: 6px; margin-bottom: 12px; font-size: 13px; line-height: 1.6; }
.reader-help p { margin: 0 0 10px; }
.reader-help p:last-child { margin-bottom: 0; }
.reader-field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 13px; color: #c4b89e; font-size: 13px; }
.reader-field input, .reader-field select, .reader-field textarea { box-sizing: border-box; display: block; width: 100%; min-width: 0; background: #111; color: #e0e0e0; border: 1px solid #575044; border-radius: 6px; font: 16px 'Courier New', monospace; padding: 10px; margin: 0; min-height: 44px; }
.reader-field textarea { resize: vertical; line-height: 1.5; min-height: 100px; }
.reader-form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.reader-check { display: flex; gap: 10px; align-items: center; font-size: 14px; line-height: 1.5; min-height: 44px; margin: 8px 0; cursor: pointer; }
.reader-check input { width: 22px; height: 22px; flex: 0 0 auto; accent-color: #d4af37; }
.reader-error { color: #ffa19b; font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
.reader-additional { font-size: 13px; color: #b9ae99; margin: 10px 0; }
.reader-additional summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.reader-additional summary::before { content: '▸ '; margin-right: 5px; }
.reader-additional[open] summary::before { content: '▾ '; }
.guild-overview-card { display: flex; gap: 12px; width: 100%; padding: 14px; margin: 10px 0; background: #25221e; color: #ccc; border: 1px solid #555046; border-radius: 8px; text-align: left; font: 13px 'Courier New', monospace; cursor: pointer; }
.guild-overview-card img { flex: 0 0 41px; object-fit: contain; image-rendering: pixelated; }
.guild-overview-card strong { color: #ffd166; font-size: 15px; }
.guild-overview-card span span { display: block; margin-top: 6px; line-height: 1.5; }
.entry-reading { border-left-color: #b39258; }
.reader-window [hidden], .reader-editor-window [hidden] { display: none !important; }
@media (max-width: 700px) {
    .header-actions { flex: 1 1 100%; }
    .guilds-text-link { grid-column: 2; grid-row: 3; justify-self: start; min-height: 24px; }
    #streak-counter, .stats-row.has-active-pet #streak-counter { grid-row: 4; }
    .guild-window, .reader-window, .reader-editor-window, .guild-message-window { width: calc(100vw - 20px); max-height: 90vh; max-height: 90dvh; padding: 16px 12px !important; }
    .reader-heading h2 { font-size: 17px; }
    .reader-heading h2 img { display: none; }
    .reader-toolbar { gap: 6px; }
    .reader-toolbar .reader-button { padding: 8px; font-size: 12px; }
}
@media (max-width: 360px) { .reader-form-row { grid-template-columns: minmax(0, 1fr); gap: 0; } }

/* Верх гильдии остаётся на месте; прокручиваются только содержимое и справка. */
#modal-readers .reader-window { display: flex; flex-direction: column; height: 88vh; height: 88dvh; overflow: hidden; }
.reader-window > .reader-heading, .reader-window > .reader-summary, .reader-window > .reader-tabs, .reader-window > .reader-toolbar { flex-shrink: 0; }
.reader-scroll-area { min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.reader-toolbar > .reader-button { flex: 1 1 0; }
.reader-back { margin-bottom: 14px; }
.reader-field input[type="date"] { appearance: none; -webkit-appearance: none; height: 44px; line-height: 22px; padding: 10px; text-align: center; }
.reader-field input[type="date"]::-webkit-date-and-time-value { text-align: center; margin: 0; min-height: 22px; }
.reader-field input[type="date"]::-webkit-datetime-edit { display: inline-flex; align-items: center; justify-content: center; padding: 0; }
