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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #333;
  background: #f5f5f5;
}

header {
  background: #1a237e;
  color: white;
  padding: 1.5rem 1rem;
  text-align: center;
}

header h1 {
  font-size: 1.4rem;
  font-weight: 700;
}

.subtitle {
  font-size: 0.85rem;
  opacity: 0.85;
  margin-top: 0.3rem;
}

main {
  max-width: 680px;
  margin: 0 auto;
  padding: 1rem;
}

.ad-unit {
  min-height: 90px;
  background: #e8e8e8;
  margin: 1.25rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aaa;
  font-size: 0.72rem;
  border-radius: 4px;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin: 1.25rem 0 0;
  flex-wrap: wrap;
}

.tab {
  flex: 1;
  min-width: 90px;
  padding: 0.6rem 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  border: 2px solid #1a237e;
  border-radius: 6px;
  background: white;
  color: #1a237e;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tab.active {
  background: #1a237e;
  color: white;
}

.tool-section {
  background: white;
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  margin-top: 0;
  border-top-left-radius: 0;
}

.tool-section h2 {
  font-size: 1rem;
  color: #1a237e;
  margin-bottom: 1rem;
}

label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  margin-top: 0.9rem;
  color: #444;
}

label:first-of-type {
  margin-top: 0;
}

input[type="number"],
select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  font-size: 1rem;
  border: 1.5px solid #ccc;
  border-radius: 7px;
  background: white;
  appearance: auto;
  -webkit-appearance: auto;
}

input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: #1a237e;
}

.row {
  display: flex;
  gap: 0.75rem;
}

.col {
  flex: 1;
}

button {
  display: block;
  width: 100%;
  margin-top: 1.1rem;
  padding: 0.8rem;
  font-size: 1rem;
  font-weight: 700;
  background: #1a237e;
  color: white;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.2s;
  min-height: 48px;
  touch-action: manipulation;
}

button:hover {
  background: #283593;
}

.result {
  margin-top: 1.1rem;
  padding: 1rem 1.25rem;
  background: #e8eaf6;
  border-radius: 8px;
  border-left: 4px solid #1a237e;
  display: none;
}

.result .main-result {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1a237e;
}

.result .sub-result {
  font-size: 0.9rem;
  color: #555;
  margin-top: 0.4rem;
}

.result.error {
  background: #fce4ec;
  border-left-color: #c62828;
}

.result.error .main-result {
  color: #c62828;
  font-size: 1rem;
}

.hidden {
  display: none;
}

.table-section {
  margin-top: 1.5rem;
  background: white;
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.table-section h2 {
  font-size: 1rem;
  color: #1a237e;
  margin-bottom: 1rem;
}

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th {
  background: #1a237e;
  color: white;
  padding: 0.5rem 0.75rem;
  text-align: left;
}

td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid #eee;
}

tr:nth-child(even) td {
  background: #f5f5f5;
}

tr.current-year td {
  font-weight: 700;
  background: #e8eaf6;
  color: #1a237e;
}

.howto-section {
  margin-top: 1.5rem;
  background: white;
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.howto-section h2 {
  font-size: 1rem;
  color: #1a237e;
  margin-top: 1.25rem;
  margin-bottom: 0.6rem;
}

.howto-section h2:first-child {
  margin-top: 0;
}

.howto-section ol,
.howto-section p {
  font-size: 0.9rem;
  color: #555;
}

.howto-section ol {
  padding-left: 1.4rem;
}

.howto-section li {
  margin-bottom: 0.4rem;
}

.howto-section dl {
  font-size: 0.9rem;
}

.howto-section dt {
  font-weight: 700;
  color: #333;
  margin-top: 0.75rem;
}

.howto-section dd {
  margin-left: 1rem;
  color: #555;
}

footer {
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.85rem;
  color: #888;
}

footer a {
  color: #555;
}

.era-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.era-btn {
  display: inline-block;
  width: auto;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  background: white;
  color: #1a237e;
  border: 1.5px solid #1a237e;
  border-radius: 99px;
  cursor: pointer;
  min-height: 36px;
  touch-action: manipulation;
  transition: background 0.15s, color 0.15s;
}

.era-btn.active {
  background: #1a237e;
  color: white;
}

.era-btn:hover:not(.active) {
  background: #e8eaf6;
}

.table-note {
  font-size: 0.8rem;
  color: #888;
  margin-top: 0.75rem;
}

.related-links {
  font-size: 0.9rem;
  color: #555;
  padding-left: 1.4rem;
  margin-top: 0.4rem;
}

.related-links li {
  margin-bottom: 0.4rem;
}

.related-links a {
  color: #1a237e;
  font-weight: 600;
}

@media (max-width: 400px) {
  .tab {
    font-size: 0.78rem;
    padding: 0.55rem 0.3rem;
  }
}

@media (min-width: 600px) {
  header h1 {
    font-size: 1.75rem;
  }

  main {
    padding: 1.5rem 2rem;
  }

  .tab {
    font-size: 1rem;
  }
}

/* ===== アフィリエイト ===== */
.affiliate-block {
  margin: 1rem 0 1.5rem;
  padding: 1rem;
  background: #f9f9f9;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  text-align: center;
}
.affiliate-label {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  background: #999;
  padding: 1px 6px;
  border-radius: 3px;
  margin-bottom: 0.5rem;
}
.affiliate-desc {
  font-size: 0.85rem;
  color: #555;
  margin-bottom: 0.75rem;
}
