/* 共通・ナビ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  /* 黄金比：横基準に対して縦 = 基準/φ で垂直方向を締める */
  --phi: 1.6180339887;
  /* Inter（ラテン）+ Noto Sans JP（日本語）— フォールバックは OS フォント */
  --font-sans:
    "Inter",
    "Noto Sans JP",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Hiragino Sans",
    "Hiragino Kaku Gothic ProN",
    Meiryo,
    sans-serif;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: #f0f2f5;
  color: #2c3e50;
}

/* ========== サイトヘッダー・フッター ========== */
.site-header {
  max-width: 1320px;
  /* 上下マージンも φ に寄せてややコンパクトに */
  margin: calc(1.25rem / var(--phi) + 0.35rem) auto calc(1rem / var(--phi) + 0.35rem);
  padding: 0 clamp(16px, 2vw, 24px);
}

.header-inner {
  background: #fff;
  /* 角丸の「長辺」感を φ でスケール */
  border-radius: calc(1.75rem * var(--phi));
  box-shadow: 0 6px 24px rgba(26, 54, 93, 0.08);
  align-items: center;
  /* 横基準 B、縦パディング B/φ（黄金長方形の短辺比） */
  padding: calc(2.25rem / var(--phi)) 2.25rem;
  min-height: 0;
  /* PC: 左ロゴ / 中央ナビ / 右スペーサーでナビを画面中央に */
  display: grid;
  grid-template-columns: 1fr auto 1fr;
}

.header-logo {
  grid-column: 1;
  justify-self: start;
  align-self: center;
}

.header-logo img {
  /* ロゴ高さ：横基準 B に対し B/φ〜B の間（可読さ用に係数 1.5） */
  height: calc(2.25rem / var(--phi) * 1.5);
  width: auto;
  display: block;
}

.header-nav {
  grid-column: 2;
  justify-self: center;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: calc(0.5rem / var(--phi) + 0.35rem) 0.875rem;
}

.header-nav a {
  text-decoration: none;
  color: #1a365d;
  font-weight: 600;
  font-size: calc(1rem / var(--phi) + 0.42rem);
  /* ピル内部も縦を 1/φ 寄りに */
  padding: calc(0.75rem / var(--phi)) 1.25rem;
  /* ヘッダー形状と揃えた柔らかいピル */
  border-radius: 9999px;
  border: none;
  background: transparent;
  transition:
    background 0.25s ease,
    color 0.25s ease,
    box-shadow 0.25s ease;
}

.header-nav a:hover {
  background: rgba(36, 90, 165, 0.1);
  color: #245aa5;
}

.header-nav a.is-active {
  background: linear-gradient(160deg, #2a60b8 0%, #245aa5 55%, #1a4678 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(36, 90, 165, 0.35);
}

.site-footer {
  background: #fff;
  padding: calc(2.5rem / var(--phi)) 16px;
  margin-top: calc(2.75rem * var(--phi) / 2);
  border-top: 1px solid #e1e5e9;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
}

.footer-logo img {
  height: 40px;
  width: auto;
  display: block;
}

.footer-info {
  flex: 1;
  color: #1a365d;
  font-size: 0.9em;
  line-height: 1.6;
}

.footer-info p {
  margin: 0;
}

.company-name {
  font-weight: 600;
  margin-bottom: 4px !important;
}

.company-tel .fax {
  margin-left: 12px;
}

.footer-copyright {
  color: #666;
  font-size: 0.85em;
}

@media (max-width: 768px) {
  .site-header {
    margin: 16px auto;
    padding: 0 14px;
  }

  .header-inner {
    display: flex;
    flex-direction: column;
    border-radius: 28px;
    padding: 18px 20px;
    gap: 18px;
    min-height: unset;
  }

  .header-logo {
    grid-column: unset;
    justify-self: unset;
  }

  .header-nav {
    grid-column: unset;
    justify-self: stretch;
    width: 100%;
  }

  .header-nav a {
    font-size: 0.95rem;
    padding: 12px 18px;
    flex: 1 1 auto;
    text-align: center;
    min-width: 0;
  }
  
  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

/* ========== ツールビュー ========== */
.tool-view:not(.view-active) {
  display: none !important;
}

/* ========== パスワードジェネレーター（genpass） ========== */
:root {
  --primary-color: #245aa5;
  --secondary-color: #4caf50;
  --border-color: #e1e5e9;
  --text-color: #2c3e50;
  --background-light: #f8f9fa;
  --error-color: #c62828;
  --warning-color: #ef6c00;
  --success-color: #2e7d32;
  --info-color: #1565c0;
}

.genpass-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* ヘッダー〜フッター相当分を φ ベースで差し引き、縦の取りすぎを抑制 */
  min-height: calc(100svh - (6rem * var(--phi) / 2 + 3.5rem));
  padding: calc(1rem / var(--phi)) 0;
}

.genpass-header {
  margin-bottom: 10px;
  text-align: center;
  color: var(--primary-color);
}

.genpass-main-title {
  font-size: 2em;
  font-weight: 700;
}

.genpass-subtitle {
  font-size: 1.1em;
  color: var(--secondary-color);
  font-weight: 300;
}

.genpass-box {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  padding: 20px;
  max-width: 600px;
  width: 100%;
  position: relative;
}

.password-display-section {
  margin-bottom: 10px;
  background: var(--background-light);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 10px;
}

.password-input-container {
  position: relative;
  margin-bottom: 16px;
}

#password {
  width: 100%;
  padding: 16px 20px;
  font-size: 1.3em;
  font-family: var(--font-sans);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  background: #fff;
  color: var(--text-color);
  letter-spacing: 0.05em;
  transition: border-color 0.3s ease;
}

