.random-travel-page {
    min-height: calc(100vh - 100px);
    padding: 44px 20px 80px;
    background: #fafafc;
    color: var(--tripbora-text);
}

.random-travel-shell {
    width: min(1080px, 100%);
    margin: 0 auto;
}

.random-travel-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(240px, 0.65fr);
    align-items: center;
    min-height: 410px;
    overflow: hidden;
    border: 1px solid var(--tripbora-border);
    border-radius: 28px;
    background: var(--tripbora-soft);
}

.random-travel-copy {
    position: relative;
    z-index: 2;
    padding: 58px 28px 58px 64px;
}

.random-travel-eyebrow {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 5px 12px;
    border: 1px solid var(--tripbora-border);
    border-radius: 999px;
    background: #fff;
    color: var(--tripbora-primary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.13em;
}

.random-travel-hero h1 {
    margin-top: 20px;
    color: #123d43;
    font-size: clamp(36px, 5vw, 58px);
    line-height: 1.16;
    letter-spacing: -0.04em;
}

.random-travel-subtitle {
    max-width: 560px;
    margin-top: 16px;
    color: #52747a;
    font-size: 18px;
    line-height: 1.7;
}

.random-scope-group {
    display: inline-flex;
    gap: 8px;
    margin-top: 30px;
    padding: 5px;
    border: 1px solid var(--tripbora-border);
    border-radius: 16px;
    background: #fff;
}

.random-scope-button {
    min-width: 112px;
    min-height: 46px;
    box-sizing: border-box;
    border: 1px solid var(--tripbora-border);
    border-radius: 11px;
    background: #fff;
    color: var(--tripbora-text);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.random-scope-button:hover:not(:disabled) {
    border-color: var(--tripbora-border);
    background: var(--tripbora-soft);
    color: var(--tripbora-primary-hover);
}

.random-scope-button.is-active {
    border-color: var(--tripbora-border);
    background: var(--tripbora-soft);
    color: var(--tripbora-primary);
}

.random-scope-button:active:not(:disabled) {
    border-color: var(--tripbora-primary-active);
    background: var(--tripbora-soft);
    color: var(--tripbora-primary-active);
}

.random-scope-button:focus-visible,
.random-draw-button:focus-visible,
.random-destination-card:focus-visible,
.random-redraw-button:focus-visible {
    outline: 3px solid var(--tripbora-focus);
    outline-offset: 3px;
}

.random-draw-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-width: 230px;
    min-height: 54px;
    margin-top: 20px;
    padding: 13px 24px;
    border: 0;
    border-radius: 15px;
    background: var(--tripbora-primary);
    color: #fff;
    font: inherit;
    font-size: 17px;
    font-weight: 800;
    cursor: pointer;
    transition: background-color 160ms ease, transform 160ms ease;
}

.random-draw-button:hover:not(:disabled) {
    background: var(--tripbora-primary-hover);
    transform: translateY(-1px);
}

.random-draw-button:disabled,
.random-scope-button:disabled,
.random-redraw-button:disabled {
    cursor: wait;
    opacity: 0.66;
}

.random-travel-decoration {
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 42px 30px 0;
}

.random-travel-decoration::before {
    position: absolute;
    right: 40px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: #ddecfa;
    content: '';
}

.random-travel-decoration img {
    position: relative;
    z-index: 1;
    width: min(280px, 100%);
    aspect-ratio: 1;
    border-radius: 50%;
    object-fit: cover;
    opacity: 0.84;
}

.random-status {
    min-height: 28px;
    margin: 24px 0 10px;
    color: #52747a;
    text-align: center;
    font-size: 15px;
}

.random-stage {
    width: min(620px, 100%);
    margin: 0 auto;
    padding: 28px 24px;
    border: 1px dashed var(--tripbora-border);
    border-radius: 20px;
    background: #fff;
    text-align: center;
}

.random-stage span {
    display: block;
    color: #65636d;
    font-size: 14px;
}

.random-stage strong {
    display: block;
    min-height: 46px;
    margin-top: 8px;
    color: var(--tripbora-primary);
    font-size: 30px;
    line-height: 1.5;
}

/* 결과 카드는 갑자기 나타나지 않고 살짝 올라오며 등장한다 */
.random-result {
    width: 100%;
    margin: 0 auto;
    opacity: 0;
    transform: translateY(14px) scale(0.985);
    transition: opacity 420ms ease, transform 420ms ease;
}

.random-result.is-revealed {
    opacity: 1;
    transform: none;
}

/* 결과 확정 직전의 짧은 정지 */
.random-stage.is-locked strong {
    transform: scale(1.06);
    transition: transform 260ms ease;
}

/* 당첨 순간의 작은 축하 효과 */
.random-confetti {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.random-confetti-piece {
    position: absolute;
    top: -12px;
    width: 7px;
    height: 11px;
    border-radius: 2px;
    background: var(--tripbora-primary);
    opacity: 0;
    animation: random-confetti-fall 1200ms ease-in forwards;
}

.random-confetti-piece:nth-child(3n) {
    background: #f3a88f;
}

.random-confetti-piece:nth-child(3n + 1) {
    background: #c4b5fd;
}

@keyframes random-confetti-fall {
    0% {
        opacity: 0;
        transform: translateY(0) rotate(0deg);
    }
    15% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateY(180px) rotate(320deg);
    }
}

.random-region-result {
    position: relative;
    overflow: hidden;
    padding: 42px 32px;
    border: 1px solid #cae3e6;
    border-radius: 24px;
    background: #fff;
    text-align: center;
}

.random-region-result::after {
    position: absolute;
    top: 24px;
    right: 34px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #f3a88f;
    content: '';
}

.random-region-kicker {
    color: #6c8a8f;
    font-size: 14px;
    font-weight: 700;
}

.random-region-country {
    margin-top: 17px;
    color: #0c7b7a;
    font-size: 16px;
    font-weight: 800;
}

.random-region-name {
    margin-top: 4px;
    color: #173e44;
    font-size: clamp(38px, 6vw, 58px);
    line-height: 1.15;
    letter-spacing: -0.04em;
}

.random-region-summary {
    margin-top: 14px;
    color: #58767b;
    line-height: 1.7;
}

.random-destinations {
    padding-top: 42px;
}

.random-destinations-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.random-destinations-heading h3 {
    color: #173e44;
    font-size: 27px;
    letter-spacing: -0.03em;
}

.random-destinations-heading p {
    color: #708b90;
    font-size: 14px;
}

/* PC 4열 × 2줄(최대 8곳). 좁아지면 아래 미디어쿼리에서 3 → 2 → 1열로 줄어든다. */
.random-destination-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    column-gap: 26px;
    row-gap: 32px;
}

