html {
    height: 100%;
}

body {
    min-height: 100%;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    font-size: 1rem;
    background: #f9f9f9;
    color: #222;
    display: flex;
    flex-direction: column;
}

a {
    color: #666;
    /*text-decoration: none;*/
}

a:hover {
    color: #000;
}

.site-title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 2rem;
    margin: 0;
}

.site-logo-button {
    display: inline-flex;
    align-items: center;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0.4rem 1rem;
    text-decoration: none;
    font-weight: bold;
    color: #333;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    gap: 0.5rem;
}

.site-logo-button:hover {
    border-color: #aaa;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.site-logo-icon {
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
    margin-top: 0.4rem;
    display: inline-block;
}

.site-subtitle {
    font-weight: 500;
    color: #333;
    font-size: 1em;
}

.highlight {
    color: #666;
}

header {
    background: #f0f0f0;
    padding: 1.5rem 1rem;
    border-bottom: 1px solid #ddd;
    text-align: center;
}

header h1 {
    margin: 0;
    font-size: 2rem;
}

.page-description {
    font-size: 1rem;
    color: #555;
    margin-top: 0.5rem;
    margin-bottom: 0;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.1rem;
    max-width: 1200px;
    margin: auto;
    width: 100%;
    box-sizing: border-box;
    min-height: 0;
}

.home-page main {
    flex: 0 1 auto;
}

.nav-bar {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
}

.search-bar {
    width: 100%;
    margin-bottom: 1.1rem;
    display: flex;
}

.search-bar input {
    width: 100%;
    max-width: 400px;
    padding: 0.6rem 1.1rem;
    font-size: 1.1rem;
    border: 1px solid #ccc;
    border-radius: 8px;
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.1rem;
    margin: 1em 0 1em 0;
}

.tool-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1.1rem;
    text-align: center;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tool-card:hover {
    border-color: #aaa;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.tool-card img {
    max-width: 48px;
    margin-bottom: 0.5rem;
}

.tool-card h3 {
    margin: 0.3rem 0;
    font-size: 1.1rem;
}

.tool-card p {
    font-size: 0.9rem;
    color: #555;
}

footer {
    padding: 1.1rem;
    background: #f0f0f0;
    border-top: 1px solid #ddd;
    text-align: center;
    font-size: 0.9rem;
    color: #666;
}

footer a {
    color: #0073aa;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.tool-body-full {
    flex: 1;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    width: 100%;
    min-height: 0;
}

.tool-form {
    width: 100%;
    margin-bottom: 1.1rem;
    display: flex;
    flex-direction: column;
}

.tool-form-group {
    margin-bottom: 1.1rem;
}

.tool-form-group>label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1.1rem;
}

.form-row label {
    font-weight: 500;
}

.form-row input[type="number"] {
    width: 80px;
    margin: 0;
}

.form-row .tool-input {
    flex-grow: 1;
}

.checkbox-group-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.checkbox-group-inline label {
    font-weight: normal;
    margin: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.tool-form.fill-height {
    flex: 1 1 0;
    min-height: 0;
    margin-bottom: 0;
}

.tool-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.1rem;
}

.tool-controls label {
    font-size: 0.95rem;
}

.tool-controls select,
.tool-controls button {
    height: 34px;
    font-size: 1.1rem;
    padding: 0 1.1rem;
    border: 1px solid #aaa;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-family: inherit;
}

.tool-controls select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #666 50%), linear-gradient(135deg, #666 50%, transparent 50%);
    background-position: right 10px center;
    background-repeat: no-repeat;
    background-size: 8px 8px, 8px 8px;
    padding-right: 2rem;
}

.tool-controls-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.tool-controls-inline label {
    font-size: 0.95rem;
}

.tool-controls-inline select,
.tool-controls-inline button {
    font-size: 0.95rem;
    padding: 0.5rem 1.1rem;
    border: 1px solid #aaa;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-family: inherit;
}

.tool-box {
    margin: 0.5rem;
}

.button-link {
    display: inline-block;
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 500;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-decoration: none;
    color: #000;
    cursor: pointer;
}

.button-link:hover {
    background-color: #e0e0e0;
}

.input-group {
    display: flex;
    width: 100%;
    align-items: center;
}

.length-quantity-row {
    display: flex;
    gap: 1.1rem;
    margin-bottom: 1.1rem;
    align-items: center;
}

