:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #475569;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-light: #eff6ff;
  --accent: #0f766e;
  --accent-light: #f0fdfa;
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --max-w: 1120px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Noto Sans JP", "Malgun Gothic", "Noto Sans KR", "PingFang SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 16px;
}

/* Header & Navigation */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
}

.brand-wrap {
  display: flex;
  flex-direction: column;
}

.brand-logo {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.brand-logo:hover {
  text-decoration: none;
}
.brand-badge {
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #bfdbfe;
}
.brand-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-links {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.nav-link {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover, .nav-link.active {
  background: var(--surface-alt);
  color: var(--primary);
  text-decoration: none;
}

.lang-switcher {
  display: flex;
  gap: 4px;
  background: var(--surface-alt);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.lang-btn {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--text-muted);
}
.lang-btn:hover {
  text-decoration: none;
  color: var(--text);
}
.lang-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

/* Hero & Country Filter */
.hero-box {
  background: linear-gradient(135deg, #1e3a8a 0%, #0f766e 100%);
  color: #ffffff;
  border-radius: var(--radius);
  padding: 28px 24px;
  margin: 20px 0;
  box-shadow: var(--shadow);
}
.hero-box h1 {
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 10px;
}
.hero-box p {
  font-size: 0.96rem;
  color: #e2e8f0;
  max-width: 860px;
}

.filter-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.filter-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-tab {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
}
.filter-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.filter-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}
.tz-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Tool Cards Grid */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow);
  transition: transform 0.15s, border-color 0.15s;
}
.tool-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  text-decoration: none;
}
.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.card-icon {
  font-size: 1.5rem;
}
.card-badges {
  display: flex;
  gap: 6px;
}
.badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
}
.badge-jp {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}
.badge-kr {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}
.badge-common {
  background: #f0fdfa;
  color: #0f766e;
  border: 1px solid #99f6e4;
}
.badge-type {
  background: var(--surface-alt);
  color: var(--text-muted);
}
.tool-card h2 {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.35;
}
.tool-card p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* Official Trust & Source Bar (YMYL Component) */
.trust-bar {
  background: var(--accent-light);
  border: 1px solid #99f6e4;
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 16px 0;
  font-size: 0.85rem;
}
.trust-bar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  color: #115e59;
}
.trust-bar-row strong {
  color: #134e4a;
}
.trust-privacy {
  margin-top: 6px;
  font-size: 0.8rem;
  color: #0f766e;
}

/* Calculator Box */
.calc-workspace {
  background: var(--surface);
  border: 2px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 24px;
  margin: 20px 0;
  box-shadow: var(--shadow);
}
.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 24px;
}
@media (max-width: 820px) {
  .calc-grid {
    grid-template-columns: 1fr;
  }
}

.form-group {
  margin-bottom: 14px;
}
.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 5px;
  color: var(--text);
}
.form-control {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.96rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}
.form-control:focus {
  outline: 2px solid var(--primary);
  border-color: var(--primary);
}
.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.preset-btn {
  font-size: 0.76rem;
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface-alt);
  color: var(--text);
  cursor: pointer;
}
.preset-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.calc-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
}
.btn-primary:hover {
  background: var(--primary-hover);
}
.btn-secondary {
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border-strong);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

/* Result & Step-by-Step Panel */
.result-panel {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
}
.result-hero {
  background: var(--surface);
  border-left: 4px solid var(--primary);
  padding: 14px 16px;
  border-radius: 8px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.result-hero-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}
.result-hero-value {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--primary);
  margin-top: 2px;
}
.result-hero-sub {
  font-size: 0.83rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.step-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
  font-size: 0.88rem;
  border: 1px solid var(--border);
}
.step-table th, .step-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.step-table th {
  background: #f1f5f9;
  font-weight: 700;
  color: var(--text);
}
.step-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.step-table tr.highlight-row {
  background: var(--primary-light);
  font-weight: 700;
}

/* Content Sections (Always Expanded by Default for SEO & AdSense) */
.content-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin: 20px 0;
  box-shadow: var(--shadow);
}
.content-section h2 {
  font-size: 1.22rem;
  font-weight: 800;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--surface-alt);
  color: var(--text);
}
.takeaways-list, .steps-list {
  padding-left: 20px;
}
.takeaways-list li, .steps-list li {
  margin-bottom: 8px;
}

.table-scroll {
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.data-table th, .data-table td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
}
.data-table th {
  background: var(--surface-alt);
  font-weight: 700;
}

.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.faq-item:last-child {
  border-bottom: none;
}
.faq-q {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 6px;
}
.faq-a {
  font-size: 0.92rem;
  color: var(--text-muted);
}

/* Disclaimer Box */
.disclaimer-box {
  background: var(--warn-bg);
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 20px 0;
  font-size: 0.85rem;
  color: #78350f;
}
.disclaimer-box strong {
  display: block;
  margin-bottom: 4px;
  color: #92400e;
}

/* AdSense Manual Slot (Strictly Separated from Inputs & Buttons, Max 3/page) */
.ad-slot-container {
  margin: 28px 0;
  padding: 12px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  text-align: center;
  min-height: 100px;
}
.ad-slot-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

/* Interactive Visual Tax Calendar (Monthly Grid + 12-Month Cards) */
.cal-widget-box {
  background: var(--surface);
  border: 2px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.cal-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.cal-month-tabs {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}
@media (max-width: 760px) {
  .cal-month-tabs {
    grid-template-columns: repeat(6, 1fr);
  }
}
.cal-month-btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 700;
  padding: 8px 4px;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  position: relative;
}
.cal-month-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.cal-month-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}
.cal-month-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ef4444;
  margin-left: 3px;
  vertical-align: middle;
}
.cal-month-btn.active .cal-month-dot {
  background: #fde047;
}

.cal-day-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}
@media (max-width: 640px) {
  .cal-day-grid {
    display: none;
  }
}
.cal-dow {
  text-align: center;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 6px 0;
  background: var(--surface-alt);
  border-radius: 6px;
}
.cal-cell {
  min-height: 74px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  background: var(--surface);
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cal-cell.empty {
  background: #f8fafc;
  border-style: dashed;
}
.cal-cell.has-event {
  border-color: #93c5fd;
  background: #f8fbff;
}
.cal-day-num {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.76rem;
}
.cal-pill {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  line-height: 1.25;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-pill-filing {
  background: #dbeafe;
  color: #1e40af;
}
.cal-pill-deadline {
  background: #fee2e2;
  color: #991b1b;
}
.cal-pill-refund {
  background: #ccfbf1;
  color: #115e59;
}
.cal-pill-rate, .cal-pill-warn {
  background: #fef3c7;
  color: #92400e;
}

.cal-events-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.cal-event-card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  padding: 14px 16px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}
.cal-event-card.tag-deadline { border-left-color: #dc2626; }
.cal-event-card.tag-refund { border-left-color: #0f766e; }
.cal-event-card.tag-warn, .cal-event-card.tag-rate { border-left-color: #d97706; }

.cal-year-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
}
.cal-month-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.cal-month-card h3 {
  font-size: 1.08rem;
  font-weight: 800;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Footer */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 32px 0;
  margin-top: 48px;
  font-size: 0.86rem;
  color: var(--text-muted);
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 14px;
}
