: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;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --soft-border: #dbe4ef;
    --shadow-soft: 0 16px 44px rgba(15, 23, 42, 0.08);
    --shadow-subtle: 0 8px 24px rgba(15, 23, 42, 0.06);
}

* {
    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,
#taxRankSection,
.info-section {
    scroll-margin-top: 1.5rem;
}

.container {
    width: 100%;
    min-height: 100vh;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    padding: clamp(1rem, 3vw, 3rem);
}

header {
    text-align: center;
    max-width: 960px;
    margin: 0 auto 1rem;
    padding: 2rem 1.5rem 1.5rem;
    border: 1px solid #dbe4ef;
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(248, 250, 252, 0.96) 0%, rgba(240, 253, 250, 0.74) 52%, rgba(238, 242, 255, 0.78) 100%);
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}
h1 {
    font-size: 2.05rem;
    font-weight: 900;
    letter-spacing: 0;
    margin-bottom: 0.75rem;
    color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
}

.title-icon {
    width: 2.15rem;
    height: 2.15rem;
    padding: 0.32rem;
    border-radius: 12px;
    background-color: #ffffff;
    color: #0d9488;
    box-shadow: 0 8px 24px rgba(13, 148, 136, 0.16);
    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);
    max-width: 720px;
    margin: 0 auto;
    font-size: 1rem;
    line-height: 1.7;
}
.notice-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 1rem;
    padding: 0.7rem 0.95rem;
    border: 1px solid #fed7aa;
    border-radius: 999px;
    background: #fff7ed;
    color: #9a3412;
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.5;
}

.site-links {
    max-width: 960px;
    margin: 0 auto 1.1rem;
    padding: 0.45rem;
    border: 1px solid var(--border);
    border-radius: 16px;
    background-color: rgba(255, 255, 255, 0.88);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.site-links a {
    color: #475569;
    font-size: 0.85rem;
    font-weight: 800;
    text-decoration: none;
    padding: 0.58rem 0.8rem;
    border: 1px solid transparent;
    border-radius: 12px;
    background-color: transparent;
    transition: background-color 0.18s, color 0.18s, border-color 0.18s;
    text-align: center;
    word-break: keep-all;
}

.site-links a:hover {
    color: #0f172a;
    border-color: #dbe4ef;
    background-color: #f8fafc;
}

.tab-menu {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    background: #eef2f7;
    padding: 0.45rem;
    border: 1px solid #dbe4ef;
    border-radius: 18px;
    margin-bottom: 2.25rem;
    gap: 0.35rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}
.tab-btn {
    min-width: 0;
    min-height: 3.15rem;
    padding: 0.75rem 0.8rem;
    border: none;
    background: transparent;
    font-size: 0.9rem;
    font-weight: 800;
    color: #475569;
    cursor: pointer;
    border-radius: 14px;
    transition: background-color 0.18s, color 0.18s, box-shadow 0.18s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}
.tab-btn.active {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
}

.tab-btn:hover {
    color: #0f172a;
    background-color: rgba(255, 255, 255, 0.72);
}

.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: 900;
    color: #0f172a;
    letter-spacing: 0;
}

.rank-page-section {
    margin-top: 1.5rem;
}

.rank-page-section h2 {
    margin-top: 1.75rem;
    margin-bottom: 1.75rem;
}

.house-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.house-item, .tax-form-card {
    background: var(--surface);
    border: 1px solid var(--soft-border);
    padding: 1.5rem;
    border-radius: 18px;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-subtle);
}
.house-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.house-title {
    font-size: 1rem;
    font-weight: 800;
    color: #0f172a;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
label {
    font-size: 0.85rem;
    font-weight: 800;
    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: 650;
    cursor: pointer;
    color: #475569;
}
.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 #bfdbfe;
    border-radius: 14px;
    background: linear-gradient(135deg, #eff6ff 0%, #f0fdfa 100%);
    color: #334155;
    font-size: 0.84rem;
    line-height: 1.6;
}

.helper-box strong {
    display: block;
    margin-bottom: 0.4rem;
    color: #0f766e;
    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 #cbd5e1;
    border-radius: 12px;
    font-size: 0.95rem;
    color: var(--text-main);
    background: #ffffff;
    transition: border-color 0.18s, box-shadow 0.18s, background-color 0.18s;
}
input[type="text"]:focus, input[type="number"]:focus, select:focus {
    outline: none;
    border-color: #14b8a6;
    box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.14);
}
input[readonly] {
    background-color: #f1f5f9;
    color: #475569;
    cursor: not-allowed;
}

.btn-search {
    background-color: #0f172a;
    color: white;
    border: none;
    padding: 0 1.25rem;
    border-radius: 12px;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}
.btn-search:hover {
    background-color: #334155;
}
.btn-add {
    background-color: #ffffff;
    color: var(--text-main);
    border: 1px solid var(--soft-border);
    padding: 0.875rem;
    width: 100%;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-subtle);
}
.btn-add:hover {
    border-color: #99f6e4;
    background-color: #f0fdfa;
}
.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: linear-gradient(135deg, #0d9488 0%, #4f46e5 100%);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 14px 32px rgba(79, 70, 229, 0.22);
}
.btn-calc:hover {
    filter: brightness(0.97);
}

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

.report-card {
    background-color: #ffffff;
    border: 1px solid var(--soft-border);
    border-radius: 20px;
    padding: 2.5rem 2rem;
    color: #0f172a;
    box-shadow: var(--shadow-soft);
}
.report-header {
    text-align: center;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}
