:root {
    color-scheme: dark;
}

html, body {
    font-family: "Space Grotesk", sans-serif;
    margin: 0;
    min-height: 100%;
    width: 100%;
}

body {
    background: #08110c;
}

a {
    color: inherit;
    text-decoration: none;
}

h1, h2, h3, h4 {
    font-weight: 700;
    letter-spacing: -0.03em;
}

p {
    color: var(--theme-text-secondary);
}

.app-theme {
    --theme-primary: #2fbf71;
    --theme-secondary: #a3e635;
    --theme-background: #0b1510;
    --theme-surface: #122019;
    --theme-text-primary: #edf7ef;
    --theme-text-secondary: #afc7b6;
    background:
        radial-gradient(circle at top left, color-mix(in srgb, var(--theme-primary) 22%, transparent), transparent 34%),
        linear-gradient(180deg, var(--theme-background) 0%, color-mix(in srgb, var(--theme-background) 90%, black) 100%);
    color: var(--theme-text-primary);
    min-height: 100%;
}

.app-theme.theme-orange {
    --theme-primary: #f97316;
    --theme-secondary: #fdba74;
    --theme-background: #0f1411;
    --theme-surface: #17201b;
    --theme-text-primary: #f8f5f0;
    --theme-text-secondary: #c2b7a7;
}

.app-theme.theme-light {
    --theme-background: #f8fdf9;
    --theme-surface: rgba(255, 255, 255, 0.92);
    --theme-text-primary: #183126;
    --theme-text-secondary: #567063;
    color-scheme: light;
}

.hero-panel,
.tool-panel,
.tool-card,
.result-panel {
    background: linear-gradient(180deg, color-mix(in srgb, var(--theme-surface) 94%, white 6%), color-mix(in srgb, var(--theme-surface) 98%, black 2%));
    border: 1px solid color-mix(in srgb, var(--theme-primary) 16%, transparent);
    border-radius: 24px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.18);
}

.hero-panel {
    margin-bottom: 1.5rem;
    max-width: 680px;
    padding: 2rem;
}

.hero-kicker,
.nav-kicker {
    color: var(--theme-primary);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.hero-copy {
    max-width: 60ch;
}

.tool-card {
    padding: 1.1rem;
}

.tool-grid {
    margin-top: 1rem;
}

/* ── Home page footer (feedback + coffee) ─────────────────── */
.home-footer {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: 1fr 1fr;
    margin-top: 2.5rem;
}

.home-footer-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.75rem !important;
    text-align: center;
}

.home-footer-icon {
    font-size: 2rem;
    margin-bottom: 0.25rem;
}

@media (max-width: 720px) {
    .home-footer {
        grid-template-columns: 1fr;
    }
}

.site-legal {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    opacity: 0.55;
    padding-bottom: 1.5rem;
}

.privacy-list {
    padding-left: 1.25rem;
    line-height: 2;
    font-size: 0.875rem;
}

.tool-hero {
    margin-bottom: 1.25rem;
}

.tool-hero h1 {
    margin: 0;
}

.tool-description {
    margin-top: 0.5rem;
    max-width: 70ch;
}

.tool-panel {
    height: 100%;
    padding: 1.25rem;
}

.tool-panel .mud-typography-overline {
    display: block;
    margin-bottom: 0.75rem;
}

.tool-actions,
.result-panel-header {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: flex-start;
}

.tool-actions {
    margin-top: 1rem;
}

