html {
    scroll-behavior: smooth;
}

.nav-link {
    display: inline-block;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.15);
    padding: 0.45rem 0.9rem;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.3);
}

.tool-card {
    border-radius: 0.75rem;
    border: 1px solid rgb(203 213 225);
    background: rgba(255, 255, 255, 0.9);
    padding: 1rem;
    box-shadow: 0 8px 24px -20px rgba(15, 23, 42, 0.8);
}

.dark .tool-card {
    border-color: rgb(51 65 85);
    background: rgba(15, 23, 42, 0.9);
}

.analytics-card {
    border-radius: 0.75rem;
    border: 1px solid rgb(203 213 225);
    background: rgba(255, 255, 255, 0.92);
    padding: 0.85rem;
    box-shadow: 0 8px 24px -20px rgba(15, 23, 42, 0.8);
}

.dark .analytics-card {
    border-color: rgb(51 65 85);
    background: rgba(15, 23, 42, 0.92);
}

.analytics-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
    margin-top: 0.55rem;
    margin-bottom: 0.65rem;
}

.analytics-metric {
    border-radius: 0.5rem;
    border: 1px solid rgb(203 213 225);
    background: rgb(248 250 252);
    padding: 0.45rem 0.5rem;
}

.dark .analytics-metric {
    border-color: rgb(71 85 105);
    background: rgb(30 41 59);
}

.analytics-label {
    font-size: 0.68rem;
    color: rgb(71 85 105);
}

.dark .analytics-label {
    color: rgb(203 213 225);
}

.analytics-value {
    margin-top: 0.15rem;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.1;
    color: rgb(15 23 42);
}

.dark .analytics-value {
    color: rgb(241 245 249);
}

.analytics-top-tools {
    margin-top: 0.35rem;
    list-style: none;
    padding-left: 0;
    display: grid;
    gap: 0.2rem;
    font-size: 0.75rem;
    color: rgb(15 23 42);
}

.dark .analytics-top-tools {
    color: rgb(226 232 240);
}

.tool-title {
    margin-bottom: 0.75rem;
    font-size: 1.125rem;
    font-weight: 700;
}

.input,
.textarea {
    width: 100%;
    border-radius: 0.5rem;
    border: 1px solid rgb(148 163 184);
    background: white;
    padding: 0.6rem 0.7rem;
    color: rgb(15 23 42);
}

.dark .input,
.dark .textarea {
    border-color: rgb(71 85 105);
    background: rgb(30 41 59);
    color: rgb(226 232 240);
}

.btn-primary,
.btn-secondary {
    border-radius: 0.5rem;
    padding: 0.55rem 0.9rem;
    font-weight: 600;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.btn-primary {
    background: rgb(14 116 144);
    color: white;
}

.btn-primary:hover {
    background: rgb(8 102 126);
}

.btn-secondary {
    background: rgb(51 65 85);
    color: white;
}

.btn-secondary:hover {
    background: rgb(30 41 59);
}

.dark .btn-primary {
    background: rgb(34 211 238);
    color: rgb(8 47 73);
}

.dark .btn-primary:hover {
    background: rgb(103 232 249);
}

.dark .btn-secondary {
    background: rgb(148 163 184);
    color: rgb(15 23 42);
}

.dark .btn-secondary:hover {
    background: rgb(203 213 225);
}

.output {
    margin-top: 0.5rem;
    white-space: pre-wrap;
    word-break: break-word;
    border-radius: 0.5rem;
    border: 1px solid rgb(148 163 184);
    background: rgb(248 250 252);
    padding: 0.75rem;
    font-size: 0.85rem;
}

.dark .output {
    border-color: rgb(71 85 105);
    background: rgb(15 23 42);
}

.helper-text {
    font-size: 0.75rem;
    color: rgb(71 85 105);
}

.dark .helper-text {
    color: rgb(203 213 225);
}

.tooltip-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.35rem;
    margin: 0 0.1rem;
    border-radius: 9999px;
    border: 1px solid rgb(148 163 184);
    background: rgb(241 245 249);
    color: rgb(15 23 42);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.75rem;
    line-height: 1;
    cursor: help;
}

.tooltip-chip:focus-visible {
    outline: 2px solid rgb(14 116 144);
    outline-offset: 2px;
}

.dark .tooltip-chip {
    border-color: rgb(100 116 139);
    background: rgb(30 41 59);
    color: rgb(226 232 240);
}

.tooltip-chip::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    width: max-content;
    max-width: 18rem;
    transform: translateX(-50%) translateY(4px);
    border: 1px solid rgb(51 65 85);
    border-radius: 0.45rem;
    background: rgb(15 23 42);
    color: rgb(241 245 249);
    padding: 0.45rem 0.55rem;
    white-space: normal;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 0.72rem;
    line-height: 1.3;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease, transform 0.12s ease;
    z-index: 40;
    box-shadow: 0 10px 24px -16px rgba(15, 23, 42, 0.9);
}

.tooltip-chip::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: calc(100% + 4px);
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgb(15 23 42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease;
    z-index: 40;
}

.tooltip-chip:hover::after,
.tooltip-chip:hover::before,
.tooltip-chip:focus-visible::after,
.tooltip-chip:focus-visible::before {
    opacity: 1;
}

.tooltip-chip:hover::after,
.tooltip-chip:focus-visible::after {
    transform: translateX(-50%) translateY(0);
}

.dark .tooltip-chip::after {
    border-color: rgb(148 163 184);
    background: rgb(226 232 240);
    color: rgb(15 23 42);
}

.dark .tooltip-chip::before {
    border-top-color: rgb(226 232 240);
}

.dark #global-error {
    border-color: rgb(248 113 113);
    background: rgb(69 10 10);
    color: rgb(254 226 226);
}

#regex-highlight mark {
    border-radius: 0.2rem;
    background: #facc15;
    color: #111827;
    padding: 0.05rem 0.15rem;
}
