
/* 전체 기본 설정 */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 30px 20px;
    font-family: "맑은 고딕", sans-serif;
    background-color: #f5f5f2;
    color: #333333;
}

.container {
    max-width: 650px;
    margin: 0 auto;
}

/* =========================
   제목 영역
========================= */

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 40px;
    font-weight: 900;
    color: #c58a19;
    letter-spacing: -2px;
    margin: 8px 0;
}

header p {
    font-size: 14px;
    color: #96846b;
    margin: 8px 0 20px;
}

/* =========================
   동전 캐릭터 쏠이
========================= */

.mascot {
    position: relative;
    width: 180px;
    height: 165px;
    margin: 0 auto;
    animation: floating 3s ease-in-out infinite;
}

.coin {
    position: absolute;
    top: 10px;
    left: 25px;
    width: 130px;
    height: 130px;
    border: 5px solid #dc941c;
    border-radius: 50%;
    background: linear-gradient(145deg, #ffe99a, #ffc53d);
    box-shadow: 5px 6px 0 #dfa026;
    z-index: 2;
}

.coin-inner {
    position: absolute;
    inset: 8px;
    border: 3px dashed #e2a428;
    border-radius: 50%;
    background-color: #ffe078;
}

.coin-symbol {
    position: absolute;
    top: 4px;
    width: 100%;
    text-align: center;
    color: #bd8018;
    font-size: 30px;
    font-weight: 900;
}

/* 캐릭터 눈 */
.eye {
    position: absolute;
    top: 43px;
    width: 12px;
    height: 17px;
    border-radius: 50%;
    background-color: #49351b;
}

.left-eye {
    left: 25px;
}

.right-eye {
    right: 25px;
}

.eye::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: white;
}

/* 캐릭터 볼 */
.cheek {
    position: absolute;
    top: 64px;
    width: 18px;
    height: 10px;
    border-radius: 50%;
    background-color: #f5a18b;
}

.left-cheek {
    left: 12px;
}

.right-cheek {
    right: 12px;
}

/* 캐릭터 입 */
.mouth {
    position: absolute;
    top: 62px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 14px;
    background-color: #49351b;
    border-radius: 4px 4px 18px 18px;
}

/* 캐릭터 팔 */
.arm {
    position: absolute;
    top: 75px;
    width: 37px;
    height: 15px;
    border: 3px solid #dc941c;
    border-radius: 20px;
    background-color: #ffd15c;
}

.left-arm {
    left: 2px;
    transform: rotate(30deg);
}

.right-arm {
    right: 2px;
    transform: rotate(-35deg);
}

/* 캐릭터 발 */
.foot {
    position: absolute;
    top: 130px;
    width: 35px;
    height: 22px;
    background-color: #ffc94b;
    border: 3px solid #dc941c;
    border-radius: 20px;
}

.left-foot {
    left: 48px;
    transform: rotate(-10deg);
}

.right-foot {
    right: 43px;
    transform: rotate(10deg);
}

/* 캐릭터 반짝임 */
.sparkle {
    position: absolute;
    font-size: 25px;
    color: #e9b83f;
}

.sparkle-left {
    top: 15px;
    left: 0;
}

.sparkle-right {
    top: 35px;
    right: 0;
}

/* 캐릭터 애니메이션 */
@keyframes floating {
    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-7px);
    }
}

/* 캐릭터 말풍선 */
.speech-bubble {
    position: relative;
    display: inline-block;
    padding: 12px 22px;
    background-color: #ffffff;
    border: 1px solid #eee2c5;
    border-radius: 18px;
    color: #8b6a35;
    font-size: 14px;
    line-height: 1.8;
}

/* =========================
   입력 및 목록 카드
========================= */

.input-section,
.list-section {
    background-color: #ffffff;
    padding: 28px;
    margin-bottom: 24px;

    /* 둥근 모서리 */
    border-radius: 20px;

    /* 옅은 그림자 */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);

    border: 1px solid #eeeeee;
}

/* 카드 제목 */
h2 {
    margin: 0 0 24px;
    font-size: 20px;
    font-weight: bold;
    color: #333333;
}

/* =========================
   입력 영역
========================= */

.input-section {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.input-section h2 {
    grid-column: 1 / -1;
    margin-bottom: 4px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

/* 금액 입력칸은 가로 전체 사용 */
.input-group:nth-last-child(2) {
    grid-column: 1 / -1;
}

label {
    font-size: 14px;
    font-weight: bold;
    color: #666666;
}

/* 입력창 및 선택창 */
input,
select {
    width: 100%;
    min-width: 0;
    height: 48px;
    padding: 12px 14px;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    background-color: #fafafa;
    font-family: inherit;
    font-size: 15px;
    color: #333333;
    transition: all 0.2s ease;
}

input::placeholder {
    color: #aaaaaa;
}

/* 입력창 선택 효과 */
input:focus,
select:focus {
    outline: none;
    background-color: #ffffff;
    border-color: #e6b545;
    box-shadow: 0 0 0 3px #fff2d1;
}

/* =========================
   추가 버튼
========================= */

#add-btn {
    grid-column: 1 / -1;
    width: 100%;
    padding: 15px;
    margin-top: 4px;
    border: none;
    border-radius: 12px;
    background-color: #ffcf57;
    color: #614511;
    font-family: inherit;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

#add-btn:hover {
    background-color: #f6ba35;
}

#add-btn:active {
    transform: scale(0.98);
}

#add-btn:focus-visible {
    outline: 3px solid #ac7718;
    outline-offset: 3px;
}

/* =========================
   내역 목록
========================= */

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    white-space: nowrap;
}

/* 표 제목 */
th {
    padding: 14px 10px;
    background-color: #f5f5f5;
    color: #777777;
    font-size: 13px;
    text-align: center;
}

th:first-child {
    border-radius: 10px 0 0 10px;
}

th:last-child {
    border-radius: 0 10px 10px 0;
}

/* 표 내용 */
td {
    padding: 16px 10px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
}

/* 금액 오른쪽 정렬 */
td:last-child {
    text-align: right;
}

/* 목록 마우스 효과 */
tbody tr:hover {
    background-color: #fffdf6;
}

/* 수입 - 파란색 */
.income {
    color: #2563eb;
    font-weight: bold;
}

/* 지출 - 빨간색 */
.expense {
    color: #dc2626;
    font-weight: bold;
}

/* 내역이 없을 때 */
#empty-message td {
    padding: 45px 10px;
    text-align: center;
    color: #999999;
    font-size: 14px;
    font-weight: normal;
    border-bottom: none;
}

.empty-icon {
    font-size: 38px;
    margin-bottom: 12px;
}

/* =========================
   모바일 반응형
========================= */

@media (max-width: 600px) {
    body {
        padding: 20px 12px;
    }

    header h1 {
        font-size: 34px;
    }

    .input-section,
    .list-section {
        padding: 20px;
        border-radius: 18px;
    }

    .input-section {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    h2 {
        font-size: 18px;
    }

    input,
    select {
        font-size: 16px;
    }

    table {
        font-size: 12px;
    }

    th,
    td {
        padding: 12px 8px;
    }
}

/* 움직임 감소 설정 지원 */
@media (prefers-reduced-motion: reduce) {
    .mascot {
        animation: none;
    }

    input,
    select,
    #add-btn {
        transition: none;
    }
}
