.fox-scw {
    --fox-scw-accent: #38bdf8;
    --fox-scw-background: #ffffff;
    --fox-scw-panel: #f8fafc;
    --fox-scw-text: #1f2937;
    --fox-scw-muted: #64748b;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    width: min(100%, var(--fox-scw-width));
    height: var(--fox-scw-height);
    min-width: 280px;
    min-height: 360px;
    max-width: 100%;
    max-height: 85vh;
    overflow: hidden;
    resize: both;
    border: 1px solid #d8e1ec;
    border-radius: 14px;
    background: var(--fox-scw-background);
    color: var(--fox-scw-text);
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.fox-scw *,
.fox-scw *::before,
.fox-scw *::after {
    box-sizing: border-box;
}

.fox-scw__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px 8px;
    font-size: 15px;
}

.fox-scw__resize-label {
    color: var(--fox-scw-muted);
    font-size: 11px;
    font-weight: 500;
}

.fox-scw__tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding: 8px 12px 10px;
    border-bottom: 1px solid #e2e8f0;
}

.fox-scw__tab,
.fox-scw__send {
    appearance: none;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    color: var(--fox-scw-text);
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.fox-scw__tab {
    min-height: 34px;
    padding: 5px 8px;
}

.fox-scw__tab:hover,
.fox-scw__tab:focus-visible,
.fox-scw__tab.is-active {
    border-color: #0284c7;
    background: #e0f2fe;
    color: #075985;
    outline: none;
}

.fox-scw__messages {
    flex: 1 1 auto;
    min-height: 110px;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 10px 12px;
    background: linear-gradient(180deg, #f8fafc, #f1f5f9);
    scrollbar-color: #94a3b8 #f1f5f9;
}

.fox-scw__message {
    margin: 0 0 9px;
    padding: 9px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
}

.fox-scw__message-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 3px;
}

.fox-scw__message-name {
    overflow: hidden;
    color: #0369a1;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fox-scw__message-name.is-admin {
    color: #ff3b3b;
    font-weight: 800;
}

.fox-scw__message-name.is-admin::after {
    content: "管理者";
    display: inline-block;
    margin-left: 6px;
    padding: 1px 5px;
    border: 1px solid #ef4444;
    border-radius: 999px;
    color: #b91c1c;
    font-size: 9px;
    line-height: 1.4;
    vertical-align: 1px;
}

.fox-scw__message-name.is-bot {
    color: #2563eb;
    font-weight: 800;
}

.fox-scw__message-time {
    flex: 0 0 auto;
    color: var(--fox-scw-muted);
    font-size: 10px;
}

.fox-scw__edited-label {
    margin-left: 2px;
    font-size: 9px;
}

.fox-scw__message-body {
    margin: 0;
    color: var(--fox-scw-text);
    font-size: 13px;
    line-height: 1.55;
    overflow-wrap: anywhere;
    white-space: normal;
}

.fox-scw__line + .fox-scw__line,
.fox-scw__quote + .fox-scw__line,
.fox-scw__line + .fox-scw__quote {
    margin-top: 2px;
}

.fox-scw__quote {
    margin: 3px 0;
    padding-left: 9px;
    border-left: 3px solid #94a3b8;
    color: #475569;
}

.fox-scw__inline-code {
    padding: 1px 4px;
    border-radius: 4px;
    background: #e2e8f0;
    color: #be123c;
    font-family: Consolas, "SFMono-Regular", monospace;
    font-size: 0.92em;
}

.fox-scw__code-block {
    position: relative;
    margin: 5px 0;
    padding: 9px 10px;
    overflow-x: auto;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    background: #f1f5f9;
    color: #0f172a;
    font-family: Consolas, "SFMono-Regular", monospace;
    font-size: 11px;
    line-height: 1.45;
    white-space: pre;
}

.fox-scw__spoiler {
    border-radius: 3px;
    background: #334155;
    color: transparent;
    cursor: pointer;
    outline: none;
    user-select: none;
}

.fox-scw__spoiler.is-revealed,
.fox-scw__spoiler:focus-visible {
    background: #e2e8f0;
    color: inherit;
    user-select: text;
}

.fox-scw__mention {
    padding: 0 2px;
    border-radius: 3px;
    background: #dbeafe;
    color: #1d4ed8;
    font-weight: 600;
}

.fox-scw__link {
    color: #0369a1;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.fox-scw__link:hover,
.fox-scw__link:focus-visible {
    color: #075985;
}

.fox-scw__message-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 4px;
}

.fox-scw__edit-button,
.fox-scw__cancel-edit {
    appearance: none;
    border: 0;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    font: inherit;
    font-size: 10px;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.fox-scw__edit-button:hover,
.fox-scw__edit-button:focus-visible,
.fox-scw__cancel-edit:hover,
.fox-scw__cancel-edit:focus-visible {
    color: #0369a1;
    outline: none;
}

.fox-scw__empty {
    margin: 18px 4px;
    color: var(--fox-scw-muted);
    font-size: 12px;
    text-align: center;
}

.fox-scw__form {
    flex: 0 0 auto;
    padding: 10px 12px 12px;
    border-top: 1px solid #e2e8f0;
    background: var(--fox-scw-panel);
}

.fox-scw__nickname {
    display: block;
    margin-bottom: 6px;
    color: var(--fox-scw-muted);
    font-size: 11px;
}

.fox-scw__nickname strong {
    color: var(--fox-scw-text);
}

.fox-scw__input {
    display: block;
    width: 100%;
    min-height: 58px;
    max-height: 120px;
    margin: 0;
    padding: 9px 10px;
    resize: vertical;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    background: #ffffff;
    color: #111827;
    font: inherit;
    font-size: 13px;
    line-height: 1.45;
}

.fox-scw__format-toolbar {
    display: flex;
    gap: 4px;
    margin: 0 0 6px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.fox-scw__format-button {
    flex: 0 0 auto;
    min-width: 28px;
    height: 26px;
    padding: 2px 6px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #ffffff;
    color: #334155;
    cursor: pointer;
    font-size: 11px;
    line-height: 1;
}

.fox-scw__format-button:hover,
.fox-scw__format-button:focus-visible {
    border-color: #38bdf8;
    background: #e0f2fe;
    outline: none;
}

.fox-scw__format-button.is-admin-link {
    border-color: #fca5a5;
    color: #b91c1c;
}

.fox-scw__format-help {
    margin: 5px 0 0;
    color: var(--fox-scw-muted);
    font-size: 9px;
    line-height: 1.35;
}

.fox-scw__format-help span {
    color: #b91c1c;
    font-weight: 600;
}

.fox-scw__input:focus {
    border-color: var(--fox-scw-accent);
    outline: 2px solid rgba(56, 189, 248, 0.2);
}

.fox-scw__form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
}

.fox-scw__status {
    min-width: 0;
    color: #86efac;
    font-size: 11px;
}

.fox-scw__status.is-error {
    color: #b91c1c;
}

.fox-scw__counter {
    margin-left: 8px;
    color: var(--fox-scw-muted);
    font-size: 10px;
    white-space: nowrap;
}

.fox-scw__submit-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.fox-scw__honeypot {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.fox-scw__send {
    min-width: 72px;
    padding: 7px 13px;
    border-color: #0284c7;
    background: #0369a1;
}

.fox-scw__send:hover,
.fox-scw__send:focus-visible {
    background: #075985;
    outline: 2px solid rgba(56, 189, 248, 0.35);
}

.fox-scw__send:disabled {
    cursor: wait;
    opacity: 0.55;
}

@media (max-width: 520px) {
    .fox-scw {
        min-width: 250px;
        resize: vertical;
    }

    .fox-scw__resize-label {
        display: none;
    }
}