#password:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(36, 90, 165, 0.1);
}

.refresh-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 2em;
  color: var(--primary-color);
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  transition: all 0.1s ease;
}

.strength-indicator {
  text-align: center;
  display: block;
  gap: 8px;
  margin-bottom: 24px;
}

.strength-text {
  font-weight: 600;
  color: var(--text-color);
}

.strength-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.9em;
  font-weight: 600;
  text-transform: uppercase;
}

.strength-weak { background: #ffebee; color: var(--error-color); }
.strength-medium { background: #fff3e0; color: var(--warning-color); }
.strength-strong { background: #e8f5e8; color: var(--success-color); }
.strength-strongest { background: #e3f2fd; color: var(--info-color); }

.copy-btn {
  width: 100%;
  height: 56px;
  padding: 16px 24px;
  background: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1.1em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 0;
  white-space: nowrap;
  overflow: hidden;
}

.copy-btn:hover,
.copy-btn:focus {
  box-shadow: 0 4px 12px rgba(36, 90, 165, 0.2);
  background: #1a417a;
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.copy-btn:active {
  box-shadow: 0 2px 6px rgba(36, 90, 165, 0.2);
}

.copy-icon {
  font-size: 1.2em;
}

.options-section {
  border-top: 1px solid var(--border-color);
  padding-top: 32px;
}

.option-group {
  margin-bottom: 24px;
}

.option-title {
  font-size: 1.1em;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 16px;
}

.length-slider-container {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}

.length-slider {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--border-color);
  outline: none;
  -webkit-appearance: none;
  transition: all 0.2s ease;
  cursor: pointer;
}

.length-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-color);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(36, 90, 165, 0.3);
}

.length-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-color);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(36, 90, 165, 0.3);
}

.length-value {
  min-width: 40px;
  text-align: center;
  font-weight: 600;
  color: var(--primary-color);
  font-size: 1.1em;
}

.length-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.length-btn {
  width: 32px;
  height: 32px;
  border: 2px solid var(--primary-color);
  background: #fff;
  color: var(--primary-color);
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2em;
  font-weight: bold;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.length-btn:hover,
.length-btn:focus {
  background: var(--primary-color);
  color: #fff;
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.character-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.character-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.character-option:hover {
  border-color: var(--primary-color);
  background: rgba(36, 90, 165, 0.05);
}

.character-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary-color);
}

.character-option input[type="checkbox"]:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.character-option label,
.character-option span {
  font-weight: 500;
  color: var(--text-color);
  cursor: pointer;
}

.advanced-options {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
  position: relative;
}

.advanced-option {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.advanced-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary-color);
}

.advanced-option input[type="checkbox"]:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.advanced-option label {
  font-size: 0.95em;
  color: #5a6c7d;
  cursor: pointer;
}

@media (max-width: 768px) {
  .genpass-box {
    padding: 24px;
    margin: 20px;
  }

  .genpass-main-title {
    font-size: 2em;
  }

  .character-options {
    grid-template-columns: 1fr;
  }

  .length-slider-container {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ========== ファビコン（favicon） ========== */
:root {
  --favicon-primary-color: #245aa5;
  --favicon-primary-hover: #1976d2;
  --favicon-border-radius: 6px;
  --favicon-transition: all 0.3s;
  --favicon-box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
  --favicon-box-shadow-hover: 0 4px 12px rgba(33, 150, 243, 0.4);
}

.favicon-app-box {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  max-width: 800px;
  margin: 24px auto 40px;
  padding: 40px;
}

.favicon-title {
  font-size: 1.6em;
  font-weight: bold;
  color: #245aa5;
  margin-bottom: 8px;
  text-align: center;
}

.favicon-subtitle {
  text-align: center;
  color: #245aa5;
  margin-bottom: 32px;
  font-size: 1.1em;
  line-height: 1.5;
}

.drop-zone {
  border: 2px dashed #ddd;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  background: #fafafa;
  transition: all 0.3s ease;
  cursor: pointer;
  margin-bottom: 0;
}

.drop-zone:hover {
  border-color: #245aa5;
  background: #f0f6fa;
}

.drop-zone.dragover {
  border-color: #245aa5;
  background: #e8f5e8;
  transform: scale(1.01);
}

.drop-zone-icon {
  font-size: 2em;
  color: #ccc;
  margin-bottom: 12px;
}

.drop-zone-text {
  font-size: 1em;
  color: #666;
  margin-bottom: 6px;
}

.drop-zone-hint {
  font-size: 0.85em;
  color: #999;
}

.file-input-wrapper {
  position: relative;
  display: inline-block;
  margin-top: 10px;
  margin-bottom: 10px;
}

.file-input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.file-input-btn {
  background: var(--favicon-primary-color);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--favicon-border-radius);
  cursor: pointer;
  font-weight: bold;
  transition: var(--favicon-transition);
  font-size: 0.9em;
}

.file-input-btn:hover {
  background: var(--favicon-primary-hover);
}

.sizes-section {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
}

.sizes-title {
  font-weight: bold;
  color: #333;
  margin-bottom: 16px;
  font-size: 1.1em;
}

.sizes-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  justify-content: center;
}

