.tools-page {
    --tools-bg: #101116;
    --tools-panel: #191b23;
    --tools-card: #20232d;
    --tools-border: #303440;
    --tools-text: #f3f4f8;
    --tools-muted: #a3a8b7;
    --tools-accent: #a86bff;
    --tools-accent-light: #d6b7ff;
    margin: 0;
    min-height: 100vh;
    background: var(--tools-bg);
    color: var(--tools-text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.tools-page * {
    box-sizing: border-box;
}

.tools-main {
    width: min(1120px, calc(100% - 40px));
    margin: 0 auto;
    padding: 56px 0 80px;
}

.tools-intro {
    margin-bottom: 28px;
}

.tools-eyebrow,
.preview-label {
    margin: 0 0 10px;
    color: var(--tools-accent-light);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: .14em;
}

.tools-intro h1 {
    margin: 0;
    color: var(--tools-text);
    font-size: clamp(36px, 6vw, 58px);
    letter-spacing: -.05em;
}

.tools-intro h1 span {
    color: var(--tools-accent-light);
}

.tools-intro > p:last-child,
.panel-heading > div > p:last-child {
    max-width: 660px;
    margin: 12px 0 0;
    color: var(--tools-muted);
    line-height: 1.65;
}

.tool-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 32px 0 16px;
}

.tool-tab,
.tool-button {
    border: 1px solid var(--tools-border);
    border-radius: 9px;
    color: var(--tools-text);
    background: var(--tools-card);
    font: inherit;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

.tool-tab {
    padding: 11px 15px;
    color: var(--tools-muted);
    font-size: 14px;
}

.tool-tab:hover,
.tool-button:hover {
    border-color: var(--tools-accent);
    transform: translateY(-1px);
}

.tool-tab.is-active,
.tool-button {
    border-color: var(--tools-accent);
    color: #fff;
    background: #7040b8;
}

.tool-panel {
    min-height: 320px;
    padding: 26px;
    border: 1px solid var(--tools-border);
    border-radius: 16px;
    background: var(--tools-panel);
}

.tool-panel[hidden] {
    display: none;
}

.tool-panel.is-active {
    display: block;
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
}

.panel-heading h2 {
    margin: 0;
    font-size: 24px;
}

.panel-heading .tools-eyebrow {
    margin-bottom: 7px;
}

.timestamp-layout,
.snowflake-layout,
.webhook-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
    gap: 28px;
}

.tool-form {
    display: grid;
    align-content: start;
    gap: 16px;
}

.tool-form label,
.result-field > label {
    display: grid;
    gap: 8px;
    color: var(--tools-muted);
    font-size: 13px;
    font-weight: 600;
}

.tool-form input:not([type="color"]):not([type="checkbox"]),
.tool-form textarea,
.tool-form select,
.copy-row input {
    width: 100%;
    border: 1px solid var(--tools-border);
    border-radius: 9px;
    outline: none;
    padding: 11px 12px;
    color: var(--tools-text);
    background: #11131a;
    font: inherit;
    font-weight: 400;
}

.tool-form input:focus,
.tool-form textarea:focus,
.tool-form select:focus,
.copy-row input:focus {
    border-color: var(--tools-accent);
}

.tool-form textarea {
    resize: vertical;
}

.tool-button {
    justify-self: start;
    padding: 10px 15px;
    font-size: 13px;
    font-weight: 650;
    text-decoration: none;
}

.timestamp-converter,
.snowflake-result {
    display: grid;
    align-content: start;
    gap: 16px;
    padding: 20px;
    border: 1px solid var(--tools-border);
    border-radius: 12px;
    background: var(--tools-card);
}

.timestamp-layout h3 {
    margin: 0;
    font-size: 16px;
}

.result-field {
    display: grid;
    gap: 9px;
}

.copy-row {
    display: flex;
    gap: 8px;
}

.copy-row .tool-button {
    flex: 0 0 auto;
}

.timestamp-preview {
    min-height: 20px;
    margin: 0;
    color: var(--tools-accent-light);
    font-size: 13px;
}

.snowflake-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.snowflake-meta div {
    display: grid;
    gap: 5px;
    padding: 11px;
    border-radius: 8px;
    background: #14151b;
}

.snowflake-meta span {
    color: var(--tools-muted);
    font-size: 11px;
}

.snowflake-meta strong {
    overflow-wrap: anywhere;
    font-size: 14px;
}

.field-hint {
    margin: 0;
    color: var(--tools-muted);
    font-size: 12px;
    line-height: 1.6;
}

.field-error {
    margin: 0;
    color: #ff8888;
    font-size: 13px;
}

.tool-feedback {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 5;
    margin: 0;
    padding: 11px 16px;
    border: 1px solid var(--tools-border);
    border-radius: 9px;
    background: var(--tools-card);
    color: var(--tools-text);
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease;
}

.tool-feedback.is-visible {
    opacity: 1;
}

.webhook-form {
    min-width: 0;
    gap: 13px;
}

.webhook-form > label {
    display: grid;
    gap: 8px;
    color: var(--tools-muted);
    font-size: 13px;
    font-weight: 600;
}

.webhook-editor-column,
.webhook-preview-column {
    min-width: 0;
}

.webhook-layout {
    grid-template-columns: minmax(0, 1.08fr) minmax(330px, .92fr);
    gap: 28px;
}

.webhook-field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.webhook-field-grid label {
    display: grid;
    min-width: 0;
    align-content: start;
    gap: 7px;
    color: var(--tools-muted);
    font-size: 12px;
    font-weight: 650;
}

.webhook-field-wide {
    grid-column: 1 / -1;
}

.webhook-form input:not([type="checkbox"]):not([type="color"]),
.webhook-form textarea {
    width: 100%;
    border: 1px solid var(--tools-border);
    border-radius: 9px;
    outline: none;
    padding: 11px 12px;
    color: var(--tools-text);
    background: #11131a;
    font: inherit;
    font-weight: 400;
}

.webhook-form input:focus,
.webhook-form textarea:focus {
    border-color: var(--tools-accent);
}

.webhook-form textarea {
    resize: vertical;
}

.webhook-form textarea#webhook-content {
    min-height: 138px;
}

