.mtg-app {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    padding: 2rem 0;
    border: 1px solid var(--contrast-3, #b2b2be);
    box-sizing: border-box;
}

.mtg-app *,
.mtg-app *:before,
.mtg-app *:after {
    box-sizing: border-box;
}

.mtg-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.mtg-card {
    width: 100%;
    min-width: 0;
    background: var(--contrast, #222222);
    border-radius: 12px;
    padding: 1.5rem;
    overflow: hidden;
}

.mtg-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.2rem;
    color: var(--base-3, #ffffff);
    border-bottom: 1px solid var(--highlight-1, #ff661a);
    padding-bottom: 0.8rem;
}

.mtg-card-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--highlight-1, #ff661a);
    border-radius: 8px;
    color: #fff;
}

.mtg-card-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.mtg-card-title {
    font-size: 1.25rem;
    color: var(--base-3, #ffffff);
    margin: 0;
    font-weight: 700;
    text-transform: uppercase;
}

.mtg-card-header h2 {
    margin:0;
    border-left:0;
    font-size: 1.25rem;
}

.mtg-badge {
    margin-left: auto;
    padding: 6px 14px;
    background: var(--red-1, #9e3500);
    color: var(--base-3, #ffffff);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}


/* TOP ROW */

.mtg-top-row {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 350px) minmax(0, 1fr);
    gap: 1.5rem;
}

.mtg-left-col,
.mtg-right-col {
    min-width: 0;
    display: flex;
    flex-direction: column;
}


/* INPUTS */

.mtg-search-input {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    border: 2px solid #000;
    border-radius: 6px;
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.mtg-search-input:focus {
    outline: none;
    border-color: var(--highlight-1, #ff661a);
}

.mtg-preset-words-scroll {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 350px;
    overflow-y: auto;
    padding: 4px;
}

.mtg-preset-words-scroll::-webkit-scrollbar {
    width: 6px;
}

.mtg-preset-words-scroll::-webkit-scrollbar-thumb {
    background: var(--highlight-1, #ff661a);
    border-radius: 3px;
}

.mtg-preset-btn {
    padding: 8px 14px;
    border: 1px solid var(--contrast-3, #b2b2be);
    background: var(--red-1, #9e3500);
    color: var(--base-3, #ffffff);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
}

.mtg-preset-btn:hover,
.mtg-preset-btn.active {
    background: var(--highlight-1, #ff661a);
    color: var(--contrast, #222222);
}

#mtgInput {
    width: 100%;
    padding: 16px;
    font-size: 20px;
    border: 2px solid #000;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#mtgInput:focus {
    outline: none;
    border-color: var(--highlight-1, #ff661a);
}

.mtg-char-count {
    text-align: right;
    font-size: 12px;
    color: var(--highlight-2, #FFB366);
    margin-top: 8px;
}


/* DESIGN STUDIO */

.mtg-style-card {
    padding: 0;
}

.mtg-controls-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1rem;
}

.mtg-control-group {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.mtg-control-group label {
    font-size: 11px;
    font-weight: 600;
    color: var(--base-3, #ffffff);
    margin-bottom: 6px;
    text-transform: uppercase;
}

.mtg-control-group select {
    width: 100%;
    min-width: 0;
    padding: 10px;
    border: 2px solid var(--contrast-3, #b2b2be);
    border-radius: 6px;
    font-size: 14px;
    background: white;
}

.mtg-control-group select:focus {
    outline: none;
    border-color: var(--highlight-1, #ff661a);
}


/* BUTTONS */

.mtg-actions-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.mtg-btn {
    flex: 1;
    min-width: 150px;
    padding: 14px 20px;
    border: 1px solid var(--contrast-3, #b2b2be);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
}

.mtg-btn-primary,
.mtg-btn-random {
    background: var(--red-1, #9e3500);
    color: var(--base-3, #ffffff);
}

.mtg-btn-primary:hover,
.mtg-btn-random:hover {
    background: var(--highlight-1, #ff661a);
    color: var(--contrast, #222222);
}

.mtg-btn-outline,
.mtg-btn-secondary {
    background: var(--contrast, #222222);
    color: var(--base-3, #ffffff);
}

.mtg-btn-outline:hover,
.mtg-btn-secondary:hover {
    background: var(--highlight-1, #ff661a);
    color: var(--contrast, #222222);
}


/* PREVIEW */

.mtg-preview-card {
    min-height: 400px;
}

.mtg-preview-wrapper {
    background: var(--base, #f0f0f0);
    border: 1px solid var(--contrast-3, #b2b2be);
    border-radius: 8px;
    padding: 3rem;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.mtg-tattoo-output {
    max-width: 100%;
    overflow: auto;
    position: relative;
    transition: all .3s ease;
}

.morse-sequence {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.morse-char-group {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0 8px;
}

.word-spacer {
    width: 30px;
}

.mtg-morse-text {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--contrast, #222222);
    border: 1px solid var(--contrast-3, #b2b2be);
    border-radius: 4px;
    color: var(--base-3, #ffffff);
    font-family: monospace;
    font-size: 14px;
    text-align: center;
    word-break: break-all;
}

.mtg-placeholder {
    opacity: .4;
    font-style: italic;
    color: var(--base-3, #ffffff);
}


/* FEEDBACK */

.mtg-feedback {
    padding: 1rem;
    border-radius: 4px;
    font-weight: 600;
    text-align: center;
    display: none;
    border: 1px solid var(--contrast-3, #b2b2be);
}

.mtg-feedback.show {
    display: block;
}

.mtg-feedback.success {
    background: var(--highlight-1, #ff661a);
    color: var(--contrast, #222222);
}

.mtg-feedback.error {
    background: var(--red-1, #9e3500);
    color: var(--base-3, #ffffff);
}


/* SIZE */

.size-small .morse-sequence {
    transform: scale(.7);
}

.size-medium .morse-sequence {
    transform: scale(1);
}

.size-large .morse-sequence {
    transform: scale(1.3);
}

.size-xlarge .morse-sequence {
    transform: scale(1.6);
}


/* BORDERS */

.border-line {
    border: 2px solid #000;
    padding: 20px;
    border-radius: 8px;
}

.border-double-line {
    border: 4px double #000;
    padding: 20px;
    border-radius: 8px;
}

.border-circular {
    border: 2px solid #000;
    border-radius: 50%;
    width: min(300px, 90vw);
    height: min(300px, 90vw);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}


/* TABLET */

@media (max-width:992px) {
    .mtg-container {
        padding: 0 1rem;
    }
    .mtg-top-row {
        grid-template-columns: 1fr;
    }
    .mtg-controls-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .mtg-preview-wrapper {
        padding: 2rem;
    }
}


/* MOBILE */

@media (max-width:768px) {
    .mtg-app {
        padding: 1rem 0;
    }
    .mtg-container {
        padding: 0 .75rem;
        gap: 1rem;
    }
    .mtg-card,
    .mtg-style-card {
        padding: 1rem;
    }
    .mtg-controls-grid {
        grid-template-columns: 1fr;
    }
    .mtg-actions-row {
        flex-direction: column;
    }
    .mtg-btn {
        width: 100%;
        min-width: 0;
    }
    .mtg-preview-wrapper {
        padding: 1rem;
        min-height: 220px;
    }
    .morse-char-group {
        margin: 0 4px;
    }
    .word-spacer {
        width: 15px;
    }
}


/* SMALL PHONES */

@media (max-width:480px) {
    .mtg-container {
        padding: 0 .5rem;
    }
    .mtg-card,
    .mtg-style-card {
        padding: .875rem;
    }
    .mtg-card-title {
        font-size: .95rem;
    }
    #mtgInput {
        padding: 12px;
        font-size: 16px;
    }
    .mtg-preview-wrapper {
        padding: .75rem;
    }
}