.random-destination-card {
    display: flex;
    min-width: 0;
    overflow: hidden;
    flex-direction: column;
    border: 1px solid #d7e7e9;
    border-radius: 18px;
    background: #fff;
    color: inherit;
    text-decoration: none;
    transition: border-color 180ms ease, transform 180ms ease;
}

.random-destination-card:hover {
    border-color: #a9d3d7;
    transform: translateY(-3px);
}

.random-destination-image-wrap {
    overflow: hidden;
    aspect-ratio: 16 / 11;
    background: #e7f1f3;
}

.random-destination-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 220ms ease;
}

.random-destination-card:hover .random-destination-image {
    transform: scale(1.025);
}

.random-destination-content {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 15px 16px 14px;
}

.random-destination-location {
    color: #0c7b7a;
    font-size: 13px;
    font-weight: 700;
}

.random-destination-name {
    margin-top: 5px;
    color: #173e44;
    font-size: 19px;
    line-height: 1.32;
    letter-spacing: -0.02em;
}

.random-destination-description {
    display: -webkit-box;
    overflow: hidden;
    margin-top: 7px;
    color: #617d82;
    font-size: 14px;
    line-height: 1.55;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.random-destination-cta {
    margin-top: auto;
    padding-top: 12px;
    color: var(--tripbora-primary);
    font-size: 13px;
    font-weight: 800;
}

/* 두 버튼이 같은 폭·높이를 갖도록 2열 그리드로 배치한다 */
.random-destinations-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    justify-content: center;
    gap: 8px;
    width: min(100%, 360px);
    margin: 24px auto 0;
}

/* 다시 뽑기: 작은 중립 outline 버튼 */
.random-redraw-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    margin: 0;
    padding: 6px 12px;
    border: 1px solid #d5dee0;
    border-radius: 8px;
    background: #fff;
    color: #5b7276;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
}

.random-redraw-button:hover {
    background: #f6f9f9;
    border-color: var(--tripbora-border);
}

/* 결과 지역으로 필터된 여행지 목록으로 이동 (primary, 컴팩트하게) */
.random-all-destinations-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    padding: 6px 12px;
    border: 1px solid var(--tripbora-primary);
    border-radius: 8px;
    background: var(--tripbora-primary);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    transition: background-color 160ms ease, border-color 160ms ease;
}