.size-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  font-size: 0.9em;
}

.size-option:hover {
  border-color: var(--favicon-primary-color);
  background: #e3f0fb;
}

.size-option input[type="checkbox"] {
  transform: scale(1.1);
  flex-shrink: 0;
}

.size-option span {
  font-weight: 500;
}

.size-option.selected {
  border-color: var(--favicon-primary-color);
  background: #e3f0fb;
  color: var(--favicon-primary-color);
}

.quick-select-buttons {
  display: block;
  gap: 8px;
  text-align: center;
}

.quick-select-btn {
  padding: 6px 12px;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
  transition: all 0.2s;
}

.quick-select-btn:hover {
  background: #f0f0f0;
}

.quick-select-btn.active {
  background: var(--favicon-primary-color);
  color: #fff;
  border-color: var(--favicon-primary-color);
}

.convert-section {
  text-align: center;
  margin-bottom: 32px;
}

.favicon-btn {
  padding: 16px 32px;
  font-size: 1.1em;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #2196f3, #1976d2);
  color: #fff;
  font-weight: bold;
  cursor: pointer;
  transition: var(--favicon-transition);
  box-shadow: var(--favicon-box-shadow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.favicon-btn__inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55em;
}

.favicon-btn__icon {
  width: 1.35em;
  height: 1.35em;
  flex-shrink: 0;
  display: block;
}

.favicon-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--favicon-box-shadow-hover);
}

.favicon-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.progress-container {
  display: none;
  margin: 16px 0;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2196f3, #1976d2);
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  text-align: center;
  margin-top: 8px;
  font-size: 0.9em;
  color: #666;
}

.favicon-preview-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin: 32px 0;
}

.favicon-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 0;
}

.favicon-preview img {
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: #f8f8f8;
  max-width: 200px;
  max-height: 200px;
  width: auto;
  height: auto;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.favicon-label {
  font-weight: bold;
  color: #333;
  font-size: 1em;
}

.download-section {
  text-align: center;
  margin: 0;
}

.preview-btn {
  background: var(--favicon-primary-color);
  color: #fff;
  padding: 8px 16px;
  border: none;
  border-radius: var(--favicon-border-radius);
  font-weight: bold;
  font-size: 0.9em;
  transition: var(--favicon-transition);
  cursor: pointer;
  margin-top: 8px;
  text-decoration: none;
  display: inline-block;
}

.preview-btn:hover {
  background: var(--favicon-primary-hover);
  transform: translateY(-1px);
  color: #fff;
  text-decoration: none;
}

.error-message {
  background: #ffebee;
  border: 1px solid #f44336;
  border-radius: 6px;
  padding: 12px 16px;
  margin: 16px 0;
  color: #c62828;
  display: none;
}

.success-message {
  background: #e3f0fb;
  border: 1px solid var(--favicon-primary-color);
  border-radius: var(--favicon-border-radius);
  padding: 12px 16px;
  margin: 16px 0;
  color: var(--favicon-primary-color);
  display: none;
}

.info-section {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 24px;
  margin-top: 32px;
}

.info-title {
  font-weight: bold;
  color: #333;
  margin-bottom: 16px;
  font-size: 1.1em;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 24px;
}

.info-item h4 {
  color: var(--favicon-primary-color);
  margin-bottom: 8px;
  font-size: 1em;
}

.info-item ul {
  margin: 0;
  padding-left: 20px;
  color: #666;
  font-size: 0.9em;
  line-height: 1.5;
}

@media (max-width: 768px) {
  .favicon-app-box {
    margin: 16px;
    padding: 24px;
  }

  .favicon-preview-wrap {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .sizes-grid {
    justify-content: flex-start;
  }

  .quick-select-buttons {
    justify-content: center;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.3s ease;
}

.button-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 12px;
  margin-bottom: 0;
}
