/* ============================================
   Memotest - Estilos Especificos
   ============================================ */

body {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* --- App Container --- */
#app {
    width: 100%;
    max-width: 600px;
    padding: 16px;
    position: relative;
    z-index: 1;
}

#game-screen {
    position: relative;
}

/* --- Pantalla de Inicio --- */
#start-screen {
    min-height: 80vh;
    justify-content: center;
}

.start-content {
    text-align: center;
    width: 100%;
    padding: 40px 24px;
}

.game-title {
    font-size: 3.5rem;
    font-weight: 900;
    letter-spacing: -2px;
    background: linear-gradient(135deg, var(--gem-purple) 0%, var(--accent) 50%, var(--gem-yellow) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0;
    line-height: 1.1;
    filter: drop-shadow(0 4px 20px rgba(165, 94, 234, 0.3));
}

.game-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-bottom: 24px;
    margin-top: 8px;
}

/* --- Pack Selector Button --- */
.pack-selector-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    margin-bottom: 28px;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.pack-selector-btn i.fa-palette {
    color: var(--gem-purple);
    font-size: 0.95rem;
}

.pack-selector-btn strong {
    color: var(--text-primary);
    font-weight: 700;
}

.pack-selector-btn .chevron {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.pack-selector-btn:hover {
    color: var(--text-primary);
    border-color: rgba(165, 94, 234, 0.3);
}

.pack-selector-btn:hover .chevron {
    transform: translateX(3px);
}

/* --- Difficulty Selection --- */
.difficulty-selection {
    margin-bottom: 32px;
}

.difficulty-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.difficulty-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.diff-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
}

.diff-btn:hover {
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.06);
}

.diff-btn.active {
    border-color: rgba(165, 94, 234, 0.5);
    color: var(--gem-purple);
    background: rgba(165, 94, 234, 0.1);
    box-shadow: 0 0 20px rgba(165, 94, 234, 0.1);
}