.random-all-destinations-link:hover {
    background: #066b68;
    border-color: #066b68;
}

.random-all-destinations-link:focus-visible {
    outline: 3px solid var(--tripbora-focus);
    outline-offset: 3px;
}

.random-all-destinations-arrow {
    font-size: 14px;
    line-height: 1;
}

.random-message {
    padding: 34px 24px;
    border: 1px solid #d7e7e9;
    border-radius: 20px;
    background: #fff;
    text-align: center;
}

.random-message strong {
    color: #244e54;
    font-size: 19px;
}

.random-message p {
    margin-top: 8px;
    color: #6a8589;
    line-height: 1.6;
}

.random-message.is-error {
    border-color: #f2c9bf;
    background: #fff9f6;
}

@media (max-width: 1180px) {
    .random-destination-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .random-destination-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .random-travel-page {
        padding: 24px 14px 56px;
    }

    .random-travel-hero {
        grid-template-columns: 1fr;
        min-height: 0;
        border-radius: 22px;
    }

    .random-travel-copy {
        padding: 38px 24px 28px;
    }

    .random-travel-hero h1 {
        font-size: 36px;
    }

    .random-travel-subtitle {
        font-size: 16px;
    }

    .random-scope-group,
    .random-draw-button {
        width: 100%;
    }

    .random-scope-button {
        flex: 1;
        min-width: 0;
    }

    /*
      뽑는 중 상자. 기본 규칙은 content-box 라 width: 100% 에 좌우 padding·border 가
      더해져 좁은 화면에서는 부모보다 넓어지고 오른쪽 끝이 화면 밖으로 나간다.
      padding·border 를 폭 안에 넣는다. 670px 은 기본 규칙의 전체 폭
      (본문 620 + padding 24×2 + border 1×2)이라 넓은 화면에서 보이는 크기는 같다.
    */
    .random-stage {
        box-sizing: border-box;
        width: min(670px, 100%);
        max-width: 100%;
        min-width: 0;
    }

    .random-travel-decoration {
        justify-content: flex-end;
        height: 110px;
        padding: 0 20px 16px;
        overflow: hidden;
    }

    .random-travel-decoration::before {
        right: 24px;
        width: 130px;
        height: 130px;
    }

    .random-travel-decoration img {
        width: 130px;
        opacity: 0.66;
    }

    .random-region-result {
        padding: 34px 20px;
    }

    .random-region-result::after {
        top: 18px;
        right: 20px;
    }

    .random-destinations-heading {
        display: block;
    }

    .random-destinations-heading h3 {
        font-size: 23px;
    }

    .random-destinations-heading p {
        margin-top: 6px;
    }

    .random-destination-grid {
        grid-template-columns: 1fr;
    }

    .random-destination-card,
    .random-redraw-button,
    .random-all-destinations-link {
        width: 100%;
    }
}

