.fxtainment-shortcode {
    display: inline-block;
}

.fxtainment-launch {
    appearance: none;
    border: 0;
    border-radius: 8px;
    background: #0f766e;
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    line-height: 1.2;
    padding: 12px 18px;
    transition: background-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.fxtainment-launch:hover,
.fxtainment-launch:focus {
    background: #115e59;
    box-shadow: 0 10px 24px rgba(15, 118, 110, 0.22);
    outline: none;
    transform: translateY(-1px);
}

.fxt-game-button {
    align-items: center;
    display: inline-flex;
    justify-content: center;
    min-height: 42px;
    padding: 10px 18px;
}

.fxt-game-card {
    align-items: center;
    background: #ffffff;
    border: 1px solid #d8dee4;
    border-radius: 8px;
    display: flex;
    gap: 14px;
    justify-content: space-between;
    margin: 14px 0;
    padding: 14px;
}

.fxt-game-card h3,
.fxt-game-card p {
    margin: 0;
}

.fxt-game-card p {
    color: #5f6b7f;
    margin-top: 4px;
}

.fxtainment-notice {
    border-left: 4px solid #f59e0b;
    background: #fffbeb;
    color: #78350f;
    margin: 12px 0;
    padding: 10px 12px;
}

.fxtainment-backdrop {
    align-items: center;
    background: rgba(15, 23, 42, 0.64);
    bottom: 0;
    display: none;
    justify-content: center;
    left: 0;
    padding: 20px;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 99998;
}

.fxtainment-backdrop.is-open {
    display: flex;
}

.fxtainment-modal {
    background: #f8fafc;
    border: 1px solid rgba(148, 163, 184, 0.42);
    border-radius: 8px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.34);
    color: #0f172a;
    max-height: min(92vh, 860px);
    max-width: 720px;
    overflow: hidden;
    width: min(100%, 720px);
}

.fxtainment-modal__header {
    align-items: center;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 14px 16px;
}

.fxtainment-modal__title {
    font-size: 18px;
    font-weight: 800;
    line-height: 1.25;
    margin: 0;
}

.fxtainment-icon-button {
    align-items: center;
    background: #e2e8f0;
    border: 0;
    border-radius: 8px;
    color: #0f172a;
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 20px;
    font-weight: 800;
    height: 36px;
    justify-content: center;
    line-height: 1;
    width: 36px;
}

.fxtainment-icon-button:hover,
.fxtainment-icon-button:focus {
    background: #cbd5e1;
    outline: none;
}

.fxtainment-modal__body {
    max-height: calc(min(92vh, 860px) - 65px);
    overflow: auto;
    padding: 16px;
}

.fxtainment-view[hidden] {
    display: none !important;
}

.fxtainment-resume {
    align-items: center;
    background: #ecfdf5;
    border: 1px solid #99f6e4;
    border-radius: 8px;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 14px;
    padding: 12px;
}

.fxtainment-resume[hidden] {
    display: none !important;
}

.fxtainment-resume strong {
    display: block;
    font-size: 14px;
}

.fxtainment-resume span {
    color: #475569;
    display: block;
    font-size: 12px;
    margin-top: 2px;
}

.fxtainment-resume-summary dl,
.fxtainment-stats-grid {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
}

.fxtainment-resume-summary dl div,
.fxtainment-stats-grid div {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 9px 10px;
}

.fxtainment-resume-summary dt,
.fxtainment-stats-grid dt {
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    margin: 0 0 2px;
}

.fxtainment-resume-summary dd,
.fxtainment-stats-grid dd {
    color: #0f172a;
    font-size: 14px;
    font-weight: 800;
    margin: 0;
}

.fxtainment-settings {
    display: grid;
    gap: 16px;
}

.fxtainment-section {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px;
}

.fxtainment-section h3 {
    font-size: 15px;
    font-weight: 800;
    line-height: 1.3;
    margin: 0 0 10px;
}

.fxtainment-size-grid,
.fxtainment-stop-grid {
    display: grid;
    gap: 10px;
}

.fxtainment-size-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.fxtainment-choice,
.fxtainment-stop-card {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    cursor: pointer;
    display: block;
    position: relative;
}

.fxtainment-choice input,
.fxtainment-stop-card input[type="radio"] {
    left: 10px;
    position: absolute;
    top: 10px;
}

.fxtainment-choice span {
    align-items: center;
    display: flex;
    font-weight: 700;
    justify-content: center;
    min-height: 44px;
    padding: 8px 10px 8px 28px;
    text-align: center;
}

.fxtainment-choice:has(input:checked),
.fxtainment-stop-card:has(input[type="radio"]:checked) {
    border-color: #0f766e;
    box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.16);
}

.fxtainment-field {
    display: grid;
    gap: 6px;
}