.webhook-form textarea#webhook-embed-description {
    min-height: 104px;
}

.webhook-message-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: -7px;
    color: var(--tools-muted);
    font-size: 11px;
}

.webhook-checkbox {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 68px;
    padding: 12px 14px;
    border: 1px solid var(--tools-border);
    border-radius: 12px;
    color: var(--tools-text);
    background:
        linear-gradient(115deg, rgb(168 107 255 / 8%), transparent 55%),
        #191b23;
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.webhook-checkbox input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    clip-path: inset(50%);
}

.webhook-checkbox:hover,
.webhook-checkbox:focus-within {
    border-color: rgb(168 107 255 / 70%);
    box-shadow: 0 0 0 3px rgb(168 107 255 / 10%);
}

.webhook-checkbox:has(input:checked) {
    border-color: rgb(168 107 255 / 75%);
    background:
        linear-gradient(115deg, rgb(168 107 255 / 16%), rgb(112 64 184 / 7%) 62%),
        #191b23;
}

.webhook-checkbox-copy {
    display: grid;
    flex: 1;
    gap: 4px;
}

.webhook-checkbox-title {
    font-size: 13px;
    font-weight: 700;
}

.webhook-checkbox-description {
    color: var(--tools-muted);
    font-size: 11px;
    line-height: 1.4;
}

.webhook-switch {
    position: relative;
    width: 42px;
    height: 24px;
    flex: 0 0 auto;
    border: 1px solid #444957;
    border-radius: 999px;
    background: #303440;
    transition: border-color .18s ease, background .18s ease;
}

.webhook-switch::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #c2c5ce;
    content: "";
    transition: transform .18s ease, background .18s ease;
}

.webhook-checkbox input:checked + .webhook-checkbox-copy + .webhook-switch {
    border-color: #a86bff;
    background: #7040b8;
}

.webhook-checkbox input:checked + .webhook-checkbox-copy + .webhook-switch::after {
    transform: translateX(18px);
    background: #fff;
}

.webhook-checkbox input:focus-visible + .webhook-checkbox-copy + .webhook-switch {
    outline: 2px solid #d6b7ff;
    outline-offset: 3px;
}

.webhook-embed-options {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--tools-border);
    border-radius: 10px;
    background: var(--tools-card);
}

.webhook-embed-options[hidden] {
    display: none;
}

.webhook-embed-options input[type="color"] {
    width: 48px;
    height: 38px;
    padding: 3px;
    border: 1px solid var(--tools-border);
    border-radius: 8px;
    background: var(--tools-panel);
}

.webhook-send-button {
    min-width: 150px;
    min-height: 44px;
    box-shadow: 0 8px 22px rgb(112 64 184 / 24%);
}

.webhook-preview-column {
    position: sticky;
    top: 22px;
    align-self: start;
    padding: 18px;
    border: 1px solid var(--tools-border);
    border-radius: 14px;
    background:
        radial-gradient(ellipse at top right, rgb(168 107 255 / 9%), transparent 48%),
        #15171e;
}

.webhook-preview-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.webhook-preview-heading .tools-eyebrow {
    margin-bottom: 5px;
}

.webhook-preview-heading h3 {
    margin: 0;
    font-size: 16px;
}

.webhook-preview-live {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #91e0ae;
    font-size: 9px;
    font-weight: 750;
    letter-spacing: .1em;
}

.webhook-preview-live span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4bd17f;
    box-shadow: 0 0 10px rgb(75 209 127 / 60%);
}

.discord-preview {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    min-height: 160px;
    padding: 17px 14px;
    border: 1px solid #2d2f36;
    border-radius: 10px;
    background: #313338;
    color: #dbdee1;
    font-family: Whitney, "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

.discord-preview-avatar-wrap {
    flex: 0 0 auto;
}

.discord-preview-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #202127;
    object-fit: cover;
}