/*
  ===== 스마트폰 정리 =====

  위 720px 규칙은 넓은 화면 배치를 세로로 쌓은 것이라, 스마트폰에서는
  첫 화면이 소개 카드로 거의 차고 결과는 한 장이 400px 넘는 카드 8장으로 길게 이어진다.
  여기서는 조건(국내/해외) → 뽑기 → 결과가 한 흐름으로 짧게 이어지도록 줄이고,
  결과는 2열 작은 카드로 바꾼다. 결과 버튼 줄은 결과를 넘기는 동안 화면 아래에 붙어 있다.
*/
@media (max-width: 560px) {
    .random-travel-page {
        min-height: 0;
        padding: 14px 16px 40px;
    }

    .random-travel-hero {
        border-radius: 16px;
    }

    .random-travel-copy {
        padding: 20px 16px 18px;
    }

    .random-travel-eyebrow {
        min-height: 24px;
        padding: 3px 10px;
        font-size: 11px;
    }

    .random-travel-hero h1 {
        margin-top: 12px;
        font-size: 26px;
        line-height: 1.25;
    }

    .random-travel-subtitle {
        margin-top: 6px;
        font-size: 14px;
        line-height: 1.55;
    }

    /* 국내/해외는 화면 폭을 반씩 나누는 segmented control 로 둔다 */
    .random-scope-group {
        gap: 4px;
        margin-top: 16px;
        padding: 4px;
        border-radius: 12px;
    }

    .random-scope-button {
        min-height: 40px;
        border-radius: 9px;
        font-size: 15px;
    }

    .random-draw-button {
        min-width: 0;
        min-height: 46px;
        margin-top: 10px;
        padding: 10px 18px;
        border-radius: 12px;
        font-size: 16px;
    }

    /* 장식 그림은 스마트폰에서 뽑기 버튼을 아래로 밀어내기만 해서 뺀다 */
    .random-travel-decoration {
        display: none;
    }

    .random-status {
        min-height: 20px;
        margin: 12px 0 8px;
        font-size: 13.5px;
    }

    .random-stage {
        padding: 18px 16px;
        border-radius: 14px;
    }

    /* 긴 지역 이름은 상자를 넓히지 않고 상자 안에서 줄을 바꾼다. 짧은 이름은 그대로 한 줄 */
    .random-stage strong {
        max-width: 100%;
        min-height: 36px;
        margin-top: 4px;
        font-size: 24px;
        overflow-wrap: anywhere;
    }

    /* 뽑힌 지역: 큰 소개 카드 대신 짧은 머리글 */
    .random-region-result {
        padding: 18px 16px 16px;
        border-radius: 14px;
    }

    .random-region-result::after {
        top: 14px;
        right: 16px;
        width: 10px;
        height: 10px;
    }

    .random-region-kicker {
        font-size: 12px;
    }

    .random-region-country {
        margin-top: 8px;
        font-size: 14px;
    }

    .random-region-name {
        margin-top: 2px;
        font-size: 30px;
    }

    .random-region-summary {
        margin-top: 6px;
        font-size: 13.5px;
        line-height: 1.55;
    }

    .random-destinations {
        padding-top: 20px;
    }

    .random-destinations-heading {
        display: flex;
        align-items: baseline;
        gap: 10px;
        margin-bottom: 12px;
    }

    .random-destinations-heading h3 {
        min-width: 0;
        font-size: 18px;
    }

    .random-destinations-heading p {
        flex: 0 0 auto;
        margin-top: 0;
        font-size: 12.5px;
    }

    /* 2열 작은 카드: 사진 4:3, 이름 2줄, 설명 2줄 */
    .random-destination-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px 10px;
    }

    .random-destination-card {
        border-radius: 12px;
    }

    .random-destination-image-wrap {
        aspect-ratio: 4 / 3;
    }

    .random-destination-content {
        padding: 9px 10px 10px;
    }

    .random-destination-location {
        font-size: 11.5px;
    }

    .random-destination-name {
        display: -webkit-box;
        overflow: hidden;
        margin-top: 3px;
        font-size: 14.5px;
        line-height: 1.35;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    .random-destination-description {
        margin-top: 4px;
        font-size: 12.5px;
        line-height: 1.5;
        -webkit-line-clamp: 2;
    }

    .random-destination-cta {
        padding-top: 6px;
        font-size: 12px;
    }

    /*
      [지역 여행지 전체 보기] [다시 뽑기] 는 결과를 넘기는 동안 화면 아래에 붙어 있다.
      결과 구역을 벗어나면 원래 자리(목록 끝)로 돌아간다.
    */
    .random-destinations-actions {
        position: sticky;
        bottom: 0;
        z-index: 2;
        width: auto;
        margin: 16px -16px 0;
        padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
        border-top: 1px solid var(--tripbora-border);
        background: #fff;
    }

    /* "OO 전체 여행지 보기" 가 한 줄에 들어가도록 이동 버튼에 폭을 더 준다 */
    .random-destinations-actions {
        grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    }

    .random-redraw-button,
    .random-all-destinations-link {
        box-sizing: border-box;
        min-width: 0;
        min-height: 42px;
        padding-inline: 10px;
        border-radius: 10px;
        white-space: nowrap;
    }

    /* 지역 이름이 길면 줄을 바꾸지 않고 말줄임으로 끝낸다 */
    .random-all-destinations-link > span:first-child {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .random-message {
        padding: 20px 16px;
        border-radius: 14px;
    }

    .random-message strong {
        font-size: 16px;
    }

    .random-message p {
        margin-top: 6px;
        font-size: 13.5px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .random-scope-button,
    .random-draw-button,
    .random-destination-card,
    .random-destination-image {
        transition: none;
    }

    .random-destination-card:hover,
    .random-destination-card:hover .random-destination-image {
        transform: none;
    }

    /* 등장 효과와 축하 효과는 끄고 결과만 바로 보여준다 */
    .random-result {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .random-confetti {
        display: none;
    }
}