.fxtainment-custom-settings {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.fxtainment-field label,
.fxtainment-label {
    color: #334155;
    font-size: 13px;
    font-weight: 700;
}

.fxtainment-field input,
.fxtainment-field select,
.fxtainment-stop-card input[type="number"],
.fxtainment-stop-card input[type="time"],
.fxtainment-stop-card select {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-sizing: border-box;
    color: #0f172a;
    font: inherit;
    min-height: 38px;
    padding: 7px 9px;
    width: 100%;
}

.fxtainment-stop-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.fxtainment-stop-card {
    background: #ffffff;
    display: grid;
    gap: 8px;
    padding: 12px 12px 12px 34px;
}

.fxtainment-stop-card.is-disabled {
    background: #f1f5f9;
    color: #64748b;
    cursor: not-allowed;
    opacity: 0.72;
}

.fxtainment-stop-title {
    font-weight: 800;
}

.fxtainment-stop-description {
    color: #475569;
    font-size: 12px;
    line-height: 1.35;
}

.fxtainment-pair-targets {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.fxtainment-live-price {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: #0f172a;
    display: block;
    font-size: 13px;
    font-weight: 700;
    padding: 7px 9px;
}

.fxtainment-actions,
.fxtainment-toolbar,
.fxtainment-mode-switch {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.fxtainment-actions {
    justify-content: flex-end;
}

.fxtainment-button {
    appearance: none;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    color: #0f172a;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    min-height: 38px;
    padding: 8px 13px;
}

.fxtainment-button:hover,
.fxtainment-button:focus {
    border-color: #94a3b8;
    outline: none;
}

.fxtainment-button--primary {
    background: #0f766e;
    border-color: #0f766e;
    color: #ffffff;
}

.fxtainment-button--primary:hover,
.fxtainment-button--primary:focus {
    background: #115e59;
    border-color: #115e59;
}

.fxtainment-button.is-active {
    background: #0f172a;
    border-color: #0f172a;
    color: #ffffff;
}

.fxtainment-alert {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #991b1b;
    display: none;
    font-size: 13px;
    padding: 9px 10px;
}

.fxtainment-alert.is-visible {
    display: block;
}

.fxtainment-game-top {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
}

.fxtainment-toolbar {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    justify-content: space-between;
    padding: 10px;
}

.fxtainment-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.fxtainment-stat {
    background: #f1f5f9;
    border-radius: 8px;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
    padding: 7px 9px;
}

.fxtainment-status {
    color: #334155;
    font-size: 13px;
    min-height: 20px;
}

.fxtainment-result {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    display: grid;
    gap: 10px;
    padding: 12px;
}

.fxtainment-result[hidden] {
    display: none !important;
}

.fxtainment-result strong {
    font-size: 17px;
}

.fxtainment-result-meta {
    color: #475569;
    font-size: 13px;
}

.fxtainment-result-stats {
    display: grid;
    gap: 8px;
}

.fxtainment-result-stats > strong {
    font-size: 14px;
}

.fxtainment-board-wrap {
    display: flex;
    justify-content: center;
    overflow: auto;
    padding: 2px 0 4px;
}

.fxtainment-board {
    --fxt-board-size: 10;
    --fxt-cell-size: clamp(20px, calc((min(88vw, 660px) - 28px) / var(--fxt-board-size)), 32px);
    background: #c0c0c0;
    border-bottom: 3px solid #808080;
    border-left: 3px solid #ffffff;
    border-radius: 0;
    border-right: 3px solid #808080;
    border-top: 3px solid #ffffff;
    display: grid;
    gap: 0;
    grid-template-columns: repeat(var(--fxt-board-size), var(--fxt-cell-size));
    max-width: 100%;
    padding: 6px;
    touch-action: manipulation;
}

.fxtainment-cell {
    align-items: center;
    aspect-ratio: 1 / 1;
    background: #c0c0c0;
    border-bottom: 2px solid #808080;
    border-left: 2px solid #ffffff;
    border-radius: 0;
    border-right: 2px solid #808080;
    border-top: 2px solid #ffffff;
    box-shadow: none;
    color: #0f172a;
    cursor: pointer;
    display: inline-flex;
    font-size: clamp(12px, calc(var(--fxt-cell-size) * 0.5), 18px);
    font-weight: 900;
    justify-content: center;
    line-height: 1;
    margin: 0;
    min-height: 0;
    min-width: 0;
    padding: 0;
    width: var(--fxt-cell-size);
}

.fxtainment-cell:hover,
.fxtainment-cell:focus {
    background: #d0d0d0;
    outline: none;
}

.fxtainment-cell.is-revealed {
    background: #c0c0c0;
    border: 1px solid #808080;
    box-shadow: inset 1px 1px #808080;
    cursor: default;
}

.fxtainment-cell.is-flagged {
    color: #008000;
    font-family: "Courier New", monospace;
    font-weight: 900;
}

.fxtainment-cell.is-mine {
    background: #ff0000;
}

.fxtainment-cell.is-wrong-flag {
    background: #ffedd5;
}

.fxtainment-cell.n1 { color: #0000ff; }
.fxtainment-cell.n2 { color: #008000; }
.fxtainment-cell.n3 { color: #ff0000; }
.fxtainment-cell.n4 { color: #000080; }
.fxtainment-cell.n5 { color: #800000; }
.fxtainment-cell.n6 { color: #008080; }
.fxtainment-cell.n7 { color: #000000; }
.fxtainment-cell.n8 { color: #808080; }

@media (max-width: 640px) {
    .fxtainment-backdrop {
        align-items: flex-start;
        padding: 8px;
    }

    .fxtainment-modal {
        max-height: calc(100vh - 16px);
        width: calc(100vw - 16px);
    }

    .fxtainment-modal__body {
        max-height: calc(100vh - 82px);
        padding: 12px;
    }

    .fxtainment-size-grid,
    .fxtainment-stop-grid,
    .fxtainment-pair-targets,
    .fxtainment-custom-settings,
    .fxtainment-resume-summary dl,
    .fxtainment-stats-grid {
        grid-template-columns: 1fr;
    }

    .fxtainment-resume,
    .fxtainment-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .fxtainment-actions {
        justify-content: stretch;
    }

    .fxtainment-actions .fxtainment-button,
    .fxtainment-mode-switch .fxtainment-button {
        flex: 1 1 auto;
    }
}
