/* ==========================================================================
   kubotter - Complete Modern Dark Theme Core CSS
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700;900&family=Outfit:wght@400;600;800&display=swap');

:root {
  --bg-primary: #0b0e14;
  --bg-surface: #141923;
  --bg-card: #1c2333;
  --bg-card-hover: #252e42;
  --border-color: #2e384e;
  --border-highlight: #3b4763;
  
  --text-main: #f0f4fc;
  --text-muted: #8b9bb4;
  --text-dim: #5a6b85;

  --accent-blue: #1d9bf0;
  --accent-blue-hover: #1a8cd8;
  --accent-purple: #7952b3;
  --accent-pink: #e84393;
  --accent-gradient: linear-gradient(135deg, #1d9bf0 0%, #7952b3 50%, #e84393 100%);
  --accent-glow: rgba(29, 155, 240, 0.25);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);

  --font-base: 'Outfit', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reset & Base Setup */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-base);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  opacity: 0.85;
}

/* Header Navbar */
.site-header {
  background: rgba(20, 25, 35, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.75rem 1.5rem;
}

.header-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-logo {
  font-size: 1.5rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-logo span {
  font-size: 0.8rem;
  background: rgba(29, 155, 240, 0.15);
  color: var(--accent-blue);
  -webkit-text-fill-color: var(--accent-blue);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(29, 155, 240, 0.3);
}

.nav-links {
  display: flex;
  gap: 1rem;
}

.nav-link {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
}

.nav-link:hover, .nav-link.active {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

/* Main Container */
.main-wrapper {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
  flex: 1;
  width: 100%;
}

/* Hero Section */
.hero {
  text-align: center;
  margin-bottom: 3rem;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

.badge-free {
  display: inline-block;
  background: linear-gradient(90deg, #00b894, #00cec9);
  color: #000;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  margin-bottom: 1rem;
  text-transform: uppercase;
}

/* Search & Input Form Component */
.search-box-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.input-group {
  display: flex;
  gap: 0.75rem;
}

@media (max-width: 600px) {
  .input-group {
    flex-direction: column;
  }
}

.input-field-wrapper {
  position: relative;
  flex: 1;
}

.input-prefix {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 1.1rem;
}

.input-field {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.85rem 1rem 0.85rem 2.5rem;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.input-field:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-primary {
  background: var(--accent-blue);
  color: #fff;
  border: none;
  padding: 0.85rem 1.75rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary:hover {
  background: var(--accent-blue-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--border-highlight);
}

.btn-intent {
  background: linear-gradient(135deg, #1d9bf0, #0084b4);
  color: #fff;
  border: none;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  transition: var(--transition);
  text-decoration: none;
}

.btn-intent:hover {
  transform: scale(1.03);
  box-shadow: 0 8px 24px rgba(29, 155, 240, 0.4);
}

/* Tool Grid (Hub Page) */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent-gradient);
  opacity: 0;
  transition: var(--transition);
}

.tool-card:hover {
  transform: translateY(-4px);
  background: var(--bg-card-hover);
  border-color: var(--border-highlight);
  box-shadow: var(--shadow-lg);
}

.tool-card:hover::before {
  opacity: 1;
}

/* tool-card は <a> タグ内に配置されるため、文字色を通常色にリセット */
a.tool-card {
  color: var(--text-main);
}

a.tool-card:hover {
  opacity: 1; /* 親の a:hover opacity を打ち消す */
}

.tool-icon {
  font-size: 2.2rem;
  margin-bottom: 1rem;
}

.tool-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.tool-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  flex: 1;
}

/* Tab Component */
.tab-container {
  display: flex;
  gap: 0.5rem;
  background: var(--bg-surface);
  padding: 0.35rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.6rem 1rem;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.tab-btn.active {
  background: var(--accent-blue);
  color: #fff;
}

/* Canvas Display Box */
.canvas-preview-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  margin-top: 2rem;
}

.canvas-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
  max-width: 100%;
  overflow: auto;
  box-shadow: var(--shadow-lg);
}

canvas {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

/* State Components */
.hidden {
  display: none !important;
}

.loading-state {
  text-align: center;
  padding: 3rem 1rem;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(29, 155, 240, 0.2);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.9s infinite linear;
  margin: 0 auto 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.error-box {
  background: rgba(235, 77, 75, 0.1);
  border: 1px solid rgba(235, 77, 75, 0.3);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  color: #ff6b6b;
  margin-top: 1.5rem;
}

.error-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

/* エラー本文の色とフォント */
.error-text {
  color: #ff8080;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Result Cards Box (Roast / Kazoku / Random) */
.result-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-top: 2rem;
  box-shadow: var(--shadow-lg);
}

.result-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.result-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-blue);
}

.result-user-info h3 {
  font-size: 1.2rem;
  font-weight: 700;
}

.result-user-info span {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.result-body {
  font-size: 1.1rem;
  white-space: pre-wrap;
  background: var(--bg-primary);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
  font-family: inherit;
}

.actions-bar {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface);
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: auto;
}

.footer-disclaimer {
  max-width: 700px;
  margin: 0 auto 1rem;
  line-height: 1.5;
}
