/* 1. 웹폰트 및 기본 설정 */
    @import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

    :root {
      /* Pastel Color Palette */
      --pastel-bg: #F7EDE2; /* Light Peach */
      --pastel-text-dark: #4A4E69; /* Dark Blue-Gray */
      --pastel-text-medium: #888B9E; /* Medium Blue-Gray */
      --pastel-accent-primary: #FFB5A7; /* Soft Coral */
      --pastel-accent-secondary: #C8D1ED; /* Light Periwinkle */
      --pastel-male-color: #5A95CC; /* Stronger Blue */
      --pastel-female-color: #E78399; /* Stronger Pink */
      --card-bg-transparent: rgba(255, 255, 255, 0.75); /* White with Transparency */
      --card-border-light: rgba(255, 255, 255, 0.9);
      --card-border-hover: rgba(255, 181, 167, 0.8);
      --shadow-light: rgba(0, 0, 0, 0.08);
      --shadow-medium: rgba(0, 0, 0, 0.12);
    }

    body {
      background-color: var(--pastel-bg);
      color: var(--pastel-text-dark); /* Changed to a darker pastel shade for readability */
      font-family: 'Noto Sans KR', sans-serif;
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    /* Override body text color for elements that are on the video overlay */
    #hero, header {
      color: #fff;
    }

    /* Section Title */
    .section-title {
      font-family: 'Pretendard', sans-serif;
      font-weight: 700;
      font-size: 2.2em; /* Slightly larger */
      color: var(--card-border-light); /* Changed for pastel tone */
      border-bottom: 2px solid var(--pastel-accent-primary); /* Accent color border */
      padding-bottom: 10px;
      margin-bottom: 40px;
      text-align: center;
      text-shadow: none; /* Removed text shadow */
    }

    /* Video Background */
    #bgvideo {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      object-fit: cover;
      z-index: 0;
    }

    #overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(0, 0, 0, 0.4); /* Slightly lighter overlay */
      z-index: 1;
    }

    #content {
      position: relative;
      z-index: 2;
    }

    header {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      padding: 20px;
      box-sizing: border-box;
      text-align: left;
    }

    header h1 {
      margin: 0;
      font-family: 'Noto Sans KR', sans-serif; /* Changed font to Noto Sans KR for consistency */
      font-size: 2em;
      color: #fff;
      font-weight: 700;
    }

    #hero {
      position: relative;
      height: 100vh;
      display: flex; /* Use flexbox for centering */
      align-items: center;
      justify-content: center;
      padding-top: 60px; /* Adjust for header */
    }

    .hero-text {
      text-align: center;
      padding: 0 20px;
      box-sizing: border-box;
      color: #fff; /* Ensure text is white over video */
    }

    .hero-main-title {
      font-family: 'Pretendard', sans-serif; /* Modern font for main title */
      font-size: 3.8em; /* Larger title */
      font-weight: 800;
      letter-spacing: -1px;
      line-height: 1.2;
      margin: 0 0 15px;
      text-shadow: 0 2px 10px rgba(0,0,0,0.5); /* Stronger shadow for readability */
    }

    .hero-text p {
      font-size: 1.25em; /* Slightly larger paragraph */
      margin: 0 0 30px;
      line-height: 1.6;
      color: rgba(255, 255, 255, 0.9);
      font-weight: 400;
      text-shadow: 0 1px 6px rgba(0,0,0,0.3);
    }

    .scroll-down-indicator {
      margin-top: 40px;
      color: rgba(255, 255, 255, 0.9);
      font-size: 1.1em;
    }

    @keyframes arrow-bounce {
      0%, 100% {
        transform: translateY(0) rotate(-45deg);
      }
      50% {
        transform: translateY(10px) rotate(-45deg);
      }
    }

    .arrow-down {
      border-left: 4px solid var(--pastel-accent-primary);
      border-bottom: 4px solid var(--pastel-accent-primary);
      width: 20px;
      height: 20px;
      margin: 20px auto 0;
      transform: rotate(-45deg);
      animation: arrow-bounce 2s infinite;
    }

    /* Section Styling */
    section {
      padding: 80px 20px; /* More vertical padding */
      box-sizing: border-box;
      max-width: 1200px; /* Max width for content */
      margin: 0 auto; /* Center sections */
    }

    #guide ol {
      list-style: none; /* Remove default list style */
      padding: 0;
      margin: 0;
    }

    #guide li {
      background: var(--card-bg-transparent); /* Transparent background for list items */
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      border-radius: 12px;
      padding: 20px;
      margin-bottom: 15px;
      font-size: 1.1em;
      line-height: 1.6;
      color: var(--pastel-text-dark); /* Darker text for readability */
      box-shadow: 0 4px 15px var(--shadow-light);
      border: 1px solid var(--card-border-light);
      transition: transform 0.2s ease;
    }

    #guide li:hover {
      transform: translateY(-3px);
      box-shadow: 0 6px 20px var(--shadow-medium);
    }

    /* Event Cards */
    #events-container {
      display: grid; /* Use CSS Grid for better layout control */
      grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* Responsive grid */
      gap: 25px; /* More space between cards */
      margin-top: 40px;
      justify-items: center; /* Center items in the grid */
    }

    .event-card {
      /* 👇 1. 배경 투명도 조절 (0.75 -> 0.85) */
    background: rgba(255, 255, 255, 0.85); 
    
    /* 👇 2. 텍스트 그림자 추가 */
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.15); 
    
    /* --- 기존 스타일 (참고) --- */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 18px;
    box-shadow: 0 6px 25px var(--shadow-light);
    padding: 28px 22px;
    max-width: 340px;
    width: 100%;
    text-align: left;
    color: var(--pastel-text-dark);
    border: 1.5px solid var(--card-border-light);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    }

    .event-card:hover {
      transform: translateY(-8px); /* More pronounced lift on hover */
      box-shadow: 0 12px 35px var(--shadow-medium);
      border-color: var(--pastel-accent-primary); /* Accent border on hover */
    }

    .meeting-title {
      font-size: 2em; /* Larger title */
      font-weight: 800;
      text-align: center;
      color: var(--pastel-text-dark:); /* Pastel accent color for title */
      margin-bottom: 15px;
      padding-bottom: 10px;
      border-bottom: 2px solid rgba(0, 0, 0, 0.08); /* Lighter border */
      letter-spacing: -0.8px;
      /* ✨ [수정] 제목 가독성을 위해 기존 그림자 제거 */
      text-shadow: none;
    }

    .event-date-row {
      display: flex;
      justify-content: center;
      gap: 20px; /* More space */
      margin-bottom: 12px;
      font-weight: 600;
      color: var(--pastel-text-medium); /* Subtler color */
      font-size: 1.05em;
    }

    .event-date, .event-time {
      color: var(--pastel-text-medium); /* Consistent with row */
      font-size: 1em; /* Adjusted size */
      font-weight: 600;
      /* ✨ [수정] 일관된 텍스트 그림자 적용 */
      text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    }

    .event-info-row, .event-participants-row, .event-fee-row {
      display: flex;
      justify-content: space-around; /* Distribute space evenly */
      margin-bottom: 8px;
      font-size: 0.95em; /* Slightly larger */
      color: var(--pastel-text-medium);
    }

    .male-info {
      flex: 1;
      text-align: center;
      color: var(--pastel-male-color); /* Soft blue for male */
      font-weight: 700;
    }

    .female-info {
      flex: 1;
      text-align: center;
      color: var(--pastel-female-color); /* Soft pink for female */
      font-weight: 700;
    }

    .event-location-row {
      margin-top: 15px;
      margin-bottom: 15px;
      color: var(--pastel-text-medium);
      font-size: 0.95em;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
    }

    .event-location-row span:first-child::before {
      content: "📍"; /* Consistent icon */
      margin-right: 5px;
      font-size: 1.1em;
      opacity: 0.8;
    }

    /* Buttons */
    .apply-btn, .map-view-btn, .participants-view-btn {
      display: block; /* Make them block level for full width */
      width: calc(100% - 20px); /* Account for padding */
      margin: 10px auto; /* Center buttons with auto margins */
      background: var(--pastel-accent-primary); /* Primary accent color */
      color: #fff;
      border: none;
      border-radius: 8px; /* Slightly more rounded */
      padding: 14px 0; /* More padding */
      font-size: 1.1em; /* Slightly larger text */
      font-weight: 700;
      cursor: pointer;
      transition: background-color 0.3s ease, box-shadow 0.3s ease;
      box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    }

    .apply-btn:hover, .map-view-btn:hover, .participants-view-btn:hover {
      background-color: #FF8A65; /* Slightly darker shade on hover */
      box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
    }

    .apply-btn[disabled], .participants-view-btn[disabled] {
      background-color: #D3D3D3; /* Lighter disabled background */
      color: #A0A0A0; /* Lighter disabled text */
      cursor: not-allowed;
      opacity: 0.8;
      box-shadow: none;
    }

    /* Modals */
    /* ✨ [수정] 모달 기본 스타일 추가 */
    .modal, .custom-modal {
        display: none; /* Initially hidden */
        position: fixed;
        z-index: 1000;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        overflow: auto;
        background-color: rgba(0,0,0,0.5);
    }

    /* ✨ [추가] Flexbox 중앙 정렬을 위한 스타일 */
    .custom-modal {
        display: none; /* flex로 변경될 것임 */
        align-items: center;
        justify-content: center;
    }

    .modal-content {
      background: rgba(255, 255, 255, 0.9); /* Opaque white background */
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      margin: 10% auto;
      padding: 30px; /* More padding */
      border-radius: 18px; /* More rounded */
      max-width: 450px; /* Slightly wider modal */
      color: var(--pastel-text-dark); /* Darker text */
      box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25); /* Stronger shadow */
      border: 1px solid rgba(200, 200, 200, 0.3);
      position: relative; /* For close button positioning */
    }

    .close-btn {
      color: var(--pastel-text-medium); /* Close button color */
      background: none; /* No background */
      border: none;
      font-size: 2.5rem; /* Larger close button */
      position: absolute; /* Position relative to .modal-content */
      top: 15px;
      right: 20px;
      width: auto;
      height: auto;
      cursor: pointer;
    }

    .close-btn:hover, .close-btn:active {
      color: var(--pastel-accent-primary); /* Accent color on hover */
      background: none;
    }

    .modal-form input,
    .modal-form select {
      border: none; /* Remove default border */
      border-bottom: 2px solid var(--pastel-accent-primary); /* Accent color border */
      background: rgba(255, 255, 255, 0.7); /* Slightly transparent white input */
      color: var(--pastel-text-dark);
      padding: 14px; /* More padding */
      border-radius: 6px; /* Rounded input fields */
      margin-bottom: 15px;
      width: 100%; /* Full width */
      box-sizing: border-box; /* Include padding in width */
    }

    .modal-form select {
      background-color: rgba(255, 255, 255, 0.8);
    }

    .modal-form option {
      background-color: var(--pastel-bg); /* Match background */
      color: var(--pastel-text-dark);
    }

    .modal-form input::placeholder {
      color: rgba(74, 78, 105, 0.6); /* Darker placeholder */
    }

    .modal-form button {
      background-color: var(--pastel-accent-primary); /* Accent color button */
      padding: 14px;
      border-radius: 30px; /* More rounded */
      font-weight: 700;
      font-size: 1.1em;
      box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
      width: 100%;
      border: none;
      color: #fff;
      cursor: pointer;
      transition: background-color 0.2s, transform 0.2s;
    }

    .modal-form button:hover {
      background-color: #FF8A65; /* Darker accent on hover */
      transform: scale(1.02); /* Subtle scale */
    }

    .custom-modal-content {
      background: rgba(255, 255, 255, 0.9); /* Consistent transparent white */
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      border-radius: 18px;
      padding: 30px 25px;
      color: var(--pastel-text-dark);
      box-shadow: 0 10px 35px rgba(0, 0, 0, 0.2);
      border: 1px solid rgba(200, 200, 200, 0.3);
      max-width: 400px;
      width: 90%;
    }

    .custom-modal-content h3 {
      color: var(--pastel-text-dark);
      margin-bottom: 20px;
      font-size: 1.5em;
      text-align: center;
    }

    .modal-option-btn {
      background: var(--pastel-accent-secondary); /* Secondary accent color */
      color: var(--pastel-text-dark); /* Dark text on secondary accent */
      border-radius: 10px;
      padding: 15px 0;
      margin: 10px 0;
      font-weight: 700;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
      width: 100%;
      border: none;
      cursor: pointer;
      transition: background-color 0.2s, transform 0.2s;
    }

    .modal-option-btn:hover {
      background: #B3C1E0; /* Slightly darker periwinkle */
      transform: scale(1.02);
      color: var(--pastel-text-dark);
    }

    .modal-cancel-btn {
      background: #EFEFEF; /* Lighter background for cancel */
      color: var(--pastel-text-medium);
      border: 1px solid #DEDEDE;
      border-radius: 20px;
      padding: 12px 0;
      margin-top: 25px;
      width: 100%;
      cursor: pointer;
      transition: background-color 0.2s, color 0.2s, border-color 0.2s;
    }

    .modal-cancel-btn:hover {
      background: #E0E0E0;
      color: var(--pastel-text-dark);
      border-color: #C0C0C0;
    }

    .big-input, .big-select {
      border: 2px solid var(--pastel-accent-primary);
      background: rgba(255, 255, 255, 0.85); /* More opaque for direct input */
      color: var(--pastel-text-dark);
      font-size: 1.2rem;
      padding: 16px 15px;
      border-radius: 10px;
      box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
      width: 100%;
      box-sizing: border-box;
    }

    .big-select option {
      background: #fff;
      color: var(--pastel-text-dark);
    }

    .map-container {
      border-radius: 12px;
      box-shadow: 0 4px 15px rgba(0,0,0,0.1);
      background: #f0f0f0; /* Light background for maps */
    }

    .map-container iframe, .map-container img {
      border-radius: 12px; /* Apply border-radius to map content */
    }

    /* Map Modal Specific Styles */
    #mapModal {
        align-items: center;
        justify-content: center;
    }
    #mapModal .modal-content {
        max-width: 320px;
        width: 90vw;
        height: auto;
        max-height: 70vh; /* Adjusted max-height */
        padding: 20px;
        padding-top: 50px; /* Space for close button */
        margin: auto;
        display: flex;
        flex-direction: column;
        position: relative;
    }

    #mapModal #mapModalBody {
        flex-grow: 1;
        display: flex;
        flex-direction: column;
    }

    #mapModal .map-container {
        position: relative;
        width: 100%;
        padding-bottom: 100%; /* Creates a square aspect ratio */
        border-radius: 12px;
        overflow: hidden;
    }

    #mapModal .map-container iframe {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border: 0;
    }

    #mapModal .map-container img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border: 0;
        object-fit: contain; /* Ensure the entire image is visible */
    }

    .map-modal-buttons {
        display: flex;
        gap: 10px;
        margin-top: 15px;
        flex-shrink: 0;
    }

    .map-modal-buttons .apply-btn,
    .map-modal-buttons .modal-cancel-btn {
        flex: 1;
        width: auto;
        margin: 0;
        padding: 12px 5px;
        text-align: center;
        text-decoration: none;
    }

    .map-modal-buttons .modal-cancel-btn {
        margin-top: 0;
    }

    /* Responsive Adjustments */
    @media (max-width: 768px) {
      .hero-main-title {
        font-size: 2.8em;
      }
      .hero-text p {
        font-size: 1.1em;
      }
      .section-title {
        font-size: 2em;
      }
      .event-card {
        padding: 24px 18px;
      }
      .meeting-title {
        font-size: 1.8em;
      }
      .apply-btn, .map-view-btn, .participants-view-btn {
        padding: 12px 0;
        font-size: 1em;
      }
      .modal-content {
        margin: auto;
        padding: 25px;
        box-sizing: border-box; /* Add box-sizing */
      }
      #mapModal .modal-content {
        width: 90vw;
        max-width: 375px;
      }
    }

    @media (max-width: 480px) {
      header h1 {
        font-size: 1.8em;
      }
      .hero-main-title {
        font-size: 2.2em;
      }
      .hero-text p {
        font-size: 0.95em;
      }
      .section-title {
        font-size: 1.8em;
      }
      .event-card {
        max-width: 95%; /* Allow cards to take more width on small screens */
      }
      .meeting-title {
        font-size: 1.6em;
      }
      .apply-btn, .map-view-btn, .participants-view-btn {
        padding: 10px 0;
        font-size: 0.95em;
      }
      .modal-content {
        width: 95vw;
        padding: 20px;
        margin: 10% auto;
      }
      .close-btn {
        font-size: 2rem;
        width: 38px;
        height: 38px;
      }
      .big-input, .big-select {
        font-size: 1.1rem;
        padding: 14px 10px;
      }
    }

    /* Custom Matching Service Section */
    #custom-matching .guide-box {
      background: var(--card-bg-transparent);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      border-radius: 12px;
      padding: 30px;
      text-align: center;
      color: var(--pastel-text-dark);
      box-shadow: 0 4px 15px var(--shadow-light);
      border: 1px solid var(--card-border-light);
    }

    #custom-matching p {
      font-size: 1.1em;
      line-height: 1.7;
      margin-bottom: 25px;
    }

    #open-user-info-modal {
      max-width: 300px;
    }

    /* User Info & Preference Modals */
    #userInfoModal .modal-content, #preferenceModal .modal-content, #photoUploadModal .modal-content, #termsModal .modal-content {
      max-width: 550px; /* Increased width */
    }

    #userInfoForm label, #preferenceForm label, #photoUploadForm label {
      display: block;
      margin-top: 15px;
      margin-bottom: 8px;
      font-weight: 600;
      color: var(--pastel-text-dark);
    }

    .age-preference-inputs {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 15px;
    }

    .age-preference-inputs span {
      font-size: 1em;
    }

    .small-input {
      width: 80px;
      padding: 10px;
      font-size: 1em;
      text-align: center;
      border: 2px solid var(--pastel-accent-primary);
      border-radius: 8px;
    }

    #preferenceForm textarea {
      resize: vertical;
      min-height: 100px;
    }

    .form-buttons {
      display: flex;
      gap: 10px;
      margin-top: 20px;
    }

    .form-buttons button {
      flex: 1;
      margin: 0;
    }

    /* Custom File Input */
    .file-input-wrapper {
      position: relative;
      margin-bottom: 15px;
      display: flex;
      align-items: center;
      gap: 10px;
      background-color: rgba(255, 255, 255, 0.7);
      padding: 10px;
      border-radius: 8px;
      border: 1px solid var(--card-border-light);
    }

    .custom-file-input {
      width: 0.1px;
      height: 0.1px;
      opacity: 0;
      overflow: hidden;
      position: absolute;
      z-index: -1;
    }

    .custom-file-label {
      background-color: var(--pastel-accent-secondary);
      color: var(--pastel-text-dark);
      padding: 10px 15px;
      border-radius: 8px;
      cursor: pointer;
      font-weight: 600;
      transition: background-color 0.2s;
      flex-shrink: 0;
    }

    .custom-file-label:hover {
      background-color: #B3C1E0;
    }

    .file-name {
      font-size: 0.9em;
      color: var(--pastel-text-medium);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      flex-grow: 1;
    }

    .photo-preview {
      width: 80px;
      height: 80px;
      border-radius: 8px;
      border: 1px solid var(--card-border-light);
      object-fit: cover;
      display: none; /* Hidden by default */
      margin-right: 10px;
    }

    .terms-content {
      background-color: rgba(255, 255, 255, 0.5);
      padding: 20px;
      border-radius: 8px;
      margin-bottom: 20px;
      border: 1px solid var(--card-border-light);
    }

    .terms-content p {
      margin: 0 0 10px 0;
      line-height: 1.6;
    }

    /* Custom Radio Button for Gender */
    .gender-select-container {
      display: flex;
      gap: 10px;
      margin-bottom: 15px;
    }

    .custom-radio-input {
      display: none; /* Hide the actual radio button */
    }

    .gender-select-label {
      flex: 1;
      padding: 16px 15px;
      border: 2px solid var(--pastel-accent-secondary);
      background-color: rgba(255, 255, 255, 0.85);
      border-radius: 10px;
      text-align: center;
      cursor: pointer;
      font-size: 1.2rem;
      font-weight: 600;
      color: var(--pastel-text-medium);
      transition: background-color 0.2s, border-color 0.2s, color 0.2s;
    }

    .custom-radio-input:checked + .gender-select-label {
      background-color: var(--pastel-accent-secondary);
      border-color: var(--pastel-accent-primary);
      color: var(--pastel-text-dark);
    }