* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #e6f2ff 0%, #f0f9ff 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-text-size-adjust: 100%;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    text-align: center;
    color: #1e40af;
    margin-bottom: 30px;
    font-size: clamp(2em, 5vw, 2.5em);
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 탭 스타일 */
.tabs {
    display: flex;
    margin-bottom: 25px;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(30, 64, 175, 0.15);
    border: 1px solid rgba(30, 64, 175, 0.1);
}

.tab {
    flex: 1;
    padding: 18px 15px;
    text-align: center;
    cursor: pointer;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    color: #64748b;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
}

.tab::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background: #3b82f6;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.tab.active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.tab.active::after {
    width: 100%;
}

.tab:hover:not(.active) {
    background: linear-gradient(135deg, #e0f2fe 0%, #dbeafe 100%);
    color: #1e40af;
}

.tab-icon {
    font-size: 1.3em;
}

/* 컨텐츠 영역 */
.content {
    background: white;
    padding: 35px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(30, 64, 175, 0.1);
    border: 1px solid rgba(30, 64, 175, 0.05);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 랜덤 뽑기 섹션 */
.random-section {
    text-align: center;
    margin-bottom: 40px;
}

.random-button {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    padding: 18px 45px;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.35);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.random-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(37, 99, 235, 0.45);
}

.random-button:active {
    transform: translateY(-1px);
}

.result {
    padding: 30px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 16px;
    font-size: 20px;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #bfdbfe;
    font-weight: 500;
    box-shadow: inset 0 2px 8px rgba(30, 64, 175, 0.08);
}

/* 현재 리스트 정보 */
.current-list-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f0f9ff;
    border-radius: 8px;
    border-left: 4px solid #3182ce;
    margin-bottom: 20px;
}

