:root {
  --bg-dark: #f0fdf4; /* サーフサイトに合う明るく爽やかなミント系背景 */
  --primary: #0ea5e9;
  --primary-hover: #0284c7;
  --secondary: #059669;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --card-bg: rgba(255, 255, 255, 0.9);
  --border-color: #cbd5e1;
  --shadow:
    0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Outfit", "Noto Sans JP", sans-serif;
}

body {
  background: linear-gradient(135deg, #e0f2fe 0%, #dcfce7 100%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.calculator-container {
  width: 100%;
  max-width: 500px;
  background: var(--card-bg);
  border-radius: 24px;
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  position: relative;
}

/* Back Link */
.back-link {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: color 0.2s;
  font-weight: 600;
}

.back-link:hover {
  color: var(--primary);
}

/* Header */
header {
  text-align: center;
  margin-bottom: 2rem;
}

.header-icon {
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

header h1 {
  font-size: 2.2rem;
  line-height: 1.1;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: #0f172a;
}

header h1 span {
  color: var(--primary);
}

header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* PR Notice */
.pr-notice {
  text-align: center;
  font-size: 0.75rem;
  color: #94a3b8;
  margin-bottom: 1.5rem;
  padding: 0.5rem;
  background: rgba(248, 250, 252, 0.5);
  border-radius: 8px;
}

/* Inputs */
.input-group {
  margin-bottom: 1.5rem;
}

.input-group label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.8rem;
  font-size: 0.95rem;
  color: #334155;
}

/* Board Type Grid */
.board-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.board-type-grid input[type="radio"] {
  display: none;
}

.type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem 0.5rem;
  background: #f8fafc;
  border: 2px solid var(--border-color);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.type-btn i {
  font-size: 1.5rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  transition: all 0.2s ease;
}

.type-btn span {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-muted);
}

.board-type-grid input[type="radio"]:checked + .type-btn {
  border-color: var(--primary);
  background: #f0f9ff;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.15);
}

.board-type-grid input[type="radio"]:checked + .type-btn i,
.board-type-grid input[type="radio"]:checked + .type-btn span {
  color: var(--primary);
}

/* Number Inputs */
.multi-input {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.8rem;
  transition: border-color 0.2s;
}

.input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.input-wrapper input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 1.1rem;
  font-family: "Outfit", sans-serif;
  font-weight: 600;
  color: var(--text-main);
  outline: none;
  text-align: center;
}

.input-wrapper .unit {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  margin-left: 0.5rem;
}

.input-separator {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 1.2rem;
}

/* Select for fractions */
.select-wrapper select {
  width: 100%;
  appearance: none;
  border: none;
  background: transparent;
  font-size: 1.1rem;
  font-family: "Outfit", sans-serif;
  font-weight: 600;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
  text-align: center;
}

.select-icon {
  position: absolute;
  right: 15px;
  color: var(--text-muted);
  pointer-events: none;
  font-size: 0.8rem;
}

/* Button */
.btn-calculate {
  width: 100%;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 16px;
  padding: 1.2rem;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 1rem;
  margin-bottom: 1.5rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}

.btn-calculate:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(14, 165, 233, 0.4);
}

.btn-calculate:active {
  transform: translateY(0);
}

/* Result Area */
.result-area {
  background: #f0fdf4;
  border: 2px dashed var(--secondary);
  border-radius: 16px;
  padding: 1.5rem;
  text-align: center;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform: scale(0.95);
  opacity: 0;
}

.result-area.hidden {
  display: none;
}

.result-area.show {
  display: block;
  transform: scale(1);
  opacity: 1;
}

.result-label {
  color: var(--secondary);
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.result-value {
  color: #064e3b;
}

.result-value #volume-result {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1;
}

.result-unit {
  font-size: 1.5rem;
  font-weight: 700;
  margin-left: 0.2rem;
}

.result-note {
  font-size: 0.75rem;
  color: #047857;
  margin-top: 1rem;
  opacity: 0.8;
}

/* Remove Arrows from Number Input */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

/* Affiliate Area */
.affiliate-area {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-align: left;
}

.affiliate-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  text-decoration: none;
  color: var(--text-main);
  transition: all 0.2s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.affiliate-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  border-color: var(--primary);
}

.affiliate-image {
  width: 60px;
  height: 60px;
  background: #f1f5f9;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-muted);
  font-size: 1.5rem;
  flex-shrink: 0;
}

.affiliate-text {
  flex: 1;
}

.affiliate-push {
  font-size: 0.75rem;
  color: var(--secondary);
  font-weight: 700;
  margin-bottom: 0.2rem;
  display: block;
}

.affiliate-title {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.3;
}

/* A8 Tag Wrapper Trick */
.a8-card {
  position: relative;
}

.a8-card a {
  color: var(--text-main);
  text-decoration: none;
}

.a8-card a:hover {
  text-decoration: underline;
}

.a8-card a::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
}

/* Text / Subtle Link */
.affiliate-subtle {
  display: block;
  text-align: center;
  padding: 0.8rem;
  background: transparent;
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: underline;
  text-decoration-color: #cbd5e1;
  text-underline-offset: 4px;
  transition: color 0.2s, text-decoration-color 0.2s;
}

.affiliate-subtle i {
  margin-right: 0.3rem;
  font-size: 0.8rem;
}

.affiliate-subtle:hover {
  color: var(--primary);
  text-decoration-color: var(--primary);
}

/* Advanced Settings Toggle & Styles */
.advanced-toggle-wrapper {
  text-align: center;
  margin-bottom: 1.5rem;
}

.btn-advanced-toggle {
  background: transparent;
  border: 1px dashed var(--border-color);
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 0.6rem 1.2rem;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-advanced-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(14, 165, 233, 0.05);
}

.btn-advanced-toggle i {
  margin-right: 0.3rem;
  transition: transform 0.3s ease;
}

.btn-advanced-toggle.open i {
  transform: rotate(45deg);
}

.advanced-settings {
  background: #f8fafc;
  border-radius: 16px;
  padding: 1.2rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
  overflow: hidden;
  transition: all 0.3s ease-in-out;
  transform-origin: top;
}

.advanced-settings.hidden {
  display: none;
}

.badge-optional {
  background: #e2e8f0;
  color: #64748b;
  font-size: 0.65rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.advanced-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 0.5rem;
}

/* Favorite Button */
.btn-favorite {
  margin-top: 1.5rem;
  background: transparent;
  color: var(--secondary);
  border: 2px solid var(--secondary);
  border-radius: 20px;
  padding: 0.6rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-favorite:hover {
  background: var(--secondary);
  color: #ffffff;
}

/* Epos Area (Disguised Banner) */
.epos-area {
  margin-top: 1rem;
  background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
  text-align: left;
  box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.epos-area.hidden {
  display: none;
}

.epos-sponsor-label {
  font-size: 0.75rem;
  font-weight: 800;
  color: #0ea5e9;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  letter-spacing: 0.5px;
}

.epos-banner-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.epos-banner-wrap {
  flex-shrink: 0;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  /* バナーのサイズが小さい場合、少し目立たせる */
}

.epos-text-side {
  display: flex;
  flex-direction: column;
}

.epos-main-text {
  font-size: 0.95rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 0.2rem;
}

.epos-sub-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.3;
}
