:root {
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #0d9488;
    --danger: #ef4444;
    --border: #e2e8f0;
    --accent-bg: #f8fafc;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    width: 100%;
}

#calculatorMenu,
.info-section {
    scroll-margin-top: 1.5rem;
}

.container {
    width: 100%;
    min-height: 100vh;
    background: var(--card-bg);
    padding: clamp(1rem, 3vw, 3rem);
}

header {
    text-align: center;
    margin-bottom: 1.5rem;
}
h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    margin-bottom: 1rem;
    color: #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
}

.title-icon {
    width: 2rem;
    height: 2rem;
    color: var(--primary);
    stroke-width: 2.25;
}

.btn-icon,
.inline-icon {
    width: 1.05em;
    height: 1.05em;
    flex: 0 0 auto;
    stroke-width: 2.25;
    vertical-align: -0.18em;
}

.inline-icon {
    margin-right: 0.4rem;
    color: currentColor;
}
.subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.65;
}
.notice-text {
    display: inline-block;
    margin-top: 0.875rem;
    padding: 0.75rem 1rem;
    border: 1px solid #fde68a;
    border-radius: 10px;
    background: #fffbeb;
    color: #92400e;
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.5;
}

.site-links {
    max-width: 960px;
    margin: 0 auto 1rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.site-links a {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background-color: #ffffff;
}

.site-links a:hover {
    color: var(--primary);
    border-color: #c7d2fe;
    background-color: #eef2ff;
}

.tab-menu {
    display: flex;
    flex-wrap: wrap;
    background: #f1f5f9;
    padding: 0.375rem;
    border-radius: 14px;
    margin-bottom: 2rem;
    gap: 4px;
}
.tab-btn {
    flex: 1;
    min-width: 9rem;
    padding: 0.75rem;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}
.tab-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}

.calculator-section {
    display: none;
}
.calculator-section.active {
    display: block;
    max-width: 960px;
    margin: 0 auto;
}

.calculator-section h2 {
    margin-bottom: 1.75rem;
    text-align: center;
    font-size: 1.35rem;
    font-weight: 800;
    color: #1e293b;
}

.house-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.house-item, .tax-form-card {
    background: var(--accent-bg);
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: 16px;
    margin-bottom: 1rem;
}
.house-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.house-title {
    font-size: 1rem;
    font-weight: 700;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
}
.address-search-group {
    display: flex;
    gap: 0.5rem;
}

.lookup-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.ownership-group {
    display: flex;
    gap: 1rem;
    margin-top: 0.25rem;
}
.ownership-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
}
.share-input-box {
    display: none;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.share-input {
    width: 80px !important;
    padding: 0.5rem !important;
    text-align: center;
}

.helper-box {
    padding: 1rem;
    border: 1px solid #c7d2fe;
    border-radius: 10px;
    background: #eef2ff;
    color: #334155;
    font-size: 0.84rem;
    line-height: 1.6;
}

.helper-box strong {
    display: block;
    margin-bottom: 0.4rem;
    color: #3730a3;
    font-size: 0.88rem;
}

.helper-box p + p {
    margin-top: 0.35rem;
}

input[type="text"], input[type="number"], select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.95rem;
    color: var(--text-main);
    background: white;
}
input[readonly] {
    background-color: #e2e8f0;
    color: #475569;
    cursor: not-allowed;
}

