:root {
    /* Base */
    --bg: #f7f7f9;
    --card: #ffffff;
    --text: #111827;
    --muted: #6b7280;
    --border: #e5e7eb;

    /* Brand */
    --primary: #4f46e5;
    --primary-strong: #6366f1;
    --primary-soft: #e0e7ff;

    /* Action */
    --accent: #2563eb;

    /* State */
    --disabled-bg: #f3f4f6;
    --disabled-text: #9ca3af;

    /* Neutral */
    --gray-btn: #e5e7eb;
    --gray-text: #374151;

    /* Warning */
    --warning: #ff5316;
}

/* ---------- Reset ---------- */
* {
    box-sizing: border-box;
}
a { text-decoration: none; color: inherit; }
body {
    margin: 0;
    background: var(--bg);
    font-family: system-ui, -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
    color: var(--text);
}

/* ---------- Layout ---------- */
.container {
    max-width: 520px;
    margin: 0 auto;
    padding: 16px;
}

/* ---------- Header ---------- */
header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
}

/* ---------- Info ---------- */
.info {
    background: var(--primary-soft);
    border-radius: 12px;
    padding: 14px;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 16px;
}

#remainInfo {
    margin-top: 6px;
    font-size: 14px;
    color: var(--warning);
    font-weight: bold;
}

/* ---------- Category ---------- */
.category-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.cat-btn {
    display: block;
}

.cat-btn input {
    display: none;
}

.cat-btn span {
    display: block;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    font-size: 14px;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
    transition: background-color .15s ease, color .15s ease;
}

.cat-btn input:checked + span {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ---------- Input ---------- */
textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 12px;
    resize: none;              /* 크기 조절 완전 차단 */
    outline: none;
    font-size: 15px;
}

textarea:disabled {
    background: var(--disabled-bg);
    color: var(--disabled-text);
}

/* ---------- Buttons (Common) ---------- */
button {
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    border: none;              /* 테두리 제거 */
    cursor: pointer;
    transition:
            background-color .15s ease,
            transform .08s ease,
            opacity .15s ease;
}

button:active {
    transform: scale(0.97);
}

/* ---------- Primary Button ---------- */
button.primary.active { opacity: 1; pointer-events: auto; }
button.primary {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity .5s ease, background .5s ease;
    background: linear-gradient(
            135deg,
            var(--primary),
            var(--primary-strong)
    );
    color: #fff;
}

button.primary:disabled {
    /*background: var(--disabled-bg);*/
    /*color: var(--disabled-text);*/
    cursor: not-allowed;
}

/* ---------- Result ---------- */
#result {
    margin-top: 20px;
}

/* ---------- Cards ---------- */
.card-wrap {
    background: var(--card);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}

.card-wrap h4 {
    margin: 0 0 6px;
    font-size: 15px;
}

.card-wrap p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

/* ---------- Share / Retry ---------- */
.share {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

button.kakao {
    background: linear-gradient(
            135deg,
            var(--primary-strong),
            #3b82f6
    );
    color: #fff;
}

button.retry-btn {
    background: #ffffff;
    color: var(--gray-text);
    border: 1px solid var(--border);
}


/* ---------- Footer ---------- */
footer {
    margin: 40px 0 20px;
    text-align: center;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
}

/* ---------- Modal ---------- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
}

.modal-box {
    max-width: 320px;
    margin: 30vh auto 0;
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    text-align: center;
}

.modal-box h3 {
    margin: 0 0 10px;
    font-size: 17px;
}

.modal-box p {
    font-size: 14px;
    color: var(--gray-text);
}

.modal-box button {
    margin-top: 16px;
    background: var(--primary);
    color: #fff;
}

/* ---------- Utility ---------- */
.hidden {
    display: none;
}
/* 복사 토스트 */
.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    background: var(--text);
    color: #fff;
    padding: 12px 16px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 6px 20px rgba(0,0,0,.15);
    z-index: 9999;
    opacity: 0;
    transition: opacity .2s ease, transform .2s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(-6px);
}

.hidden {
    display: none;
}
