/* Redesign C ("Compact"), as prototyped: Rubik, a navy header, teal accents, white rounded boxes.
   Everything is on one screen on every device: no frame needs scrolling to reach a part of the page.
   Only a list of results or a long book card scrolls, inside its own area.
   Same features, words and links as before; only the look and the arrangement change. */
@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@400;500;600;700&display=swap');

body { font-family: Rubik, system-ui, sans-serif; color: #111827; }
body, input, select, button { font-family: Rubik, system-ui, sans-serif; }
a { color: #0A6464; }
a:hover { color: #064545; }

/* ---------- Top: title, links and the catalog tabs ---------- */
body.frame-top { margin: 0; overflow: hidden; background: #14213D; color: #fff; }
.c-hdr { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 24px; padding: 8px 20px; }
.c-bsd { order: 1; font-size: 12px; color: #C9D4E8; }
h2.c-ttl { order: 2; flex: 1 1 auto; margin: 0 !important; font-size: 17px !important; font-weight: 700; color: #fff; text-align: start; }
table.c-links { order: 3; border-collapse: collapse; }
table.c-links td { padding: 0 !important; background: none; font-family: inherit; font-size: 14px; }
table.c-links td:nth-child(even) { display: none; } /* the small squares between the links */
table.c-links td + td + td { padding-inline-start: 18px !important; }
table.c-links a, table.c-links a:hover { color: #E6ECF7; }

table.c-tabs, table.c-tabs tbody { display: block; }
table.c-tabs { background: #1C2D52; padding: 0 12px; box-sizing: border-box; }
/* one row, as before, when all 12 fit; otherwise two even rows of 6 (redesign-frames.js), never a ragged wrap */
table.c-tabs tr { display: flex; flex-wrap: nowrap; justify-content: space-between; }
table.c-tabs.rows2 tr { display: grid; }
table.c-tabs.rows2 tr { grid-template-columns: repeat(6, minmax(0, 1fr)); }
table.c-tabs td { display: flex; align-items: center; justify-content: center; text-align: center; height: 38px; padding: 0 8px; background: none !important; font-family: inherit !important; font-size: 13.5px !important; white-space: nowrap; color: #C9D4E8; }
table.c-tabs td a { color: #C9D4E8 !important; text-decoration: none !important; }
table.c-tabs td a:hover { color: #fff !important; }
table.c-tabs td.ActiveTopNav { color: #fff; font-weight: 600; box-shadow: inset 0 -3px 0 #2BB5A5; }

/* ---------- Search and results ---------- */
body.frame-content { margin: 0; height: 100vh; display: flex; flex-direction: column; gap: 12px; overflow: hidden; background: #EEF1F5; }
.c-form, .c-results { background: #fff; border-radius: 10px; box-shadow: 0 1px 2px rgba(16, 24, 40, .06); }
.c-form { flex: 0 0 auto; max-height: 70vh; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.c-results { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.c-results:empty { display: none; }
.c-form span.browse_catalog, .c-form td.browse_catalog { height: auto; margin: 0; font-family: inherit; font-size: 12px; color: #4B5563; }

/* basic / advanced: one control with two halves */
table.c-seg, table.c-seg tbody { display: block; margin: 0 !important; }
table.c-seg tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: #EEF1F5; padding: 3px; border-radius: 8px; }
table.c-seg td { display: flex; align-items: center; justify-content: center; height: 34px; padding: 0; border-radius: 6px; font-size: 14px; color: #4B5563; }
table.c-seg td b { font-weight: 600; color: #111827; }
table.c-seg td:has(b) { background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
table.c-seg td a { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-size: 14px; color: #4B5563; text-decoration: none; }

/* the search rows: field, words, search button */
.c-form form, .c-form form > table, .c-form table:not(.c-seg):not(#vk), .c-form table:not(.c-seg):not(#vk) > tbody { display: block; margin: 0 !important; }
.c-form table:not(.c-seg):not(#vk) tr { display: flex; align-items: flex-end; gap: 6px; margin-bottom: 6px; }
.c-form table:not(.c-seg):not(#vk) td { display: flex; gap: 6px; padding: 0; align-items: flex-end; }
.c-form table:not(.c-seg):not(#vk) td:has(input[type=text]) { flex: 1 1 auto; min-width: 0; }
.c-form td > .browse_catalog:has(input[type=text]) { flex: 1 1 auto; min-width: 0; }
.c-form select { height: 40px; padding: 0 6px; font-size: 14px; border: 1px solid #C7CDD6; border-radius: 6px; background: #fff; color: #111827; }
.c-form input[type=text] { width: 100%; height: 40px; box-sizing: border-box; padding: 0 10px; font-size: 16px; border: 1px solid #C7CDD6; border-radius: 6px; outline: none; background: #fff; color: #111827; }
.c-form input[type=text]:focus, .c-form #search { border: 2px solid #0A6464; }
.c-form input[type=submit] { height: 40px; padding: 0 18px; border: 0; border-radius: 6px; background: #0A6464; color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; }
.c-form input[type=submit]:hover { background: #064545; }
.c-form td:has(input[type=submit]) { flex: 0 0 auto; }
.c-form input[type=submit].c-busy { background: #4B8A8A; cursor: progress; }
.c-results.c-busy { opacity: .45; transition: opacity .15s; }

/* virtual keyboard: same switch and keys, drawn like C */
.c-form .kbTitle { margin: 0; gap: 8px; }
.c-form .kbTitle span { font-size: 13px; font-weight: 400; color: #4B5563 !important; margin: 0; }
.c-form .switch { width: 30px; height: 18px; border-radius: 9px; background: #9CA3AF !important; }
.c-form .switch:before { width: 12px; height: 12px; top: 3px; inset-inline-start: 3px; }
body.show-vk .c-form .switch { background: #0A6464 !important; }
body.show-vk .c-form .switch:before { inset-inline-start: 15px; }
.c-form #vk { margin: 0; width: 100%; border-spacing: 4px; table-layout: fixed; font-family: inherit; }
.c-form #vk .keyboard { width: auto; height: 32px; padding: 0; border: 1px solid #D5DAE1; border-radius: 6px; background: #F7F9FB; color: #111827; font-size: 16px; }
.c-form #vk .keyboard:hover { background: #E3F2F1; }

/* the results list scrolls; the pages and the found count stay in view under it */
.c-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.c-list > table { width: 100%; margin: 0 !important; border-spacing: 0; }
.c-list > table td { padding: 0; }
.c-list div.browse_catalog { height: auto; margin: 0; font-family: inherit; border-bottom: 1px solid #F0F2F5; }
.c-list div.browse_catalog:nth-child(even) { background: #FAFBFC; }
.c-list a.browse_catalog { display: block; height: auto; margin: 0; padding: 7px 14px; font-family: inherit; font-size: 14px; line-height: 1.45; color: #111827; text-decoration: none; }
.c-list div.browse_catalog:hover { background: #F2F7F7; }
.c-list div.browse_catalog.on { background: #E3F2F1; }
.c-list div.browse_catalog.on a { font-weight: 600; }
.c-nav { flex: 0 0 auto; border-top: 1px solid #E5E8ED; padding: 8px 14px 4px; font-size: 13px; }
.c-nav table { border-spacing: 0; margin: 0 !important; }
.c-nav td { padding: 0; }
.c-nav td > br:first-child { display: none; }
.c-nav .navigation { font-family: inherit; font-size: 13px; }
.c-nav a.navigation { color: #0A6464; }
.c-nav div.navigation { margin-top: 4px; font-weight: 600; font-size: 14px; color: #111827; }
.c-results > .navigation { flex: 0 0 auto; padding: 0 14px 6px; font-family: inherit; font-size: 12px; color: #6B7280; }

/* ---------- Book card ---------- */
body.frame-main { margin: 0; padding: 26px 32px; background: #fff; font-size: 16px; line-height: 1.6; color: #374151; }
body.frame-main > table { border-spacing: 0; width: 100%; }
body.frame-main > table td { padding: 2px 0; }
body.frame-main > table td:first-child:empty { display: none; }
body.frame-main > table tr:first-child td { padding-bottom: 12px; border-bottom: 1px solid #E5E8ED; font-size: 14px; color: #4B5563; }
body.frame-main > table b { display: block; margin: 6px 0 2px; font-size: 26px; line-height: 1.3; font-weight: 700; color: #111827; }
body.frame-main .dropbtn { padding: 10px 16px; border-radius: 8px; background: #0A6464; font-size: 15px; text-decoration: none; }
body.frame-main .dropbtn a { font-size: 15px; text-decoration: none; }
body.frame-main .dropbtn:hover { background: #064545; }
body.frame-main:has(> iframe) { padding: 0; }

/* ---------- Footer ---------- */
body.frame-bottom { margin: 0; overflow: hidden; background: #14213D; }
body.frame-bottom > div { display: flex; justify-content: center; height: 100vh; align-items: center; }
body.frame-bottom #table1 { width: auto !important; max-width: 100%; background: none !important; border: 0 !important; }
body.frame-bottom #table1 td { width: auto !important; border: 0 !important; padding: 0 12px !important; }
body.frame-bottom #table1 p { margin: 0; }
body.frame-bottom #table1 span { font-family: Rubik, system-ui, sans-serif !important; font-size: 12px !important; color: #C9D4E8 !important; }

/* ---------- Phone ---------- */
@media (max-width: 700px) {
    .c-hdr { padding: 6px 10px; gap: 2px 10px; }
    h2.c-ttl { font-size: 13.5px !important; line-height: 1.3; flex-basis: 100%; order: 3; }
    table.c-links { order: 2; margin-inline-start: auto; }
    table.c-links td { font-size: 12px; }
    table.c-links td + td + td { padding-inline-start: 12px !important; }
    table.c-tabs { padding: 0 4px 4px; background: #14213D; }
    table.c-tabs tr, table.c-tabs.rows2 tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; }
    table.c-tabs td { justify-content: center; height: 28px; padding: 0 2px; font-size: 11px !important; border-radius: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
    table.c-tabs td a { overflow: hidden; text-overflow: ellipsis; }
    table.c-tabs td.ActiveTopNav { background: #2BB5A5 !important; box-shadow: none; color: #fff; }
    body.frame-content { gap: 8px; }
    .c-form { padding: 8px; gap: 7px; }
    table.c-seg td { height: 30px; font-size: 13px; }
    .c-form select, .c-form input[type=text], .c-form input[type=submit] { height: 36px; }
    .c-form input[type=submit] { padding: 0 12px; }
    .c-form #vk { border-spacing: 3px; }
    .c-form #vk .keyboard { height: 30px; }
    .c-nav { padding: 6px 10px 2px; font-size: 12px; }
    body.frame-main { padding: 12px 16px; }
    body.frame-bottom #table1 td { padding: 0 5px !important; }
    body.frame-bottom #table1 span { font-size: 10px !important; }
}

/* ---------- Phone: one catalog button; its list opens over the page (release 5) ---------- */
.c-catbtn { display: none; }
@media (max-width: 700px) {
    body.frame-top .c-hdr { background: #14213D; }
    .c-catbtn { display: flex; align-items: center; justify-content: space-between; width: calc(100% - 16px); margin: 0 8px; height: 38px; padding: 0 12px; box-sizing: border-box; border: 0; border-radius: 8px; background: #1C2D52; color: #fff; font: 600 14.5px Rubik, system-ui, sans-serif; cursor: pointer; }
    .c-catbtn svg { flex: 0 0 auto; transition: transform .15s; }
    body.frame-top .c-catwrap { background: #14213D; padding-bottom: 8px; }
    body.frame-top table.c-tabs { display: none !important; }
    html.cats-open, html.cats-open body.frame-top { background: transparent; }
    html.cats-open .c-catbtn svg { transform: rotate(180deg); }
    html.cats-open body.frame-top table.c-tabs { display: block !important; position: absolute; left: 8px; right: 8px; margin-top: -4px; padding: 8px; background: #fff; border-radius: 10px; box-shadow: 0 10px 28px rgba(0, 0, 0, .28); }
    html.cats-open table.c-tabs tr, html.cats-open table.c-tabs.rows2 tr { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
    html.cats-open table.c-tabs td { height: 42px; border-radius: 8px; border: 1px solid #E5E8ED; font-size: 14px !important; color: #111827; justify-content: flex-start; padding: 0 10px; }
    html.cats-open table.c-tabs td a { color: #111827 !important; display: flex; align-items: center; width: 100%; height: 100%; }
    html.cats-open table.c-tabs td.ActiveTopNav { background: #E3F2F1 !important; border-color: #2BB5A5; color: #064545; font-weight: 600; box-shadow: none; }
}

/* ---------- "Found nothing": where the words are found (release 5) ---------- */
.c-alt { margin-top: 6px; font-size: 14px; line-height: 1.7; color: #374151; font-weight: 400; }
.c-alt a { color: #0A6464; font-weight: 600; white-space: nowrap; }
.c-alt .c-sep { color: #9CA3AF; margin: 0 6px; }
.c-alt.c-wait { color: #6B7280; }

/* ---------- Results already opened look different, as in the original (release 5) ---------- */
/* The original left result links in the browser colors, so an opened book turned purple. People go down long
   lists one by one (tap log: 333 of 709 moves were to the next row), and this shows where they were. */
.c-list a.browse_catalog:visited, .c-list div.seen a.browse_catalog { color: #5B2C83; }

/* ---------- Book card: the author a little bigger (19px; the title is 26px, other lines 16px), as the director asked (release 5) ---------- */
body.frame-main > table td.c-author { font-size: 19px; line-height: 1.45; color: #1F2937; }
