/* ── Common ─────────────────────────────────────────────────────────────── */
.mf-wrapper {
    font-family: Arial, sans-serif;
    box-sizing: border-box;
    margin: 0 auto;
    color: #1a1a2e;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.mf-header {
    font-size: 0.82rem;
    color: #888;
    margin-bottom: 8px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.mf-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.mf-btn {
    padding: 6px 16px;
    border: none;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .15s;
}
.mf-btn:hover { opacity: .85; }
.mf-btn-ok   { background: #27ae604f; color: #2c3e50; }
.mf-btn-hint { background: #e67e2238; color: #2c3e50; }
.mf-btn-rst  { background: #e74c3c; color: #fff; }

/* ── Grid ──────────────────────────────────────────────────────────────── */
.mf-grid {
    display: inline-grid;
    gap: 2px;
    background: #333;
    border: 3px solid #333;
    border-radius: 4px;
    overflow: hidden;
}

/* ── Cell base ──────────────────────────────────────────────────────────── */
.mf-cell { box-sizing: border-box; }
.mf-cell.mf-black { background: #333; }

/* Definition cell */
.mf-cell.mf-def {
    background: #b8cce4;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: space-between;
    position: relative;
    border: 1px solid #88aad0;
    box-sizing: border-box;
    overflow: hidden;
}
.mf-clue-text {
    flex: 1;
    font-size: 9px;
    line-height: 1.25;
    color: #111;
    padding: 3px 4px 0;
    overflow: hidden;
    word-break: break-word;
    hyphens: auto;
}
.mf-arrow {
    align-self: flex-end;
    font-size: 14px;
    font-weight: 900;
    color: #1a3a6e;
    padding: 2px 4px 2px;
    line-height: 1;
}

/* Letter cell */
.mf-cell.mf-letter {
    background: #fff;
    position: relative;
    cursor: pointer;
    border: 1px solid #ccc;
}
.mf-cell.mf-letter.sel   .mf-inp { background: #ffe066; }
.mf-cell.mf-letter.ok    .mf-inp { background: #c3f0ca; color: #145a2a; }
.mf-cell.mf-letter.err   .mf-inp { background: #fac8ca; color: #7a1e20; }

.mf-inp {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    text-align: center;
    text-transform: uppercase;
    font-weight: 700;
    background: transparent;
    color: #1a1a2e;
    padding: 0;
    caret-color: transparent;
    cursor: pointer;
    display: block;
    box-sizing: border-box;
}

/* ── Status bar ─────────────────────────────────────────────────────────── */
.mf-status {
    margin-top: 8px;
    padding: 7px 12px;
    border-radius: 5px;
    font-size: 0.85rem;
    font-weight: 600;
    display: none;
}
.mf-status.show    { display: block; }
.mf-status.success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.mf-status.error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.mf-status.info    { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ══ MINI ══════════════════════════════════════════════════════════════════ */
.mf-mini { max-width: 460px; }
.mf-mini .mf-cell.mf-def    { width: 110px; height: 44px; }
.mf-mini .mf-cell.mf-letter { width: 44px;  height: 44px; }
.mf-mini .mf-cell.mf-black  { width: 44px;  height: 44px; }
.mf-mini .mf-clue-text       { font-size: 11px; line-height: 1.05; }
.mf-mini .mf-arrow           { font-size: 14px; }
.mf-mini .mf-inp             { font-size: 18px; }

/* ══ GRAND ═════════════════════════════════════════════════════════════════ */
.mf-grand { max-width: 760px; }
.mf-grand .mf-cell.mf-def    { width: 150px; height: 52px; }
.mf-grand .mf-cell.mf-letter { width: 52px;  height: 52px; }
.mf-grand .mf-cell.mf-black  { width: 52px;  height: 52px; }
.mf-grand .mf-clue-text       { font-size: 14px; line-height: 0.8; }
.mf-grand .mf-arrow           { font-size: 16px; }
.mf-grand .mf-inp             { font-size: 22px; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 520px) {
    .mf-mini .mf-cell.mf-def    { width: 90px;  height: 40px; }
    .mf-mini .mf-cell.mf-letter { width: 36px;  height: 40px; }
    .mf-mini .mf-cell.mf-black  { width: 36px;  height: 40px; }
    .mf-mini .mf-clue-text       { font-size: 8px; }
    .mf-mini .mf-inp             { font-size: 15px; }

    .mf-grand .mf-cell.mf-def    { width: 110px; height: 46px; }
    .mf-grand .mf-cell.mf-letter { width: 40px;  height: 46px; }
    .mf-grand .mf-cell.mf-black  { width: 40px;  height: 46px; }
    .mf-grand .mf-clue-text       { font-size: 8.5px; }
    .mf-grand .mf-inp             { font-size: 18px; }
}
@media (max-width: 380px) {
    .mf-mini .mf-cell.mf-def    { width: 76px;  height: 38px; }
    .mf-mini .mf-cell.mf-letter { width: 32px;  height: 38px; }
    .mf-mini .mf-cell.mf-black  { width: 32px;  height: 38px; }
    .mf-mini .mf-inp             { font-size: 13px; }

    .mf-grand .mf-cell.mf-def    { width: 88px;  height: 42px; }
    .mf-grand .mf-cell.mf-letter { width: 34px;  height: 42px; }
    .mf-grand .mf-cell.mf-black  { width: 34px;  height: 42px; }
    .mf-grand .mf-inp             { font-size: 15px; }
}
