@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@300;400;500;600;700&display=swap');

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

html,
body {
  height: 100%;
  width: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #ffffff;
  color: #1a1a1a;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ========================================
   ヘッダー
======================================== */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 2.5rem 0;
  text-align: center;
  z-index: 100;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
}

.logo {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 4rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #1a1a1a;
  margin: 0;
  cursor: default;
  user-select: none;
  text-transform: lowercase;
  position: relative;
  display: inline-block;
}

.logo::after {
  content: '';
  position: absolute;
  bottom: -0.2rem;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #1a1a1a 0%, #666666 100%);
  border-radius: 2px;
}

.header-links {
  position: absolute;
  right: 2rem;
  display: flex;
  gap: 0.75rem;
}

.header-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: #f5f5f5;
  border: 2px solid #e5e5e5;
  color: #666666;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.3s ease;
  text-decoration: none;
}

.header-link:hover {
  background: #1a1a1a;
  border-color: #1a1a1a;
  color: white;
  transform: translateY(-2px);
}

.header-link svg {
  flex-shrink: 0;
}

/* ========================================
   メインコンテンツ
======================================== */

.main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1.5rem;
  min-height: 100vh;
}

.search-container {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
}

/* ========================================
   検索フォーム
======================================== */

.search-form {
  width: 100%;
  margin-bottom: 1.5rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.search-input {
  flex: 1;
  padding: 1.25rem 1.75rem;
  font-size: 1.125rem;
  font-family: inherit;
  color: #1a1a1a;
  background: #ffffff;
  border: 2px solid #e5e5e5;
  border-radius: 50px;
  outline: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.search-input::placeholder {
  color: #999999;
  font-weight: 400;
}

.search-input:hover {
  border-color: #d0d0d0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.search-input:focus {
  border-color: #1a1a1a;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.search-engine-select {
  padding: 1.25rem 1.5rem;
  font-size: 1rem;
  font-family: inherit;
  color: #1a1a1a;
  background: #ffffff;
  border: 2px solid #e5e5e5;
  border-radius: 50px;
  outline: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  min-width: 150px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231a1a1a' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1.25rem center;
  padding-right: 3rem;
}

.search-engine-select:hover {
  border-color: #d0d0d0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.search-engine-select:focus {
  border-color: #1a1a1a;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* ========================================
   クイックリンク
======================================== */

.quick-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  margin: 2rem 0 1.5rem 0;
  flex-wrap: wrap;
}

.quick-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 1rem;
  border-radius: 16px;
  min-width: 80px;
}

.quick-link:hover {
  transform: translateY(-4px);
  background: #f8f8f8;
}

.quick-link svg {
  width: 40px;
  height: 40px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.quick-link:hover svg {
  transform: scale(1.15);
}

.quick-link span {
  font-size: 0.8rem;
  font-weight: 500;
  color: #666666;
  transition: color 0.3s ease;
}

.quick-link:hover span {
  color: #1a1a1a;
}

/* ========================================
   エラー表示
======================================== */

.error-section {
  text-align: center;
  padding: 0 1rem;
}

.error-message {
  color: #ef4444 !important;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  white-space: pre-wrap;
}

.error-code {
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
  font-size: 0.75rem;
  color: #666666;
  background: #f8f8f8;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border-left: 3px solid #ef4444;
  overflow-x: auto;
  text-align: left;
  display: inline-block;
  max-width: 100%;
}

/* ========================================
   iframe（プロキシビュー）
======================================== */

#uv-frame {
  border: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #ffffff;
  z-index: 9999;
}

/* ========================================
   アニメーション
======================================== */

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

.search-container {
  animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.header {
  animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   レスポンシブデザイン
======================================== */

@media (max-width: 768px) {
  .header {
    padding: 2rem 1rem;
  }

  .logo {
    font-size: 3rem;
  }

  .logo::after {
    height: 2px;
  }

  .header-links {
    right: 1rem;
    gap: 0.5rem;
  }

  .header-link {
    padding: 0.625rem 0.875rem;
    font-size: 0.8125rem;
  }

  .header-link span {
    display: none;
  }

  .header-link {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
  }

  .search-form {
    flex-direction: column;
  }

  .search-input {
    padding: 1.125rem 1.5rem;
    font-size: 1rem;
  }

  .search-engine-select {
    width: 100%;
    padding: 1.125rem 1.5rem;
    padding-right: 3rem;
  }

  .main {
    padding: 0 1.25rem;
  }

  .quick-links {
    gap: 1.5rem;
    margin: 1.5rem 0 1rem 0;
  }

  .quick-link {
    padding: 0.75rem;
    min-width: 70px;
  }

  .quick-link svg {
    width: 36px;
    height: 36px;
  }

  .quick-link span {
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 1.5rem 0.75rem;
  }

  .logo {
    font-size: 2.5rem;
  }

  .logo::after {
    height: 2px;
    bottom: -0.15rem;
  }

  .header-links {
    right: 0.75rem;
    gap: 0.5rem;
  }

  .header-link {
    width: 36px;
    height: 36px;
  }

  .header-link svg {
    width: 18px;
    height: 18px;
  }

  .search-input {
    padding: 1rem 1.25rem;
    font-size: 0.95rem;
  }

  .main {
    padding: 0 1rem;
  }

  .quick-links {
    gap: 1rem;
    margin: 1rem 0 0.75rem 0;
  }

  .quick-link {
    padding: 0.5rem;
    min-width: 60px;
  }

  .quick-link svg {
    width: 32px;
    height: 32px;
  }

  .quick-link span {
    font-size: 0.7rem;
  }

  .error-code {
    font-size: 0.7rem;
    padding: 0.625rem 0.875rem;
  }
}

/* ========================================
   ダークモードサポート（オプション）
======================================== */

@media (prefers-color-scheme: dark) {
  body {
    background: #0a0a0a;
    color: #f5f5f5;
  }

  .header {
    background: rgba(10, 10, 10, 0.9);
  }

  .logo {
    color: #f5f5f5;
  }

  .logo::after {
    background: linear-gradient(90deg, #f5f5f5 0%, #999999 100%);
  }

  .search-input {
    background: #1a1a1a;
    border-color: #2a2a2a;
    color: #f5f5f5;
  }

  .search-input::placeholder {
    color: #666666;
  }

  .search-input:hover {
    border-color: #3a3a3a;
  }

  .search-input:focus {
    border-color: #f5f5f5;
  }

  .search-engine-select {
    background: #1a1a1a;
    border-color: #2a2a2a;
    color: #f5f5f5;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23f5f5f5' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  }

  .search-engine-select:hover {
    border-color: #3a3a3a;
  }

  .search-engine-select:focus {
    border-color: #f5f5f5;
  }

  .quick-link:hover {
    background: #1a1a1a;
  }

  .quick-link span {
    color: #999999;
  }

  .quick-link:hover span {
    color: #f5f5f5;
  }

  .header-link {
    background: #1a1a1a;
    border-color: #2a2a2a;
    color: #999999;
  }

  .header-link:hover {
    background: #f5f5f5;
    border-color: #f5f5f5;
    color: #0a0a0a;
  }

  .error-code {
    background: #1a1a1a;
    color: #999999;
  }

  #uv-frame {
    background: #0a0a0a;
  }
}

/* ========================================
   スクロールバースタイリング
======================================== */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #d0d0d0;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #b0b0b0;
}

@media (prefers-color-scheme: dark) {
  ::-webkit-scrollbar-thumb {
    background: #3a3a3a;
  }

  ::-webkit-scrollbar-thumb:hover {
    background: #4a4a4a;
  }
}

/* ========================================
   選択スタイル
======================================== */

::selection {
  background: #1a1a1a;
  color: #ffffff;
}

@media (prefers-color-scheme: dark) {
  ::selection {
    background: #f5f5f5;
    color: #0a0a0a;
  }
}