/* MemoCard — flash-card memory game */

:root {
    --mc-accent: #e8826b;
    --mc-ok: #3aaf5c;
    --mc-bad: #e0564a;
    --mc-line: rgba(128, 128, 128, 0.3);
    --mc-line-soft: rgba(128, 128, 128, 0.18);
}

.mc-muted {
    opacity: 0.7;
    font-size: 0.9em;
}

.mc-hint {
    font-size: 0.85em;
    margin-top: 0.5em;
}

.mc-game-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75em;
}

/* ── Deck list ───────────────────────────────────────────── */
.mc-deck-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1em;
    padding: 0.9em 1em;
    border: 1px solid var(--mc-line);
    border-radius: 8px;
    margin-bottom: 0.7em;
    transition: background 0.15s, border-color 0.15s;
}

.mc-deck-item:hover {
    border-color: var(--mc-accent);
    background: rgba(128, 128, 128, 0.06);
}

.mc-deck-info {
    flex: 1;
    cursor: pointer;
    min-width: 0;
}

.mc-deck-title {
    font-weight: 700;
}

.mc-deck-actions {
    white-space: nowrap;
}

.mc-deck-actions button {
    margin-left: 0.4em;
}

/* ── Card rows ───────────────────────────────────────────── */
.mc-card-row {
    display: flex;
    gap: 0.75em;
    align-items: center;
    padding: 0.55em 0.3em;
    border-bottom: 1px solid var(--mc-line-soft);
}

.mc-card-front {
    flex: 1;
    font-weight: 600;
    word-break: break-word;
}

.mc-card-back {
    flex: 1.4;
    word-break: break-word;
}

.mc-card-stat {
    font-size: 0.8em;
    opacity: 0.7;
    white-space: nowrap;
}

.mc-card-actions {
    white-space: nowrap;
}

.mc-card-row input[type="text"] {
    margin: 0;
}

/* ── AI suggestions ──────────────────────────────────────── */
.mc-suggest-item {
    display: flex;
    gap: 0.75em;
    align-items: center;
    padding: 0.5em 0.6em;
    border: 1px dashed var(--mc-line);
    border-radius: 6px;
    margin-bottom: 0.5em;
}

.mc-suggest-item .mc-s-front {
    font-weight: 600;
}

.mc-suggest-item .mc-s-text {
    flex: 1;
    min-width: 0;
}

/* ── Mode picker ─────────────────────────────────────────── */
.mc-mode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.75em;
    margin-bottom: 1.25em;
}

.mc-mode-btn {
    text-align: left;
    padding: 1em;
    border: 2px solid var(--mc-line);
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.3em;
    color: inherit;
    font-family: inherit;
}

.mc-mode-btn strong {
    font-size: 1.05em;
}

.mc-mode-btn span {
    font-size: 0.85em;
    opacity: 0.75;
}

.mc-mode-btn.selected {
    border-color: var(--mc-accent);
    background: rgba(232, 130, 107, 0.1);
}

.mc-mode-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.mc-setup-options label {
    font-size: 0.85em;
    opacity: 0.8;
}

/* ── Quiz: prompt + typed answer ─────────────────────────── */
.mc-prompt {
    font-size: 1.7em;
    text-align: center;
    margin: 0.8em 0 0.2em;
    word-break: break-word;
}

.mc-prompt-sub {
    text-align: center;
    opacity: 0.65;
    margin-bottom: 1.4em;
}

.mc-typed-input {
    width: 100%;
    font-size: 1.2em;
    text-align: center;
}

.mc-feedback {
    text-align: center;
    font-weight: 700;
    margin-top: 1em;
    min-height: 1.6em;
}

.mc-feedback.correct {
    color: var(--mc-ok);
}

.mc-feedback.wrong {
    color: var(--mc-bad);
}

/* ── Quiz: multiple choice ───────────────────────────────── */
.mc-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75em;
    margin-top: 1em;
}

.mc-option {
    padding: 1em;
    border: 2px solid var(--mc-line);
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    font-size: 1.05em;
    color: inherit;
    font-family: inherit;
    word-break: break-word;
}

.mc-option:hover:not(:disabled) {
    border-color: var(--mc-accent);
}

.mc-option.correct {
    border-color: var(--mc-ok);
    background: rgba(58, 175, 92, 0.15);
}

.mc-option.wrong {
    border-color: var(--mc-bad);
    background: rgba(224, 86, 74, 0.15);
}

@media (max-width: 480px) {
    .mc-options {
        grid-template-columns: 1fr;
    }
}

/* ── Quiz: flip card ─────────────────────────────────────── */
.mc-flip {
    perspective: 1000px;
    margin: 1em auto;
    max-width: 440px;
}

.mc-flip-inner {
    position: relative;
    width: 100%;
    min-height: 210px;
    transition: transform 0.5s;
    transform-style: preserve-3d;
    cursor: pointer;
}

.mc-flip.flipped .mc-flip-inner {
    transform: rotateY(180deg);
}

.mc-flip-front,
.mc-flip-back {
    position: absolute;
    inset: 0;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5em;
    border: 2px solid var(--mc-line);
    border-radius: 12px;
    font-size: 1.4em;
    text-align: center;
    word-break: break-word;
}

.mc-flip-back {
    transform: rotateY(180deg);
    border-color: var(--mc-accent);
}

/* ── Quiz: match pairs ───────────────────────────────────── */
.mc-match-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1em;
    margin-top: 0.5em;
}

.mc-match-col {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
}

.mc-match-tile {
    padding: 0.8em;
    border: 2px solid var(--mc-line);
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    background: transparent;
    color: inherit;
    font-family: inherit;
    word-break: break-word;
}

.mc-match-tile.selected {
    border-color: var(--mc-accent);
    background: rgba(232, 130, 107, 0.12);
}

.mc-match-tile.matched {
    opacity: 0.3;
    pointer-events: none;
    border-style: dashed;
}

.mc-match-tile.shake {
    animation: mc-shake 0.3s;
}

@keyframes mc-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ── Results ─────────────────────────────────────────────── */
.mc-score {
    font-size: 1.3em;
    font-weight: 700;
}

.mc-wrong-item {
    padding: 0.55em 0.3em;
    border-bottom: 1px solid var(--mc-line-soft);
}

.mc-w-front {
    font-weight: 600;
}

.mc-w-correct {
    color: var(--mc-ok);
}

.mc-w-given {
    color: var(--mc-bad);
    text-decoration: line-through;
    opacity: 0.85;
}
