/* Online tools: the section, a tool page and the tools themselves. Colours fall back to the plugin's own
   when the theme does not define the cs50 variables. */
.cs-tools {
    --t-ink: var(--cs-ink, #23283a);
    --t-muted: var(--cs-muted, #6a7086);
    --t-primary: var(--cs-primary, #394260);
    --t-primary-dark: var(--cs-primary-dark, #2c3350);
    --t-line: var(--cs-line, #e3e6ef);
    --t-soft: var(--cs-soft, #f1f2f6);
    --t-radius: var(--cs-radius, 10px);
    --t-radius-lg: var(--cs-radius-lg, 16px);
    --t-accent: #f5c518;
    color: var(--t-ink);
}
.cs-tools *, .cs-tools *::before, .cs-tools *::after { box-sizing: border-box; }
.cs-tools__lead { max-width: 760px; margin: 0 0 28px; color: var(--t-muted); font-size: 18px; line-height: 1.55; }

/* Cards of the section */
.cs-tools__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 24px; }
.cs-tools .cs-tools__grid a.cs-tools__card {
    display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--t-line); border-radius: var(--t-radius-lg);
    background: #fff; color: var(--t-ink); text-decoration: none; transition: transform .18s, box-shadow .18s, border-color .18s;
}
.cs-tools .cs-tools__grid a.cs-tools__card:hover { transform: translateY(-3px); border-color: #cfd4e2; box-shadow: 0 18px 40px rgba(41, 50, 77, .12); }
.cs-tools__cover { display: block; aspect-ratio: 808 / 435; overflow: hidden; background: var(--t-soft); }
.cs-tools__cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cs-tools__body { display: flex; flex: 1; flex-direction: column; gap: 8px; padding: 18px 20px 20px; }
.cs-tools__name { font-size: 18px; font-weight: 700; line-height: 1.3; }
.cs-tools__about { flex: 1; color: var(--t-muted); font-size: 14.5px; line-height: 1.5; }
.cs-tools__open { margin-top: 6px; color: var(--t-primary); font-size: 14.5px; font-weight: 600; }
.cs-tools__open::after { content: " \2192"; transition: margin .18s; }
.cs-tools__card:hover .cs-tools__open::after { margin-left: 4px; }
.cs-tools__more { margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--t-line); }
.cs-tools .cs-tools__more h2 { margin: 0 0 20px; font-size: 22px; font-weight: 700; }
.cs-tools .cs-tools__more h2 a { color: inherit; text-decoration: none; }
.cs-tools__more .cs-tools__grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; }
.cs-tools__more .cs-tools__name { font-size: 16px; }
.cs-tools__more .cs-tools__about { display: none; }

/* A tool page */
.cs-tool__app { padding: 24px; border: 1px solid var(--t-line); border-radius: var(--t-radius-lg); background: #f7f8fc; }
.cs-tool__text { max-width: 820px; margin-top: 40px; font-size: 16.5px; line-height: 1.7; }
.cs-tool__text h2 { margin: 32px 0 12px; font-size: 22px; font-weight: 700; line-height: 1.3; }
.cs-tool__text h2:first-child { margin-top: 0; }
.cs-tool__text p { margin: 0 0 14px; }
.cs-tool__text ul, .cs-tool__text ol { margin: 0 0 14px; padding-left: 22px; }
.cs-tool__text li { margin-bottom: 6px; }
.cs-tools code { padding: 2px 6px; border-radius: 6px; background: var(--t-soft); color: var(--t-ink); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }

/* Controls shared by the tools */
.cs-field {
    display: block; width: 100%; padding: 12px 14px; border: 1px solid var(--t-line); border-radius: var(--t-radius); background: #fff;
    color: var(--t-ink); font: inherit; font-size: 16px; line-height: 1.5; transition: border-color .15s, box-shadow .15s;
}
.cs-field:focus { outline: none; border-color: var(--t-primary); box-shadow: 0 0 0 3px rgba(57, 66, 96, .14); }
textarea.cs-field { min-height: 120px; resize: vertical; }
.cs-btn {
    display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 22px; border: 1px solid var(--t-primary);
    border-radius: var(--t-radius); background: var(--t-primary); color: #fff; font: inherit; font-size: 15.5px; font-weight: 600;
    text-decoration: none; white-space: nowrap; cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.cs-tools .cs-btn:hover { border-color: var(--t-primary-dark); background: var(--t-primary-dark); color: #fff; }
.cs-tools .cs-btn--ghost { border-color: var(--t-line); background: #fff; color: var(--t-ink); text-decoration: none; }
.cs-tools .cs-btn--ghost:hover { border-color: var(--t-primary); background: #fff; color: var(--t-primary); }
.cs-btn[disabled] { opacity: .45; cursor: default; pointer-events: none; }
.cs-link { padding: 0; border: 0; background: none; color: var(--t-primary); font: inherit; font-size: 14.5px; font-weight: 600; text-decoration: underline; cursor: pointer; }
.cs-link:hover { color: var(--t-primary-dark); }
.cs-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin-bottom: 16px; }
.cs-split { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.cs-pane { display: flex; flex-direction: column; gap: 8px; min-width: 0; margin: 0; font-weight: 400; }
.cs-pane__title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; color: var(--t-muted); font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.cs-pane__title .cs-link { letter-spacing: 0; text-transform: none; }
.cs-note { margin: 16px 0 0; color: var(--t-muted); font-size: 14.5px; line-height: 1.55; }
.cs-switch { display: inline-flex; padding: 4px; border: 1px solid var(--t-line); border-radius: var(--t-radius); background: #fff; }
.cs-switch label { margin: 0; cursor: pointer; }
.cs-switch input { position: absolute; opacity: 0; }
.cs-switch span { display: block; padding: 8px 16px; border-radius: 7px; font-size: 14.5px; font-weight: 600; transition: background .15s, color .15s; }
.cs-switch input:checked + span { background: var(--t-primary); color: #fff; }
.cs-switch input:focus-visible + span { box-shadow: 0 0 0 3px rgba(57, 66, 96, .2); }
.cs-select { display: inline-flex; align-items: center; gap: 10px; margin: 0; color: var(--t-muted); font-size: 14.5px; font-weight: 400; }
.cs-select select { height: 40px; padding: 0 12px; border: 1px solid var(--t-line); border-radius: var(--t-radius); background: #fff; color: var(--t-ink); font: inherit; font-size: 14.5px; }
.cs-chip { min-width: 40px; height: 40px; padding: 0 10px; border: 1px solid var(--t-line); border-radius: 8px; background: #fff; color: var(--t-ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.cs-chip:hover { border-color: var(--t-primary); color: var(--t-primary); }

/* Password generator */
.cs-pass__main { display: flex; gap: 10px; }
.cs-pass__value { flex: 1; min-width: 0; height: 56px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 20px; letter-spacing: .02em; }
.cs-pass__main .cs-btn { min-height: 56px; }
.cs-pass__meter { height: 6px; margin-top: 14px; overflow: hidden; border-radius: 3px; background: var(--t-line); }
.cs-pass__meter span { display: block; width: 0; height: 100%; border-radius: 3px; background: #d64545; transition: width .25s, background .25s; }
.cs-pass__meter .is-fair { background: #e8a23a; }
.cs-pass__meter .is-good { background: #7bb342; }
.cs-pass__meter .is-strong { background: #2e9e5b; }
.cs-pass__strength { margin: 8px 0 0; color: var(--t-muted); font-size: 14px; }
.cs-pass__settings { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 32px; margin-top: 24px; }
.cs-range { display: flex; flex-direction: column; gap: 10px; margin: 0; font-weight: 400; }
.cs-range__label { display: flex; justify-content: space-between; font-size: 15px; font-weight: 600; }
.cs-range__value { color: var(--t-primary); font-variant-numeric: tabular-nums; }
.cs-range input[type="range"] { width: 100%; margin: 0; accent-color: var(--t-primary); }
.cs-checks { display: flex; flex-wrap: wrap; gap: 10px 26px; grid-column: 1 / -1; }
.cs-check { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; font-weight: 400; cursor: pointer; }
.cs-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--t-primary); }
.cs-pass__list { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin-top: 24px; }
.cs-pass__list textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 15px; }

/* Transliteration */
.cs-translit [data-role="output"] { background: #fff; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 15px; }

/* Markdown editor */
.cs-md__buttons, .cs-md__actions { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.cs-md__buttons { gap: 6px; }
.cs-md__input { min-height: 420px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14.5px; line-height: 1.6; }
.cs-md__preview { flex: 1; min-height: 420px; padding: 16px 20px; overflow: auto; border: 1px solid var(--t-line); border-radius: var(--t-radius); background: #fff; font-size: 16px; line-height: 1.65; overflow-wrap: break-word; }
.cs-md__preview > :first-child { margin-top: 0; }
.cs-md__preview h1 { margin: 0 0 14px; font-size: 28px; font-weight: 700; }
.cs-md__preview h2 { margin: 22px 0 10px; font-size: 22px; font-weight: 700; }
.cs-md__preview h3 { margin: 18px 0 8px; font-size: 18px; font-weight: 700; }
.cs-md__preview p, .cs-md__preview ul, .cs-md__preview ol, .cs-md__preview pre, .cs-md__preview blockquote, .cs-md__preview table { margin: 0 0 14px; }
.cs-md__preview ul, .cs-md__preview ol { padding-left: 22px; }
.cs-md__preview blockquote { padding: 4px 16px; border-left: 3px solid var(--t-accent); color: var(--t-muted); }
.cs-md__preview pre { padding: 14px 16px; overflow: auto; border-radius: 8px; background: #23283a; color: #f1f2f6; font-size: 14px; line-height: 1.5; }
.cs-md__preview pre code { padding: 0; background: none; color: inherit; }
.cs-md__preview img { max-width: 100%; height: auto; }
.cs-md__preview table { border-collapse: collapse; }
.cs-md__preview th, .cs-md__preview td { padding: 6px 12px; border: 1px solid var(--t-line); }

/* SQL for WordPress */
.cs-form { display: grid; grid-template-columns: 200px 1fr 1fr; gap: 16px 20px; }
.cs-form__row { display: flex; flex-direction: column; gap: 8px; margin: 0; font-size: 14.5px; font-weight: 600; }
.cs-code { margin-top: 20px; overflow: hidden; border-radius: var(--t-radius); background: #23283a; }
.cs-code__head { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid rgba(255, 255, 255, .1); color: #a9b0c6; font-size: 13px; font-weight: 600; letter-spacing: .06em; }
.cs-tools .cs-code__head .cs-link { color: #fff; letter-spacing: 0; }
.cs-tools .cs-code__body { margin: 0; padding: 16px; overflow: auto; border: 0; border-radius: 0; background: none; color: #e9edfb; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }

/* Emoji Kitchen */
.cs-emoji__stage { display: flex; align-items: center; justify-content: center; gap: 14px; }
.cs-emoji__slot { width: 84px; height: 84px; padding: 0; border: 2px dashed #c6cbdb; border-radius: 18px; background: #fff; font-size: 46px; line-height: 1; cursor: pointer; transition: border-color .15s; }
.cs-emoji__slot:not(:empty) { border-style: solid; border-color: var(--t-line); }
.cs-emoji__slot:hover { border-color: var(--t-primary); }
.cs-emoji__sign { color: var(--t-muted); font-size: 28px; font-weight: 300; }
.cs-emoji__result { display: flex; align-items: center; justify-content: center; width: 132px; height: 132px; padding: 8px; border: 1px solid var(--t-line); border-radius: 22px; background: #fff; color: var(--t-muted); font-size: 13px; line-height: 1.35; text-align: center; }
.cs-emoji__result img { display: block; max-width: 100%; max-height: 100%; }
.cs-emoji__result img[hidden] { display: none; }
.cs-emoji__actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 20px; margin: 20px 0; }
.cs-emoji__search { max-width: 420px; margin: 0 auto 14px; }
.cs-emoji__grid { display: flex; flex-wrap: wrap; gap: 2px; max-height: 300px; padding: 8px; overflow-y: auto; border: 1px solid var(--t-line); border-radius: var(--t-radius); background: #fff; }
.cs-emoji__grid button { width: 44px; height: 44px; padding: 0; border: 0; border-radius: 10px; background: none; font-size: 26px; line-height: 1; cursor: pointer; transition: background .12s, opacity .12s; }
.cs-emoji__grid button[hidden] { display: none; }
.cs-emoji__grid button:hover { background: var(--t-soft); }
.cs-emoji__grid button.is-off { opacity: .22; }
.cs-emoji__grid button.is-chosen { background: #e9edfb; box-shadow: inset 0 0 0 2px var(--t-primary); opacity: 1; }
.cs-tools .cs-emoji__title { margin: 24px 0 12px; font-size: 16px; font-weight: 700; }
.cs-emoji__mixes { display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 8px; max-height: 360px; overflow-y: auto; }
.cs-emoji__mixes:empty { display: none; }
.cs-emoji__mixes img { width: 100%; aspect-ratio: 1; padding: 6px; border: 1px solid transparent; border-radius: 12px; background: #fff; cursor: pointer; transition: border-color .12s, transform .12s; }
.cs-emoji__mixes img:hover { border-color: var(--t-primary); transform: scale(1.06); }

@media (max-width: 767px) {
    .cs-tools__lead { margin-bottom: 20px; font-size: 16px; }
    .cs-tool__app { padding: 16px; }
    .cs-tools__grid, .cs-tools__more .cs-tools__grid { grid-template-columns: minmax(0, 1fr); }
    .cs-switch { max-width: 100%; }
    .cs-switch label { min-width: 0; }
    .cs-switch span { padding: 8px 10px; font-size: 13.5px; }
    .cs-split, .cs-pass__settings, .cs-form { grid-template-columns: 1fr; }
    .cs-pass__main { flex-wrap: wrap; }
    .cs-pass__value { flex-basis: 100%; font-size: 17px; }
    .cs-pass__main .cs-btn { flex: 1; }
    .cs-md__input, .cs-md__preview { min-height: 260px; }
    .cs-emoji__stage { gap: 6px; }
    .cs-emoji__slot { width: 56px; height: 56px; border-radius: 14px; font-size: 30px; }
    .cs-emoji__sign { font-size: 22px; }
    .cs-emoji__result { flex: 0 1 92px; width: auto; min-width: 0; height: 92px; border-radius: 18px; }
    .cs-emoji__slot { flex: 0 1 56px; min-width: 40px; }
}
