/* Explain: Styles for the QR share area: frame, URL box, action buttons, states. */
/* 푸가로 놀이터 공유 영역: QR 코드를 담는 틀과 놀이터 주소 입력란, 버튼 줄과 안내 표시를
   한 가지 결로 맞춰 휴대폰과 큰 화면 모두에서 같은 순서로 고르게 읽히도록 정리합니다. */

/* QR 코드 틀: 정사각형 자리를 미리 잡아 두어, 코드가 만들어지는 동안에도 배치가 흔들리지 않습니다. */
.qr-frame {
    position: relative;
    display: flex;
    width: 100%;
    max-width: 100%;
    margin-inline: auto;
    aspect-ratio: 1;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 1.75rem;
    background: var(--cream-color);
    padding: 0.8rem;
    box-shadow: var(--shadow-card);
}

/* 큰 화면에서는 QR 코드가 지나치게 커지지 않도록 폭을 한정하고,
   안쪽 여백도 조금 넓혀 코드를 감싸는 틀이 차분하게 보이도록 합니다. */
@media (min-width: 640px) {
    .qr-frame {
        max-width: 20rem;
        padding: 1rem;
    }
}

/* QR 그림은 완성된 뒤에만 보여 주어, 만들어지는 중에는 안내 문구만 차분히 보입니다. */
.qr-frame img {
    display: none;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.qr-frame img.is-on {
    display: block;
}

/* 만들어지는 중·만들지 못했을 때의 안내: 같은 자리에서 문구만 바뀝니다. */
.qr-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.7;
    color: var(--text-muted);
}

.qr-state.hidden {
    display: none;
}

.qr-state i {
    font-size: 1.3rem;
    color: var(--primary-color);
}

.qr-state-error i {
    color: var(--accent-color);
}

/* 놀이터 주소 입력란: 긴 주소도 한 줄 안에서 끝나도록 하고, 눌러서 바로 복사할 수 있게 합니다. */
.share-url-box {
    margin-top: 1.25rem;
}

.share-url-label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--charcoal-color);
}

.share-url {
    width: 100%;
    min-height: 3rem;
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    background: color-mix(in srgb, var(--secondary-color) 18%, var(--cream-color));
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
    color: var(--charcoal-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: text;
}

.share-url:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 18%, transparent);
}

/* 공유 버튼 줄: 내려받기·주소 복사 두 버튼을 같은 크기로 나란히 두어,
   휴대폰에서는 한 줄씩(한 칸), 큰 화면에서는 나란히 두 칸으로 고르게 놓입니다. */
.share-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.6rem;
    margin-top: 1.25rem;
}

@media (min-width: 640px) {
    .share-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* 두 버튼 모두 손가락으로 누르기 편한 높이를 지키고, 글자가 길어져도 잘리지 않습니다. */
.share-action-btn {
    display: inline-flex;
    width: 100%;
    min-height: 3rem;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    border-radius: 999px;
    padding: 0.6rem 1.1rem;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.5;
    text-align: center;
    white-space: normal;
    cursor: pointer;
    transition: background 200ms ease, color 200ms ease, border-color 200ms ease;
}

.share-action-primary {
    border: 0;
    background: var(--primary-color);
    color: var(--cream-color);
}

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

/* QR 코드가 아직 만들어지지 않았을 때는 내려받기 버튼을 흐리게 두어,
   지금은 누를 수 없다는 것을 바로 알 수 있게 합니다. */
.share-action-primary:disabled {
    cursor: default;
    opacity: 0.55;
}

.share-action-ghost {
    border: 1px solid var(--border-color);
    background: var(--cream-color);
    color: var(--charcoal-color);
}

.share-action-ghost:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* 다시 만들기: 두 버튼 아래에서 한 줄 폭을 그대로 써, 어느 화면에서나 같은 자리에서 이어집니다. */
.share-retry {
    display: inline-flex;
    width: 100%;
    min-height: 2.9rem;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    margin-top: 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: color-mix(in srgb, var(--secondary-color) 20%, var(--cream-color));
    padding: 0.6rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.5;
    text-align: center;
    white-space: normal;
    color: var(--charcoal-color);
    cursor: pointer;
    transition: border-color 200ms ease, color 200ms ease, background 200ms ease;
}

.share-retry:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* 만들어지지 못했을 때만 보이도록, 감춤 표시가 이 버튼의 모양 규칙보다 먼저 지켜집니다. */
.share-retry.hidden {
    display: none;
}