.report-badge {
    display: inline-block;
    background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 999px;
    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: #f1f5f9;
    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: linear-gradient(135deg, #e0f2fe 0%, #e0e7ff 100%);
    font-size: 1.2rem;
    font-weight: 800;
    color: #3730a3;
}
.report-table tr.total-row td {
    border-top: 2px solid #14b8a6;
    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: 14px;
    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: 14px;
    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: 12px;
    font-size: 0.9rem;
    font-weight: 800;
    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: 2.25rem auto 0;
    padding-top: 2.25rem;
    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;
    font-weight: 900;
}

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

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

.info-card h3 {
    margin-bottom: 0.625rem;
    color: #0f172a;
    font-size: 1rem;
    font-weight: 900;
    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;
}

.policy-box a,
.info-card a {
    color: #0d9488;
    font-weight: 800;
    text-decoration: none;
}

.policy-box a:hover,
.info-card a:hover {
    text-decoration: underline;
}

.guide-jump-nav {
    max-width: 960px;
    margin: 1.25rem auto 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.5rem;
}

.guide-jump-nav a {
    min-height: 3rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--soft-border);
    border-radius: 14px;
    background-color: #ffffff;
    color: #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-size: 0.86rem;
    font-weight: 800;
    line-height: 1.25;
    text-decoration: none;
    text-align: center;
}

.guide-jump-nav a:hover {
    color: #0f172a;
    border-color: #99f6e4;
    background-color: #f0fdfa;
}

.guide-content {
    display: grid;
    grid-template-columns: minmax(160px, 220px) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: center;
}

.guide-visual {
    min-height: 180px;
    border: 1px solid #dbe4ef;
    border-radius: 16px;
    background-color: #f8fafc;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    color: #0f172a;
}

.guide-visual svg {
    width: 3.6rem;
    height: 3.6rem;
    stroke-width: 1.75;
}

.guide-visual span {
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
    background-color: rgba(255, 255, 255, 0.76);
    color: #1e293b;
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1.2;
}

.guide-visual-acquisition {
    background: linear-gradient(135deg, #f0fdfa 0%, #e0f2fe 100%);
}

.guide-visual-holding {
    background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 100%);
}

.guide-visual-gift {
    background: linear-gradient(135deg, #fff7ed 0%, #fef3c7 100%);
}

.guide-visual-inheritance {
    background: linear-gradient(135deg, #f1f5f9 0%, #e0f2fe 100%);
}

.guide-visual-dividend {
    background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%);
}

.blog-grid {
    max-width: 960px;
    margin: 1.5rem auto 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.blog-card {
    border: 1px solid var(--soft-border);
    border-radius: 16px;
    background-color: #ffffff;
    padding: 1.25rem;
    color: inherit;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: var(--shadow-subtle);
    transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}

.blog-card:hover {
    border-color: #99f6e4;
    background-color: #f8fafc;
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

.blog-card-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 12px;
    background-color: #f0fdfa;
    color: #0d9488;
    display: flex;
    align-items: center;
    justify-content: center;
}

.blog-card-icon svg {
    width: 1.45rem;
    height: 1.45rem;
    stroke-width: 2.1;
}

.blog-card h2 {
    color: #0f172a;
    font-size: 1rem;
    line-height: 1.45;
}

.blog-card p,
.blog-meta {
    color: #64748b;
    font-size: 0.86rem;
    line-height: 1.65;
}

.blog-article {
    scroll-margin-top: 1.5rem;
}

.blog-article h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.blog-article .blog-meta {
    margin-bottom: 0.875rem;
    font-weight: 700;
}

.guide-list,
.source-list {
    margin: 0.75rem 0 0;
    padding-left: 1.15rem;
    color: #475569;
    font-size: 0.9rem;
    line-height: 1.75;
}

.guide-list li + li,
.source-list li + li {
    margin-top: 0.4rem;
}

.site-footer {
    max-width: 960px;
    margin: 2.5rem auto 0;
    padding: 1.5rem 0 0;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    text-align: center;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem 1rem;
    margin-bottom: 0.875rem;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
}

.footer-links a:hover {
    color: #0d9488;
    text-decoration: underline;
}

.site-footer p {
    font-size: 0.85rem;
    line-height: 1.6;
}

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

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

.api-info.notice {
    color: #92400e;
}

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

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

@media (max-width: 900px) {
    .tab-menu {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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

    header {
        padding: 1.5rem 1rem 1.2rem;
        border-radius: 16px;
    }

    h1 {
        font-size: 1.6rem;
        line-height: 1.3;
        flex-wrap: wrap;
    }

    .subtitle {
        font-size: 0.9rem;
        line-height: 1.6;
    }

    .notice-text {
        display: flex;
        font-size: 0.8rem;
        border-radius: 12px;
    }

    .site-links {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: stretch;
        gap: 0.35rem;
        padding: 0.45rem;
    }

    .site-links a {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 2.75rem;
        padding: 0.58rem 0.45rem;
        line-height: 1.25;
    }

    .site-links a:last-child {
        grid-column: 1 / -1;
    }

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

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

    .tab-menu,
    .info-grid,
    .blog-grid,
    .download-group,
    .guide-jump-nav,
    .guide-content {
        display: grid;
        grid-template-columns: 1fr;
    }

    .guide-visual {
        min-height: 140px;
    }

    .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;
    }
}

@media (max-width: 380px) {
    .site-links {
        grid-template-columns: 1fr;
    }

    .site-links a:last-child {
        grid-column: auto;
    }
}