.diff-name {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.diff-size {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* --- Start Menu --- */
.start-menu {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    margin-bottom: 28px;
}

/* --- High Score --- */
.high-score-display {
    display: flex;
    justify-content: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

#high-score-value {
    color: var(--gem-purple-light);
    font-weight: 700;
}

/* --- Game Title Bar --- */
.game-title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 12px;
    padding: 0 4px;
}

.game-title-bar .logo {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(135deg, var(--gem-purple), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.back-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1.4rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 8px;
    transition: all var(--transition-speed) ease;
}
.back-link:hover {
    color: var(--accent);
    background: rgba(255, 107, 53, 0.1);
}

.game-title-bar .level-badge {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.06);
    padding: 4px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* --- Header del Juego --- */
.game-header {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    width: 100%;
    margin-bottom: 14px;
    padding: 10px 8px;
}

.header-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.header-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.header-value {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-primary);
    transition: color 0.3s ease, transform 0.2s ease;
}

/* --- Tablero de Juego --- */
.game-board {
    display: grid;
    gap: 8px;
    padding: 14px;
    width: 100%;
    margin: 0 auto;
    position: relative;
}

/* --- Cartas (3D Flip) --- */
.memo-card {
    aspect-ratio: 2 / 3;
    perspective: 800px;
    cursor: pointer;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
}

.memo-card .card-face {
    position: absolute;
    inset: 0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transition: transform 0.45s ease;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.memo-card .card-back {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    font-size: 1.4rem;
}

.memo-card .card-back i {
    opacity: 0.4;
}

.memo-card:hover .card-back {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
}

.memo-card:hover .card-back i {
    opacity: 0.6;
}

.memo-card .card-front {
    background: var(--gem-blue);
    color: white;
    font-size: 1.8rem;
    transform: rotateY(180deg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.memo-card.flipped .card-back {
    transform: rotateY(180deg);
}

.memo-card.flipped .card-front {
    transform: rotateY(0deg);
}

.memo-card.matched .card-front {
    animation: matchPulse 0.5s ease forwards;
    border-color: rgba(255, 255, 255, 0.2);
}

.memo-card.matched {
    pointer-events: none;
}

@keyframes matchPulse {
    0% { transform: rotateY(0deg) scale(1); }
    30% { transform: rotateY(0deg) scale(1.08); box-shadow: 0 0 25px rgba(255, 255, 255, 0.2); }
    100% { transform: rotateY(0deg) scale(1); }
}

/* --- Overlays --- */
.overlay {
    position: fixed;
    inset: 0;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.overlay.active {
    display: flex;
    animation: slideInUp 0.3s ease;
}

.overlay-content {
    padding: 40px 36px;
    text-align: center;
    max-width: 360px;
    width: 90%;
}

.overlay-content h2 {
    font-size: 1.7rem;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--gem-purple), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.level-stats {
    margin-bottom: 24px;
}

.level-stats p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.level-stats span {
    color: var(--text-primary);
    font-weight: 700;
}

.overlay-content .btn {
    margin: 6px auto;
    display: block;
}

/* --- Stars --- */
.stars-display {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

.result-star {
    font-size: 2.2rem;
    transition: all 0.3s ease;
}

.result-star.star-earned {
    color: var(--gem-yellow);
    filter: drop-shadow(0 0 12px rgba(255, 165, 2, 0.5));
    animation: starPop 0.5s ease backwards;
}

.result-star.star-earned:nth-child(1) { animation-delay: 0.1s; }
.result-star.star-earned:nth-child(2) { animation-delay: 0.25s; }
.result-star.star-earned:nth-child(3) { animation-delay: 0.4s; }

.result-star.star-empty {
    color: rgba(255, 255, 255, 0.1);
}

@keyframes starPop {
    0% { transform: scale(0) rotate(-30deg); opacity: 0; }
    60% { transform: scale(1.3) rotate(5deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* --- Footer --- */
.game-footer {
    margin-top: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.7rem;
    letter-spacing: 2px;
    opacity: 0.5;
}

.site-footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 30px 20px;
    color: var(--text-muted);
    font-size: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.site-footer .footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-speed);
}

.site-footer .footer-links a:hover {
    color: var(--accent);
}

/* ═══════════════════════════════════════════════
   PACK CONFIG MODAL
   ═══════════════════════════════════════════════ */

.pack-modal {
    max-width: 500px;
    width: 92%;
    max-height: 90vh;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(1.5);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.5);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.pack-modal-header {
    padding: 20px 20px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.pack-modal-header h2 {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-primary);
    background: none;
    -webkit-text-fill-color: var(--text-primary);
}

.modal-close-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    font-size: 1.3rem;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.pack-modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

/* Scrollbar estilizado (dark theme) */
.pack-modal-body::-webkit-scrollbar {
    width: 5px;
}

.pack-modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 3px;
}

.pack-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 3px;
}

.pack-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.pack-modal-footer {
    padding: 14px 20px 18px;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-shrink: 0;
    flex-wrap: wrap;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(17, 17, 20, 0.4);
}

.pack-footer-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pack-footer-btn:hover {
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

/* --- Pack Sections --- */
.pack-section {
    margin-bottom: 24px;
}

.pack-section:last-child {
    margin-bottom: 0;
}

.pack-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
}

.pack-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.pack-section-header .pack-section-title {
    margin-bottom: 0;
}

.btn-new-pack {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border: 1px solid rgba(165, 94, 234, 0.3);
    border-radius: 8px;
    background: rgba(165, 94, 234, 0.08);
    color: var(--gem-purple-light);
    font-size: 0.75rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-new-pack:hover {
    background: rgba(165, 94, 234, 0.15);
    border-color: rgba(165, 94, 234, 0.5);
}

/* --- Packs Grid --- */
.packs-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.pack-card {
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: all 0.25s ease;
}

.pack-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
}

.pack-card.active {
    border-color: rgba(165, 94, 234, 0.4);
    background: rgba(165, 94, 234, 0.06);
    box-shadow: 0 0 20px rgba(165, 94, 234, 0.08);
}

/* Pack preview (4 mini cards) */
.pack-preview {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
}

.pack-mini-card {
    flex: 1;
    aspect-ratio: 2 / 3;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

/* Pack info */
.pack-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pack-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.pack-active-badge {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--gem-purple-light);
    background: rgba(165, 94, 234, 0.12);
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

/* Pack actions row */
.pack-actions-row {
    display: flex;
    gap: 4px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.pack-action-btn {
    flex: 1;
    padding: 5px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.pack-action-btn:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
}

.pack-action-btn.danger:hover {
    color: #ff4757;
    border-color: rgba(255, 71, 87, 0.3);
    background: rgba(255, 71, 87, 0.08);
}

/* Empty state */
.empty-packs-msg {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
}

.empty-packs-msg i {
    font-size: 1.5rem;
    margin-bottom: 8px;
    opacity: 0.4;
    display: block;
}

.empty-packs-msg p {
    font-size: 0.8rem;
}

/* --- Editor Nav --- */
.editor-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.editor-nav h2 {
    font-size: 1.1rem;
}

.btn-back-sm {
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-back-sm:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* --- Editor Name Row --- */
.editor-name-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.editor-name-row label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.editor-name-row input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease;
}

.editor-name-row input:focus {
    border-color: rgba(165, 94, 234, 0.4);
}

.editor-name-row input[readonly] {
    opacity: 0.6;
    cursor: default;
}

/* --- Editor Grid (16 slots) --- */
.editor-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    /* En pantallas chicas, limitar altura para que quepa el boton de guardar */
    max-height: 55vh;
    overflow-y: auto;
    padding-right: 4px;
    -webkit-overflow-scrolling: touch;
}

.editor-grid::-webkit-scrollbar {
    width: 4px;
}

.editor-grid::-webkit-scrollbar-track {
    background: transparent;
}

.editor-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.editor-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.18);
}

.editor-slot {
    aspect-ratio: 2 / 3;
    border-radius: 10px;
    border: 2px dashed rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.2rem;
    background-size: cover;
    background-position: center;
}

.editor-slot.empty {
    color: var(--text-muted);
    font-size: 1rem;
}

.editor-slot.empty i {
    opacity: 0.3;
}

.editor-slot:hover {
    border-color: rgba(165, 94, 234, 0.4);
    transform: scale(1.03);
}

.editor-slot.has-image {
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.12);
}

.slot-number {
    position: absolute;
    top: 4px;
    left: 6px;
    font-size: 0.55rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.35);
}

/* --- Slot Type Tabs --- */
.slot-type-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
}

.slot-type-tab {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.slot-type-tab:hover {
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--text-secondary);
}

.slot-type-tab.active {
    border-color: rgba(165, 94, 234, 0.4);
    color: var(--gem-purple-light);
    background: rgba(165, 94, 234, 0.08);
}

/* --- Slot Edit Body --- */
.slot-edit-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.edit-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.edit-row label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hint-text {
    font-size: 0.72rem;
    color: var(--text-muted);
    opacity: 0.7;
    line-height: 1.4;
    margin-top: -4px;
}

/* --- Color Picker --- */
.color-picker-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

input[type="color"] {
    -webkit-appearance: none;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    background: none;
    padding: 2px;
    flex-shrink: 0;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 5px;
}

/* --- Quick Colors --- */
.quick-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    flex: 1;
}