.discord-preview-body {
    min-width: 0;
    flex: 1;
}

.discord-preview-message-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 22px;
    margin-bottom: 3px;
}

.discord-preview-message-header strong {
    overflow: hidden;
    max-width: 70%;
    color: #f2f3f5;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.discord-preview-bot {
    border-radius: 3px;
    padding: 1px 4px;
    color: #fff;
    background: #5865f2;
    font-size: 9px;
    font-weight: 750;
    line-height: 1.5;
}

.discord-preview-message-header time {
    color: #949ba4;
    font-size: 11px;
}

.discord-preview-content {
    overflow-wrap: anywhere;
    white-space: normal;
}

.discord-preview-content:empty {
    display: none;
}

.discord-preview-content a,
.discord-preview-embed-title {
    color: #00a8fc;
    text-decoration: none;
}

.discord-preview-content a:hover,
.discord-preview-embed-title:hover {
    text-decoration: underline;
}

.discord-markdown-inline,
.discord-markdown-code-block {
    border-radius: 4px;
    background: #2b2d31;
    color: #f2a6d5;
    font-family: Consolas, "Liberation Mono", Menlo, monospace;
}

.discord-markdown-inline {
    padding: 2px 4px;
    font-size:  .92em;
}

.discord-markdown-code-block {
    display: inline-block;
    max-width: 100%;
    overflow: auto;
    padding: 8px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.discord-markdown-spoiler {
    border-radius: 3px;
    background: #202127;
    color: transparent;
    cursor: pointer;
    transition: color .12s ease;
}

.discord-markdown-spoiler:hover {
    color: #dbdee1;
}

.discord-markdown-mention {
    border-radius: 3px;
    padding: 0 2px;
    color: #c9cdfb;
    background: rgb(88 101 242 / 28%);
    font-weight: 550;
}

.discord-markdown-timestamp {
    border-radius: 3px;
    padding: 0 2px;
    color: #c9cdfb;
    background: rgb(88 101 242 / 20%);
}

.discord-markdown-quote {
    margin: 3px 0;
    border-left: 3px solid #4e5058;
    padding-left: 9px;
}

.discord-preview-embed {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    max-width: 100%;
    margin-top: 10px;
    overflow: hidden;
    border: 1px solid #25262b;
    border-left: 4px solid var(--webhook-embed-color, #5865f2);
    border-radius: 4px;
    padding: 12px;
    background: #2b2d31;
}

.discord-preview-embed[hidden] {
    display: none;
}

.discord-preview-embed-main {
    min-width: 0;
}

.discord-preview-embed-author {
    margin-bottom: 7px;
    color: #f2f3f5;
    font-size: 12px;
    font-weight: 650;
}

.discord-preview-embed-title {
    display: block;
    margin-bottom: 6px;
    color: #00a8fc;
    font-size: 14px;
    font-weight: 650;
    overflow-wrap: anywhere;
}

.discord-preview-embed-description {
    color: #dbdee1;
    font-size: 12px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.discord-preview-embed-description[hidden] {
    display: none;
}

.discord-preview-embed-image {
    display: block;
    max-width: 100%;
    max-height: 240px;
    margin-top: 12px;
    border-radius: 4px;
    object-fit: contain;
    object-position: left;
}

.discord-preview-embed-image[hidden],
.discord-preview-embed-thumbnail[hidden] {
    display: none;
}

.discord-preview-embed-thumbnail {
    width: 76px;
    height: 76px;
    border-radius: 4px;
    object-fit: cover;
}

.discord-preview-embed-footer {
    margin-top: 12px;
    color: #b5bac1;
    font-size: 11px;
    overflow-wrap: anywhere;
}

.discord-preview-embed-footer[hidden],
.discord-preview-embed-author[hidden],
.discord-preview-embed-title[hidden] {
    display: none;
}

.webhook-preview-note {
    margin: 12px 0 0;
    color: var(--tools-muted);
    font-size: 11px;
    line-height: 1.55;
}

.webhook-status {
    min-height: 18px;
    margin: 0;
    color: var(--tools-muted);
    font-size: 13px;
}

.webhook-status.is-success {
    color: #77dda0;
}

.webhook-status.is-error {
    color: #ff8888;
}

.tool-button:disabled {
    cursor: wait;
    opacity: .65;
    transform: none;
}

@media (max-width: 720px) {
    .tools-main {
        padding-top: 38px;
    }

    .timestamp-layout,
    .snowflake-layout,
    .webhook-layout {
        grid-template-columns: 1fr;
    }

    .webhook-preview-column {
        position: static;
        grid-row: 1;
    }

    .tool-panel {
        padding: 20px;
    }

}

@media (max-width: 480px) {
    .tools-main {
        width: calc(100% - 28px);
    }

    .copy-row {
        flex-wrap: wrap;
    }
}