.length-quantity-row label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-group input {
    flex-grow: 1;
    min-width: 0;
    box-sizing: border-box;
    border: 1.5px solid #bfc7d1;
    border-radius: 6px;
    background: #f7fafd;
    font-size: 1rem;
    padding: 0.5rem;
    color: #222;
    transition: border 0.2s;
    outline: none;
    font-family: inherit;
}

.input-group input:focus {
    border-color: #3b82f6;
    background: #fff;
}

input[type="number"] {
    width: 80px;
    padding: 0.5rem;
    border: 1.5px solid #bfc7d1;
    border-radius: 6px;
    background: #f7fafd;
    font-size: 1rem;
    margin: 0.5rem;
}

.input-group button {
    margin-left: 8px;
    height: 44px;
    font-size: 0.95rem;
    padding: 0 1.1rem;
    border: 1px solid #aaa;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-family: inherit;
}

.textarea-fill {
    flex: 1 1 0;
    min-height: 0;
    resize: none;
    font-family: inherit;
    box-sizing: border-box;
    border: 1.5px solid #bfc7d1;
    border-radius: 6px;
    background: #f7fafd;
    font-size: 1.1em;
    padding: 10px 14px;
    color: #222;
    transition: border 0.2s;
    outline: none;
    margin-bottom: 1em;
    overflow-y: auto;
}

.textarea-fill:focus {
    border-color: #3b82f6;
    background: #fff;
}

#whois-result-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin: 0.5rem;
}

.whois-result {
    flex: 1;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    background: #fff;
    border: 1.5px solid #bfc7d1;
    border-radius: 6px;
    padding: 14px 14px;
    font-family: monospace;
    font-size: 1.05em;
    color: #222;
}

@media (max-width: 600px) {
    .tool-grid {
        grid-template-columns: 1fr;
    }

    .tool-card {
        display: flex;
        align-items: center;
        text-align: left;
    }

    .tool-card img {
        margin-right: 1.1rem;
    }

    .tool-card h3,
    .tool-card p {
        display: inline;
    }

    .tool-card h3 {
        margin-right: 0.4rem;
    }

    .tool-card p {
        margin-left: 0;
    }
}

.calculator-body {
    justify-content: center;
}

.calculator-output .input-group {
    margin-bottom: 0.75rem;
}

.calculator-output .input-group:last-child {
    margin-bottom: 0;
}

.calculator-output label {
    flex: 0 0 4em;
    padding-right: 1em;
    text-align: right;
    font-weight: bold;
    font-family: monospace;
    font-size: 1.1em;
}

.calculator-output input {
    font-family: monospace;
    font-size: 1.1em;
    background-color: #fff !important;
}

#ts-to-date-output,
#date-to-ts-output {
    margin-top: 0.75rem;
}

#preview-img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.1rem auto;
}

.tool-output {
    margin-top: 1.1rem;
    text-align: center;
}

#download-link {
    display: inline-block;
    margin-top: 1.1rem;
}

input[type="file"] {
    font-family: inherit;
    margin-top: 0.5rem;
}

input[type="file"]::file-selector-button {
    height: 34px;
    font-size: 1rem;
    padding: 0 1rem;
    border: 1px solid #aaa;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-family: inherit;
}

input[type="file"]::file-selector-button:hover {
    border-color: #888;
}

#quality-container {
    display: none;
    margin-top: 1.1rem;
    align-items: center;
    gap: 1.1rem;
    flex-wrap: wrap;
}

#quality-container label {
    font-size: 1.1rem;
    white-space: nowrap;
}

#quality {
    flex: 1;
    min-width: 180px;
    max-width: 100%;
}

.site-title {
    font-size: 2rem;
    font-weight: bold;
    text-decoration: none;
    color: #222;
}

.site-title:hover {
    text-decoration: underline;
}

.visually-hidden {
    position: absolute;
    left: -9999px;
}

#results:empty::before {
    content: attr(data-placeholder);
    color: #999;
    font-style: italic;
    pointer-events: none;
    display: block;
    white-space: pre-wrap;
}

.codemirror-placeholder::before {
    content: attr(data-placeholder);
    color: #999;
    font-style: italic;
    position: absolute;
    left: 4px;
    top: 6px;
    pointer-events: none;
    white-space: pre-wrap;
}

.CodeMirror .CodeMirror-placeholder {
    color: #999 !important;
    font-style: italic !important;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.75rem;
}

td {
    vertical-align: middle;
}

td:first-child {
    white-space: nowrap;
    width: 1%;
}