.current-list-info p {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.btn-edit-list {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
    border-radius: 4px;
}

.btn-edit-list:hover {
    opacity: 1;
    background: rgba(59, 130, 246, 0.1);
}

/* 식당 추가 폼 */
.add-form {
    background: linear-gradient(135deg, #f8fafc 0%, #f0f9ff 100%);
    padding: 30px;
    border-radius: 16px;
    margin-top: 30px;
    border: 2px solid #e0f2fe;
    box-shadow: 0 2px 10px rgba(30, 64, 175, 0.08);
}

.add-form h3 {
    color: #1e40af;
    margin-bottom: 25px;
    font-size: 1.4em;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.form-group {
    margin-bottom: 22px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    color: #1e40af;
    font-weight: 600;
    font-size: 0.95em;
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e0f2fe;
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s ease;
    background-color: white;
}

.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
    transform: translateY(-1px);
}

.form-group textarea {
    resize: vertical;
    min-height: 90px;
    font-family: inherit;
}

/* 별점 입력 스타일 */
.rating-input {
    display: flex;
    gap: 8px;
    font-size: 32px;
    justify-content: flex-start;
    margin-bottom: 10px;
}

.star {
    cursor: pointer;
    color: #d1d5db;
    transition: all 0.2s ease;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.star.filled {
    color: #fbbf24;
    text-shadow: 0 1px 3px rgba(251, 191, 36, 0.3);
}

.star:hover {
    transform: scale(1.1);
}

.rating-info {
    color: #64748b;
    font-size: 14px;
    font-style: italic;
}

/* 버튼 스타일 */
.btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    white-space: nowrap;
    text-align: center;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
}

.btn-secondary:hover {
    box-shadow: 0 6px 20px rgba(100, 116, 139, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.btn-danger:hover {
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.btn-exclude {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.btn-exclude:hover {
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.btn-new-list {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    transition: all 0.3s ease;
}

.btn-new-list:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* 정렬 옵션 */
.list-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
    flex-wrap: wrap;
}

.sort-options {
    display: flex;
    gap: 15px;
    align-items: center;
}

.sort-options label {
    color: #1e40af;
    font-weight: 600;
}

.sort-options select {
    padding: 8px 12px;
    border: 2px solid #e0f2fe;
    border-radius: 6px;
    background-color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: #475569;
    font-size: 14px;
}

.sort-options select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* 식당 리스트 */
.restaurant-list {
    margin-top: 20px;
}

.restaurant-item {
    background: white;
    padding: 20px;
    padding-top: 25px; /* 상단 패딩 증가 */
    margin-bottom: 15px;
    border-radius: 10px;
    position: relative;
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.restaurant-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #d1d5db;
}

.restaurant-item.excluded {
    opacity: 0.6;
    background: #f9fafb;
    border-color: #d1d5db;
}

.restaurant-name {
    font-weight: 600;
    color: #1f2937;
    font-size: 18px;
    margin-bottom: 8px;
    margin-right: 120px; /* 우측 여백 추가 */
}

.restaurant-details {
    color: #6b7280;
    font-size: 14px;
    line-height: 1.6;
}

.restaurant-details strong {
    color: #374151;
    font-weight: 500;
}

.restaurant-rating {
    display: inline-block;
    margin-left: 5px;
}

.restaurant-actions {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex-direction: column; /* 세로 방향으로 정렬 */
    align-items: flex-end; /* 우측 정렬 */
    max-width: 110px; /* 최대 너비 제한 */
}

/* 리스트 섹션 분리 스타일 */
.list-section {
    margin-bottom: 30px;
}

.list-section-title {
    color: #1e40af;
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e0f2fe;
    display: flex;
    align-items: center;
    gap: 8px;
}

.list-section-empty {
    text-align: center;
    color: #6b7280;
    font-style: italic;
    padding: 20px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    margin-bottom: 10px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.empty-message {
    text-align: center;
    color: #718096;
    font-style: italic;
    padding: 40px;
}

/* 통계 */
.statistics {
    text-align: center;
}

.statistics h3 {
    color: #1e40af;
    margin-bottom: 15px;
    font-size: 1.8em;
}

.stats-info {
    color: #64748b;
    margin-bottom: 30px;
    font-size: 16px;
}

.stats-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    border: 2px solid #e0f2fe;
    text-align: left;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f1f5f9;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-name {
    font-weight: 600;
    color: #1e40af;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-color {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.stat-percentage {
    font-size: 18px;
    font-weight: 700;
    color: #1e40af;
}

.chart-container {
    margin: 20px auto;
    text-align: center;
}

#pieChart {
    max-width: 300px;
    max-height: 300px;
}

/* 공유 섹션 */
.share-section {
    text-align: center;
    margin-bottom: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 12px;
    border: 2px solid #bfdbfe;
}

.share-section h3 {
    color: #1e40af;
    margin-bottom: 15px;
    font-size: 1.3em;
    text-align: left;
}

.share-section p {
    text-align: left;
    margin-bottom: 15px;
}

.share-code {
    font-size: 28px;
    font-weight: 600;
    color: #1d4ed8;
    padding: 20px;
    background: white;
    border-radius: 10px;
    margin: 15px 0;
    text-align: center;
    letter-spacing: 4px;
    border: 2px solid #93c5fd;
    box-shadow: 0 2px 8px rgba(30, 64, 175, 0.15);
}

.input-group {
    display: flex;
    gap: 10px;
    margin: 15px 0;
    align-items: center;
    justify-content: center;
}

.input-group input {
    flex: 1;
    max-width: 300px;
    padding: 12px 16px;
    border: 2px solid #e0f2fe;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    font-weight: 500;
}

.input-group input[type="email"] {
    text-transform: lowercase;
}

.input-group input[maxlength="6"] {
    text-transform: uppercase;
    letter-spacing: 2px;
}

.input-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Auth 폼 스타일 */
.auth-form {
    text-align: center;
    padding: 20px;
    background: #f8fafc;
    border-radius: 10px;
    border-left: 4px solid #3182ce;
}

.auth-form h4 {
    margin: 0 0 10px 0;
    color: #2d3748;
    font-size: 1.1rem;
    text-align: left;
}

.auth-form p {
    text-align: left;
}

.auth-info {
    text-align: center;
    padding: 20px;
    background: #d1fae5;
    border-radius: 10px;
    border-left: 4px solid #10b981;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.auth-info p {
    margin: 0;
    color: #064e3b;
    font-size: 1rem;
}

/* 리스트 히스토리 스타일 */
.list-history-section {
    margin-bottom: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 12px;
    border: 2px solid #bfdbfe;
}

.list-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.list-history-header h3 {
    color: #1e40af;
    font-size: 1.3em;
    font-weight: 600;
    margin: 0;
}

.list-limit-info {
    margin-bottom: 15px;
}

.list-limit-info p {
    color: #64748b;
    font-size: 14px;
    margin: 0;
    text-align: left;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
}

.history-item:hover {
    background: white;
    box-shadow: 0 2px 8px rgba(30, 64, 175, 0.15);
    border-color: #93c5fd;
}

.history-item.active {
    background: #dbeafe;
    border-color: #3b82f6;
}

.history-info {
    flex: 1;
    text-align: left;
}

.history-name {
    font-weight: 600;
    color: #1e40af;
    margin-bottom: 4px;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.list-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.history-date {
    font-size: 0.875rem;
    color: #64748b;
    text-align: left;
}

.history-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* CSV 업로드 */
.upload-section {
    margin-bottom: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 12px;
    text-align: center;
    border: 2px solid #bfdbfe;
}

.upload-section h3 {
    color: #1e40af;
    margin-bottom: 15px;
    font-size: 1.3em;
    text-align: left;
}

.upload-section p {
    text-align: left;
    margin-bottom: 15px;
}

.file-input-wrapper {
    margin: 15px 0;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.file-input-wrapper input[type="file"] {
    margin-bottom: 0;
    padding: 8px;
    border: 2px solid #e0f2fe;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 13px;
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 35px;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.modal-header {
    margin-bottom: 25px;
}

.modal-header h3 {
    color: #1e40af;
    font-size: 1.5em;
}

.modal-body {
    margin-bottom: 20px;
}

.modal-body p {
    color: #374151;
    font-size: 16px;
    line-height: 1.5;
    margin: 0;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 30px;
}

/* 공유 모달 */
.share-options {
    text-align: center;
}

.share-code-display {
    font-size: 28px;
    font-weight: 600;
    color: #1d4ed8;
    padding: 20px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 12px;
    margin: 20px 0;
    letter-spacing: 4px;
    border: 2px solid #93c5fd;
}

.share-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin: 20px 0;
}

/* 메시지 */
.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 10px;
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    animation: slideIn 0.4s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.message.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.message.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

/* 애니메이션 */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.5s;
}

/* 반응형 - 모바일 최적화 (아이폰 13 기준: 390px) */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    h1 {
        font-size: 2em;
        margin-bottom: 20px;
    }

    .content {
        padding: 20px;
    }

    .tabs {
        flex-direction: row;
        margin-bottom: 20px;
    }

    .tab {
        padding: 15px 10px;
        font-size: 14px;
    }

    .tab-icon {
        display: none;
    }

    .random-button {
        width: 100%;
        padding: 16px 30px;
        font-size: 16px;
    }

    .result {
        font-size: 18px;
        padding: 25px 15px;
    }

    .list-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .sort-options {
        width: 100%;
        margin-bottom: 0;
        justify-content: center;
    }

    .sort-options select {
        flex: 1;
        max-width: 120px;
    }

    .restaurant-item {
        padding: 18px;
        padding-top: 25px;
    }

    .restaurant-name {
        font-size: 18px;
        margin-right: 120px;
    }

    .restaurant-actions {
        position: absolute; /* static에서 absolute로 변경 */
        top: 15px;
        right: 15px;
        flex-direction: column;
        align-items: flex-end;
        gap: 6px;
        width: auto;
        max-width: 110px;
        margin-top: 0; /* margin-top 제거 */
        margin-left: 0; /* margin-left 제거 */
    }

    .restaurant-actions .btn-small {
        width: 100%;
        min-width: 75px;
        text-align: center;
        padding: 8px 12px;
        font-size: 12px;
        font-weight: 500;
        border-radius: 6px;
    }

    /* 아이폰 13 전용 버튼 순서 최적화 */
    .restaurant-actions .btn-exclude {
        order: 1; /* 제외 버튼이 맨 위 */
        background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    }

    .restaurant-actions .btn:not(.btn-exclude):not(.btn-secondary):not(.btn-danger) {
        order: 2; /* 수정 버튼이 중간 */
        background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    }

    .restaurant-actions .btn-danger {
        order: 3; /* 삭제 버튼이 맨 아래 */
        background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    }

    .restaurant-actions .btn-secondary {
        order: 1; /* 포함 버튼이 맨 위 */
        background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    }

    /* 읽기 전용 텍스트도 정렬 */
    .restaurant-actions span {
        order: 4;
        text-align: center;
        width: 100%;
        margin-top: 4px;
    }

    .btn {
        justify-content: center;
        text-align: center;
    }

    .btn-small {
        padding: 8px 14px;
        font-size: 12px;
    }

    .add-form {
        padding: 20px;
    }

    .form-group input, .form-group textarea {
        font-size: 16px; /* iOS 줌 방지 */
    }

    .rating-input {
        font-size: 28px;
        gap: 8px;
        justify-content: center;
    }

    .chart-container {
        margin: 20px auto;
    }

    #pieChart {
        max-width: 250px;
        max-height: 250px;
    }

    .current-list-info {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .share-code {
        font-size: 24px;
        letter-spacing: 4px;
    }

    .input-group {
        flex-direction: column;
        gap: 15px;
    }

    .input-group input {
        width: 100%;
        max-width: none;
        margin-bottom: 0;
    }

    .input-group .btn {
        width: 100%;
        justify-content: center;
    }

    .file-input-wrapper {
        flex-direction: column;
        gap: 15px;
    }

    .file-input-wrapper input[type="file"] {
        width: 100%;
    }

    .file-input-wrapper .btn {
        width: 100%;
    }

    .list-history-section {
        padding: 20px;
    }

    .list-history-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .btn-new-list {
        width: 100%;
        justify-content: center;
    }

    .history-item {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
        text-align: left;
    }

    .history-info {
        width: 100%;
    }

    .history-name {
        justify-content: flex-start;
        margin-bottom: 6px;
    }

    .list-badge {
        padding: 4px 12px;
        font-size: 11px;
        border-radius: 14px;
        margin-left: 8px;
    }

    .history-actions {
        width: 100%;
        justify-content: flex-end;
        flex-shrink: 0;
        margin-top: 8px;
    }

    .message {
        right: 10px;
        left: 10px;
        text-align: center;
    }

    .auth-form {
        text-align: center;
    }

    .auth-form h4,
    .auth-form p {
        text-align: center;
    }

    .share-section h3,
    .upload-section h3,
    .list-history-section h3 {
        text-align: center;
    }

    .share-section p,
    .upload-section p {
        text-align: center;
    }

    .share-buttons {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .modal-content {
        width: 95%;
        padding: 25px;
    }
}

/* 아이폰 13 세부 최적화 (390px) */
@media (max-width: 480px) {
    h1 {
        font-size: 1.8em;
    }

    .container {
        padding: 8px;
    }

    .content {
        padding: 15px;
    }

    .tab {
        font-size: 13px;
        padding: 14px 8px;
    }

    .restaurant-name {
        font-size: 18px;
        margin-right: 120px;
    }

    .restaurant-details {
        font-size: 14px;
    }

    .restaurant-actions {
        position: absolute; /* static에서 absolute로 변경 */
        top: 15px;
        right: 15px;
        flex-direction: column;
        align-items: flex-end;
        gap: 6px;
        width: auto;
        max-width: 110px;
        margin-top: 0;
        margin-left: 0;
    }

    .restaurant-actions .btn-small {
        padding: 8px 16px;
        font-size: 12px;
        min-width: 60px;
        text-align: center;
        width: 100%;
    }

    .btn {
        padding: 12px 20px;
        font-size: 14px;
        width: 100%;
        justify-content: center;
    }

    .random-button {
        padding: 14px 20px;
        font-size: 15px;
    }

    .stat-item {
        font-size: 14px;
        padding: 12px 16px;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        text-align: left;
    }

    .stat-percentage {
        font-size: 18px;
    }

    /* 아이폰 13 전용 공유 뱃지 최적화 */
    .list-badge {
        padding: 5px 10px;
        font-size: 10px;
        border-radius: 12px;
        letter-spacing: 0.3px;
        margin-left: 6px;
    }
}