* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
                 Roboto, "Noto Sans KR", sans-serif;
    background: #f5f6f8;
    color: #222;
}

.app {
    width: 100%;
    max-width: 600px;
    min-height: 100vh;
    margin: 0 auto;
    background: white;
    display: flex;
    flex-direction: column;
}

/* 상단 헤더 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 20px 16px;
}

.header h1 {
    font-size: 24px;
    letter-spacing: -0.5px;
}

.header p {
    margin-top: 4px;
    font-size: 13px;
    color: #888;
}

.settings {
    border: none;
    background: none;
    font-size: 22px;
    cursor: pointer;
}

/* 메인 본문 */
main {
    flex: 1;
    padding: 10px 20px 100px;
}

.today-section h2 {
    font-size: 18px;
    margin-bottom: 12px;
}

/* 검색 바 */
.search-container {
    position: relative;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
}

.search-container.hidden {
    display: none;
}

.search-container input {
    width: 100%;
    padding: 12px 38px 12px 14px;
    border: 1px solid #222;
    border-radius: 12px;
    font-size: 14px;
    outline: none;
    background: #ffffff;
}

.clear-search-btn {
    position: absolute;
    right: 12px;
    border: none;
    background: none;
    font-size: 20px;
    color: #888;
    cursor: pointer;
}

/* 카테고리 필터 탭 */
.category-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 12px;
    margin-bottom: 8px;
    scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    white-space: nowrap;
    padding: 7px 12px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    background: #f8f9fb;
    font-size: 12px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: #222;
    color: #fff;
    border-color: #222;
    font-weight: 600;
}

/* 표현 카드 */
.expression-card {
    position: relative;
    padding: 16px 65px 16px 16px; /* 버튼 그룹 여백 확보 */
    margin-bottom: 12px;
    background: #f8f9fb;
    border-radius: 14px;
    border: 1px solid #eeeeee;
}

.card-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    background: #e2e8f0;
    color: #475569;
    margin-bottom: 8px;
}

.expression {
    font-size: 16px;
    font-weight: 600;
    color: #111;
}

.meaning {
    margin-top: 6px;
    font-size: 14px;
    color: #666;
}

.card-tags {
    margin-top: 8px;
    font-size: 12px;
    color: #2563eb;
    font-weight: 500;
}

/* 카드 우측 상단 액션 버튼 그룹 */
.card-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 2px;
}

.action-btn {
    border: none;
    background: transparent;
    font-size: 14px;
    color: #aaa;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    transition: all 0.2s;
}

.action-btn:hover {
    background: #edf2f7;
    color: #2d3748;
}

.action-btn.delete-btn:hover {
    color: #e53e3e;
    background: #fff5f5;
}

/* 표현 추가 버튼 */
.add-button {
    width: 100%;
    padding: 15px;
    border: 1px dashed #ccc;
    border-radius: 12px;
    background: white;
    font-size: 15px;
    color: #555;
    cursor: pointer;
    margin-top: 4px;
}

/* AI 회화 섹션 */
.conversation-section {
    margin-top: 28px;
    text-align: center;
}

.conversation-button {
    width: 100%;
    padding: 17px;
    border: none;
    border-radius: 14px;
    background: #222;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.conversation-section p {
    margin-top: 10px;
    font-size: 13px;
    color: #999;
}

/* 하단 네비게이션 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 600px;
    display: flex;
    padding: 10px 0;
    background: white;
    border-top: 1px solid #eeeeee;
}

.bottom-nav button {
    flex: 1;
    border: none;
    background: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 18px;
    cursor: pointer;
}

.bottom-nav span {
    font-size: 11px;
    color: #777;
}

.bottom-nav button.active span {
    color: #222;
    font-weight: bold;
}

/* 모달 팝업 */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-backdrop.hidden {
    display: none;
}

.modal-card {
    width: 100%;
    max-width: 440px;
    background: white;
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.close-btn {
    border: none;
    background: none;
    font-size: 24px;
    color: #888;
    cursor: pointer;
}

.input-group {
    margin-bottom: 14px;
}

.input-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}

.input-group label .required {
    color: #e53e3e;
}

.input-group input, .input-group select {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    background: #fff;
}

.input-group input:focus, .input-group select:focus {
    border-color: #222;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-buttons button {
    flex: 1;
    padding: 13px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.btn-cancel {
    border: 1px solid #ddd;
    background: #f8f9fb;
    color: #666;
}

.btn-submit {
    border: none;
    background: #222;
    color: white;
}