.result-panel-header {
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.editor-shell {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
}

.editor-label {
    color: var(--theme-text-secondary);
}

.output-panel {
    min-height: 100%;
}

.output-panel .result-panel {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
}

.related-tools {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.regex-preview,
.markdown-preview-body {
    border: 1px solid color-mix(in srgb, var(--theme-primary) 16%, transparent);
    border-radius: 18px;
    padding: 1rem;
}

.regex-preview pre,
.markdown-preview-body {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.regex-preview mark {
    background: color-mix(in srgb, var(--theme-secondary) 72%, transparent);
    border-radius: 6px;
    color: var(--theme-text-primary);
    padding: 0.05rem 0.15rem;
}

.diff-grid {
    display: grid;
    gap: 0.5rem;
}

.diff-line {
    border: 1px solid color-mix(in srgb, var(--theme-primary) 10%, transparent);
    border-radius: 14px;
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr 1fr;
    padding: 0.85rem 1rem;
}

.diff-line span {
    font-family: "JetBrains Mono", monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.diff-line-changed {
    background: color-mix(in srgb, #ef4444 10%, var(--theme-surface));
    border-color: color-mix(in srgb, #ef4444 30%, transparent);
}

.diff-line-same {
    background: color-mix(in srgb, var(--theme-primary) 4%, var(--theme-surface));
}

.monaco-editor-host {
    border: 1px solid color-mix(in srgb, var(--theme-primary) 16%, transparent);
    border-radius: 18px;
    overflow: hidden;
    width: 100%;
}

.nav-shell .mud-nav-link,
.nav-shell .mud-nav-link.active {
    border-radius: 14px;
    margin-bottom: 0.25rem;
}

.nav-shell .mud-navmenu {
    gap: 0.25rem;
}

.mud-button-root {
    border-radius: 14px;
}

.mud-button-root.mud-button-filled {
    box-shadow: none;
}

.mud-input-control .mud-input-outlined-border {
    border-color: color-mix(in srgb, var(--theme-primary) 24%, transparent);
}

.mud-paper {
    backdrop-filter: blur(18px);
}

.mud-grid {
    width: 100%;
}

code, pre {
    font-family: "JetBrains Mono", monospace;
}

/* ── Multi-output rows (hash, number-base, text-case, etc.) ── */
.hash-results {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.hash-row {
    background: color-mix(in srgb, var(--theme-surface) 90%, transparent) !important;
    border: 1px solid color-mix(in srgb, var(--theme-primary) 14%, transparent) !important;
    border-radius: 16px !important;
    padding: 0.85rem 1rem !important;
}

.hash-value-row {
    align-items: center;
    display: flex;
    gap: 0.5rem;
    justify-content: space-between;
    margin-top: 0.25rem;
}

.hash-value {
    font-family: "JetBrains Mono", monospace;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Color converter ─────────────────────────────────────── */
.color-picker-row {
    align-items: center;
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.native-color-picker {
    border: 1px solid color-mix(in srgb, var(--theme-primary) 30%, transparent);
    border-radius: 12px;
    cursor: pointer;
    flex-shrink: 0;
    height: 52px;
    padding: 3px;
    width: 52px;
}

.color-swatch-shell {
    align-items: center;
    display: flex;
    gap: 0.75rem;
}

.color-swatch {
    border: 1px solid color-mix(in srgb, var(--theme-primary) 20%, transparent);
    border-radius: 12px;
    height: 48px;
    width: 80px;
}

.color-results {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.color-result-row {
    background: color-mix(in srgb, var(--theme-surface) 90%, transparent) !important;
    border: 1px solid color-mix(in srgb, var(--theme-primary) 14%, transparent) !important;
    border-radius: 16px !important;
    padding: 0.85rem 1rem !important;
}

.color-result-value {
    align-items: center;
    display: flex;
    gap: 0.5rem;
    justify-content: space-between;
    margin-top: 0.25rem;
}

/* ── Image tools ─────────────────────────────────────────── */
.image-input {
    border: 1px solid color-mix(in srgb, var(--theme-primary) 20%, transparent);
    border-radius: 14px;
    color: var(--theme-text-primary);
    padding: 0.5rem;
    width: 100%;
}

.image-preview-shell {
    align-items: flex-start;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.image-preview {
    border-radius: 14px;
    max-height: 180px;
    max-width: 100%;
    object-fit: contain;
}

.decoded-image-shell {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.decoded-image {
    border-radius: 14px;
    max-height: 260px;
    max-width: 100%;
    object-fit: contain;
}

/* ── QR code output ──────────────────────────────────────── */
.qr-output {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.qr-image {
    border-radius: 14px;
    max-width: 100%;
}

/* ── Word counter stat cards ─────────────────────────────── */
.word-count-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.stat-card {
    background: color-mix(in srgb, var(--theme-surface) 90%, transparent) !important;
    border: 1px solid color-mix(in srgb, var(--theme-primary) 14%, transparent) !important;
    border-radius: 16px !important;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem !important;
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.8rem;
}

.stat-label {
    color: var(--theme-text-secondary);
    font-size: 0.75rem;
}

/* ── Cron & Unix preset chips ─────────────────────────────── */
.preset-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* ── URL parser results table ────────────────────────────── */
.url-parse-results {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.params-table {
    background: transparent !important;
}

/* ── Unix permissions symbolic display ──────────────────── */
.perm-symbolic {
    font-size: 1.1rem;
    letter-spacing: 0.08em;
}

/* ── Ad slots ─────────────────────────────────────────────── */
.ad-slot {
    overflow: hidden;
    text-align: center;
}

.ad-slot-top {
    margin-bottom: 1rem;
    max-height: 100px;
    min-height: 60px;
}

.ad-slot-sidebar {
    margin-top: 1rem;
    max-height: 280px;
    min-height: 100px;
}

.ad-slot-bottom {
    margin-top: 1.5rem;
    max-height: 100px;
    min-height: 60px;
}

/* Collapse to zero space when AdSense is unconfigured (ins has no content) */
.ad-slot ins:empty {
    display: none;
}

@media (max-width: 960px) {
    .tool-panel,
    .hero-panel,
    .tool-card,
    .result-panel {
        border-radius: 20px;
    }

    .tool-panel {
        padding: 1rem;
    }
}