.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s ease;
}

.color-swatch:hover {
    transform: scale(1.15);
}

.color-swatch.selected {
    border-color: white;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

/* --- Icon Grid --- */
.icon-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    max-height: 200px;
    overflow-y: auto;
    padding: 4px;
    -webkit-overflow-scrolling: touch;
}

.icon-grid::-webkit-scrollbar {
    width: 4px;
}

.icon-grid::-webkit-scrollbar-track {
    background: transparent;
}

.icon-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.icon-option {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.icon-option:hover {
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.06);
}

.icon-option.selected {
    border-color: rgba(165, 94, 234, 0.5);
    color: var(--gem-purple-light);
    background: rgba(165, 94, 234, 0.1);
}

/* --- Image URL Input --- */
.edit-row input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease;
}

.edit-row input[type="text"]:focus {
    border-color: rgba(165, 94, 234, 0.4);
}

/* --- Slot Preview Card --- */
.preview-row {
    align-items: center;
}

.slot-preview-card {
    width: 80px;
    aspect-ratio: 2 / 3;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: rgba(255, 255, 255, 0.85);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    background-size: cover;
    background-position: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin: 0 auto;
    transition: all 0.2s ease;
}

/* --- Import Textarea --- */
#import-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    resize: vertical;
    outline: none;
    line-height: 1.5;
    transition: border-color 0.2s ease;
}

#import-textarea:focus {
    border-color: rgba(165, 94, 234, 0.4);
}

#import-textarea[readonly] {
    opacity: 0.8;
    cursor: default;
}

/* --- Small Button Variant --- */
.btn-sm {
    padding: 10px 28px;
    font-size: 0.9rem;
    min-width: auto;
}

/* ═══════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════ */
@media (max-width: 520px) {
    #app {
        padding: 8px;
    }

    .start-content {
        padding: 30px 16px;
    }

    .game-title {
        font-size: 2.8rem;
    }

    .difficulty-buttons {
        gap: 6px;
    }

    .diff-btn {
        padding: 8px 6px;
    }

    .diff-name {
        font-size: 0.72rem;
    }

    .game-board {
        gap: 6px;
        padding: 10px;
    }

    .memo-card .card-front {
        font-size: 1.3rem;
        border-radius: 8px;
    }

    .memo-card .card-back {
        font-size: 1.1rem;
        border-radius: 8px;
    }

    .header-value {
        font-size: 1.1rem;
    }

    .result-star {
        font-size: 1.8rem;
    }

    /* Pack modal */
    .pack-modal {
        max-height: 90vh;
        width: 96%;
    }

    .packs-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .pack-preview {
        gap: 3px;
    }

    .pack-mini-card {
        font-size: 0.6rem;
    }

    .editor-grid {
        gap: 6px;
    }

    .editor-slot {
        font-size: 1rem;
    }

    .icon-grid {
        grid-template-columns: repeat(7, 1fr);
        max-height: 160px;
    }

    .icon-option {
        font-size: 0.75rem;
    }

    .color-swatch {
        width: 22px;
        height: 22px;
    }
}

@media (max-width: 380px) {
    .game-title {
        font-size: 2.2rem;
    }

    .game-board {
        gap: 4px;
        padding: 8px;
    }

    .memo-card .card-front {
        font-size: 1rem;
    }

    .memo-card .card-back {
        font-size: 0.9rem;
    }

    .header-value {
        font-size: 1rem;
    }

    .icon-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .quick-colors {
        gap: 4px;
    }

    .color-swatch {
        width: 20px;
        height: 20px;
    }

    .slot-preview-card {
        width: 64px;
        font-size: 1.4rem;
    }
}
