/* Редактор подсказок: адаптивная верстка для десктопа и мобильных браузеров */
* {
    box-sizing: border-box;
}

:root {
    --bg: #f2f4f7;
    --card-bg: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #d1d5db;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --ok: #16a34a;
    --ok-hover: #15803d;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.45;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 16px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    width: 100%;
    max-width: 640px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card-header {
    text-align: center;
}

.word-wrap {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    border-radius: 8px;
    padding: 4px 8px;
    margin: -4px -8px;
    transition: background-color 0.15s;
}

.word-wrap:hover {
    background: #f3f4f6;
}

.word {
    margin: 0;
    font-size: clamp(28px, 6vw, 40px);
    font-weight: 700;
    letter-spacing: 0.08em;
    word-break: break-word;
}

.word-id {
    color: var(--muted);
    font-size: 13px;
    margin-top: 2px;
}

.remaining {
    margin-top: 6px;
    color: var(--muted);
    font-size: 14px;
}

.hint-block {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hint-block.missing {
    opacity: 0.6;
}

.hint-label {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.hint-name {
    font-weight: 600;
}

.source-tag, .checked-tag {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
}

.source-tag {
    background: #e5e7eb;
    color: var(--muted);
}

.checked-tag {
    background: #dcfce7;
    color: var(--ok);
}

.hint-value {
    width: 100%;
    font: inherit;
    font-size: 16px; /* 16px, чтобы iOS не приближал страницу при фокусе */
    color: var(--text);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    resize: vertical;
    min-height: 76px;
    overflow: hidden; /* авторазмер по высоте через JS */
}

.hint-value:focus {
    outline: 2px solid var(--primary);
    outline-offset: -1px;
    border-color: var(--primary);
}

.hint-value[disabled] {
    background: #f9fafb;
    color: var(--muted);
}

.hint-actions, .global-actions {
    display: flex;
    gap: 10px;
}

.hint-actions .btn {
    flex: 1 1 0;
}

.global-actions {
    justify-content: space-between;
}

.global-actions .btn {
    flex: 1 1 0;
    min-width: 140px;
}

.btn {
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    min-height: 44px; /* удобная зона нажатия на мобильных */
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn:hover:not(:disabled) {
    background: #f3f4f6;
}

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

.btn.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn.primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn.ok {
    background: var(--ok);
    border-color: var(--ok);
    color: #fff;
}

.btn.ok:hover:not(:disabled) {
    background: var(--ok-hover);
}

.btn.danger {
    background: #fff;
    border-color: var(--danger);
    color: var(--danger);
}

.btn.danger:hover:not(:disabled) {
    background: #fef2f2;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    background: #111827;
    color: #fff;
    font-size: 15px;
    padding: 10px 20px;
    border-radius: 999px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    max-width: calc(100vw - 32px);
    text-align: center;
    z-index: 10;
}

/* Узкие экраны: кнопки в столбик, меньше отступов */
@media (max-width: 480px) {
    body {
        padding: 8px;
    }

    .card {
        padding: 14px;
        gap: 14px;
    }

    .hint-actions {
        flex-direction: column;
    }

    .global-actions {
        flex-direction: column-reverse;
    }

    .global-actions .btn {
        min-width: 0;
    }
}