.btn-search {
    background-color: #1e293b;
    color: white;
    border: none;
    padding: 0 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.btn-add {
    background-color: #fff;
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 0.875rem;
    width: 100%;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 1.5rem;
}
.btn-remove {
    background: transparent;
    color: var(--danger);
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
}

.btn-calc {
    width: 100%;
    padding: 1rem;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}
.btn-calc:hover {
    background-color: var(--primary-hover);
}

.result-box {
    max-width: 960px;
    margin-top: 2rem;
    margin-right: auto;
    margin-left: auto;
    display: none;
}

.report-card {
    background-color: #ffffff;
    border: 2px solid #0f172a;
    border-radius: 16px;
    padding: 2.5rem 2rem;
    color: #0f172a;
}
.report-header {
    text-align: center;
    border-bottom: 2px dashed #cbd5e1;
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}
.report-badge {
    display: inline-block;
    background-color: #1e293b;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 50px;
    margin-bottom: 0.75rem;
}
.report-address {
    font-size: 1.35rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0.25rem;
}
.report-date {
    font-size: 0.8rem;
    color: #64748b;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}
.report-table th {
    background-color: #f8fafc;
    color: #334155;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: left;
    padding: 10px 14px;
    border-bottom: 2px solid #e2e8f0;
}
.report-table td {
    padding: 14px;
    font-size: 0.95rem;
    border-bottom: 1px solid #f1f5f9;
}
.report-table tr.highlight-row {
    background-color: #f8fafc;
    font-weight: 600;
}
.report-table tr.total-row {
    background-color: #e0e7ff;
    font-size: 1.2rem;
    font-weight: 800;
    color: #3730a3;
}
.report-table tr.total-row td {
    border-top: 2px solid #4f46e5;
    border-bottom: 2px solid #4f46e5;
}
.report-table tr.section-row td {
    padding-top: 1.5rem;
    padding-bottom: 1rem;
    border-top: 8px solid #ffffff;
    border-bottom: 2px solid #99f6e4;
    background-color: #ccfbf1;
    color: #0f766e;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0;
}
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.625rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1.2;
    white-space: normal;
}
.status-badge.neutral {
    background-color: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}
.status-badge.danger {
    background-color: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}
.emphasis-amount {
    color: #b91c1c;
    font-weight: 900;
}
.text-right {
    text-align: right;
}

.report-notice {
    margin-bottom: 2rem;
    padding: 0.875rem 1rem;
    border: 1px solid #fde68a;
    border-radius: 10px;
    background: #fffbeb;
    color: #92400e;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.6;
}

.report-formula-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 1rem;
}
.report-formula-box {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.25rem;
    font-size: 0.85rem;
    line-height: 1.7;
    color: #475569;
}
.download-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 1.5rem;
}
.btn-download {
    padding: 0.875rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid #cbd5e1;
    background-color: #1e293b;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
}
.btn-download.pdf-btn {
    background-color: #4f46e5;
    border-color: #4f46e5;
}
.btn-download.share-btn {
    background-color: #0f766e;
    border-color: #0f766e;
}

.info-section {
    max-width: 960px;
    margin: 2rem auto 0;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.info-section h2 {
    margin-bottom: 1rem;
    color: #1e293b;
    font-size: 1.2rem;
    line-height: 1.4;
    text-align: left;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.info-card,
.policy-box {
    border: 1px solid var(--border);
    border-radius: 12px;
    background-color: #ffffff;
    padding: 1.25rem;
}

.info-card h3 {
    margin-bottom: 0.625rem;
    color: #0f172a;
    font-size: 1rem;
    line-height: 1.4;
}

.info-card p,
.policy-box p {
    color: #475569;
    font-size: 0.9rem;
    line-height: 1.75;
}

.policy-box p + p {
    margin-top: 0.75rem;
}

.api-info {
    font-size: 0.75rem;
    color: var(--secondary);
    font-weight: 500;
    margin-top: 2px;
}

.api-info.error {
    color: #dc2626;
}

@media (min-width: 1024px) {
    header,
    .tab-menu {
        max-width: 960px;
        margin-right: auto;
        margin-left: auto;
    }

    .house-list {
        gap: 1.25rem;
    }
}

@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 1.6rem;
    }

    .subtitle {
        font-size: 0.88rem;
        line-height: 1.45;
    }

    .notice-text {
        display: block;
        font-size: 0.8rem;
    }

    .address-search-group,
    .ownership-group {
        flex-direction: column;
    }

    .lookup-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .tab-menu,
    .info-grid,
    .download-group {
        display: grid;
        grid-template-columns: 1fr;
    }

    .house-item,
    .tax-form-card,
    .report-card {
        padding: 1rem;
        border-radius: 12px;
    }

    .report-card {
        border-width: 1px;
    }

    .report-table th,
    .report-table td {
        padding: 10px 8px;
        font-size: 0.82rem;
    }

    .report-table tr.total-row {
        font-size: 0.95rem;
    }

    .btn-search {
        padding: 0.875rem 1rem;
    }
}
