/* Grid overlay — scoped to .go-page */

body.dm-tools-tool-body > #goPage.page-container {
    box-sizing: border-box;
    width: 100%;
    max-width: min(100vw - 48px, 1400px);
    margin-left: auto;
    margin-right: auto;
    padding-left: max(24px, 2vw);
    padding-right: max(24px, 2vw);
    padding-bottom: 2rem;
}

.go-page > .header {
    text-align: left;
    margin-bottom: 1rem;
}

.go-page .title {
    font-size: 1.75rem;
    margin: 0 0 0.25rem;
    text-align: left;
}

.go-tagline {
    margin: 0;
    font-size: 0.9rem;
    color: var(--mg-gray);
    line-height: 1.45;
    max-width: 40rem;
}

.go-source-panel {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: stretch;
    gap: 0 1rem;
    margin-bottom: 1.25rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--mg-gray-light);
    border-radius: 12px;
    background: #fff;
}

.go-source-block {
    min-width: 0;
}

.go-source-heading {
    margin: 0 0 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--mg-gray);
}

.go-source-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.go-source-or {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--mg-gray);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0 0.25rem;
}

.go-paste-hint {
    margin: 0;
    font-size: 0.9rem;
    color: var(--mg-gray);
    line-height: 1.5;
}

.go-paste-hint kbd {
    font-family: ui-monospace, monospace;
    font-size: 0.85em;
    padding: 0.1em 0.35em;
    border-radius: 4px;
    border: 1px solid var(--mg-gray-light);
    background: rgba(23, 51, 63, 0.05);
}

.go-split {
    display: grid;
    grid-template-columns: minmax(240px, 18rem) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.go-controls-card {
    border: 1px solid var(--mg-gray-light);
    border-radius: 12px;
    padding: 1.25rem;
    background: #fff;
    position: sticky;
    top: 8px;
}

.go-fieldset {
    border: none;
    margin: 0;
    padding: 0;
    min-width: 0;
}

.go-fieldset:disabled {
    opacity: 0.55;
}

.go-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.go-field:last-child {
    margin-bottom: 0;
}

.go-field label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--mg-black);
}

.go-value {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--mg-gray);
    font-variant-numeric: tabular-nums;
}

.go-field-color input[type="color"] {
    width: 100%;
    height: 2.5rem;
    padding: 0.15rem;
    border-radius: 8px;
    border: 1px solid var(--mg-gray-light);
    background: #fff;
    cursor: pointer;
}

.go-field-color input[type="color"]:focus {
    outline: 2px solid var(--mg-green);
    outline-offset: 1px;
}

.go-field-slider input[type="range"] {
    width: 100%;
    margin: 0;
    accent-color: var(--mg-green);
}

.go-field-checkbox {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.go-field-checkbox label {
    font-weight: 500;
    justify-content: flex-start;
}

.go-field-checkbox input {
    width: auto;
    margin: 0;
}

.go-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 1rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--mg-gray-light);
    background: #fff;
    color: var(--mg-black);
    text-decoration: none;
    box-sizing: border-box;
}

.go-btn:focus-visible {
    outline: 2px solid var(--mg-green);
    outline-offset: 2px;
}

.go-btn-primary {
    background: var(--mg-green);
    border-color: var(--mg-green);
    color: #fff;
    width: 100%;
}

.go-btn-primary:hover:not(:disabled) {
    filter: brightness(1.05);
}

.go-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.go-btn-secondary:hover {
    border-color: var(--mg-green);
}

.go-file-label {
    cursor: pointer;
    width: 100%;
    justify-content: center;
}

.go-download-btn {
    margin-top: 0.25rem;
}

.go-preview-column {
    min-width: 0;
}

.go-preview-shell {
    position: relative;
    width: 100%;
    min-height: min(68vh, 560px);
    border: 1px solid var(--mg-gray-light);
    border-radius: 12px;
    overflow: hidden;
    background: #eef1f3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.go-page.go-has-image .go-preview-shell {
    background: #1a1f24;
}

.go-preview-canvas {
    display: none;
    max-width: 100%;
    max-height: min(68vh, 560px);
    width: auto;
    height: auto;
}

.go-page.go-has-image .go-preview-canvas {
    display: block;
}

.go-drop-zone {
    padding: 2rem 1.5rem;
    text-align: center;
    max-width: 22rem;
}

.go-page.go-has-image .go-drop-zone {
    display: none;
}

.go-page.go-drag-over .go-preview-shell {
    outline: 3px dashed var(--mg-green);
    outline-offset: -3px;
    background: rgba(46, 180, 90, 0.08);
}

.go-drop-title {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--mg-black);
}

.go-drop-sub {
    margin: 0;
    font-size: 0.9rem;
    color: var(--mg-gray);
    line-height: 1.45;
}

.go-status {
    margin: 0.75rem 0 0;
    font-size: 0.875rem;
    color: var(--mg-gray);
    min-height: 1.25em;
    line-height: 1.45;
}

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

@media (max-width: 720px) {
    .go-source-panel {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .go-source-or {
        padding: 0.25rem 0;
    }

    .go-split {
        grid-template-columns: 1fr;
    }

    .go-controls-card {
        position: static;
    }

    .go-preview-shell {
        min-height: min(50vh, 420px);
    }

    .go-preview-canvas {
        max-height: min(50vh, 420px);
    }
}

@media (min-width: 900px) {
    .go-preview-shell {
        min-height: min(74vh, 680px);
    }

    .go-preview-canvas {
        max-height: min(74vh, 680px);
    }
}
