/* ========================================
   なんでもCopilot 2周年 — スタイルシート
   ======================================== */

/* --- CSS Variables --- */
:root {
  /* Copilot ブランドカラー */
  --color-blue:    #0078D4;
  --color-teal:    #00B7C3;
  --color-green:   #107C10;
  --color-yellow:  #FFB900;
  --color-orange:  #D83B01;
  --color-pink:    #E3008C;
  --color-purple:  #5C2D91;

  /* グラデーション */
  --gradient-rainbow: linear-gradient(135deg,
    #0078D4, #00B7C3, #107C10,
    #FFB900, #D83B01, #E3008C,
    #5C2D91);
  --gradient-bg: linear-gradient(135deg,
    #667eea 0%, #764ba2 25%, #f093fb 50%, #4facfe 75%, #00f2fe 100%);

  /* グラスモーフィズム */
  --glass-bg:      rgba(255, 255, 255, 0.18);
  --glass-border:  rgba(255, 255, 255, 0.35);
  --glass-blur:    14px;
  --glass-shadow:  0 8px 32px rgba(0, 0, 0, 0.12);

  /* テキスト */
  --text-primary:   #1a1a2e;
  --text-secondary: #444;
  --text-on-dark:   #fff;

  /* その他 */
  --radius-card: 16px;
  --radius-btn:  12px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--gradient-bg);
  background-size: 400% 400%;
  animation: gradientShift 20s ease infinite;
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* --- Particles Container --- */
.particles-container {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  pointer-events: none;
  user-select: none;
  will-change: transform, opacity;
}

/* --- Header --- */
.header {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
  background: var(--gradient-rainbow);
  background-size: 300% 300%;
  animation: gradientShift 12s ease infinite;
  color: var(--text-on-dark);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.header-title {
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 800;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  letter-spacing: 0.02em;
}

.header-subtitle {
  font-size: clamp(0.95rem, 2.5vw, 1.2rem);
  margin-top: 0.4rem;
  opacity: 0.9;
  font-weight: 400;
}

/* --- Header Navigation --- */
.header-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.8rem;
  margin-top: 0.8rem;
  flex-wrap: wrap;
}

.nav-link {
  color: var(--text-on-dark);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.35rem 0.9rem;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-btn);
  transition: background 0.2s, transform 0.2s;
  white-space: nowrap;
  cursor: pointer;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.nav-share-btn {
  background: rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.3);
}

/* --- Main --- */
.main {
  position: relative;
  z-index: 5;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

/* --- Post Section --- */
.post-section {
  max-width: 600px;
  margin: 0 auto 2rem;
}

.post-form {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  padding: 1.2rem;
  box-shadow: var(--glass-shadow);
}

.message-input {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-btn);
  background: rgba(255, 255, 255, 0.5);
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
  transition: border-color 0.3s;
  color: var(--text-primary);
}

.message-input:focus {
  outline: none;
  border-color: var(--color-blue);
  background: rgba(255, 255, 255, 0.7);
}

.message-input::placeholder {
  color: #888;
}

.form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.8rem;
  gap: 0.8rem;
}

.char-count {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.char-count.over-limit {
  color: #e53e3e;
  font-weight: 600;
}

.submit-btn {
  padding: 0.65rem 1.8rem;
  border: none;
  border-radius: var(--radius-btn);
  background: linear-gradient(135deg, var(--color-orange), var(--color-pink));
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 4px 12px rgba(216, 59, 1, 0.3);
  white-space: nowrap;
}

.submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(216, 59, 1, 0.4);
}

.submit-btn:active:not(:disabled) {
  transform: translateY(0);
}

.submit-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.submit-btn.cooldown {
  background: linear-gradient(135deg, #999, #aaa);
}

/* --- Error Message --- */
.error-message {
  margin-top: 0.6rem;
  padding: 0;
  font-size: 0.9rem;
  color: #e53e3e;
  background: rgba(229, 62, 62, 0.1);
  border-radius: 8px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.3s, opacity 0.3s, padding 0.3s;
}

.error-message.visible {
  max-height: 60px;
  opacity: 1;
  padding: 0.5rem 0.8rem;
}

/* --- Badge Display --- */
.badge-display {
  text-align: center;
  margin-top: 0.8rem;
  min-height: 1.5rem;
}

.my-badge {
  display: inline-block;
  padding: 0.3rem 1rem;
  background: linear-gradient(135deg, rgba(255, 185, 0, 0.25), rgba(227, 0, 140, 0.2));
  border: 1px solid rgba(255, 185, 0, 0.4);
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  backdrop-filter: blur(4px);
}

.my-badge-progress {
  font-size: 0.85rem;
  color: var(--text-secondary);
  opacity: 0.8;
}

/* --- Corkboard --- */
.corkboard {
  position: relative;
  width: 100%;
  min-height: 400px;
  margin-top: 1rem;
}

.fallback-msg {
  text-align: center;
  padding: 2rem;
  color: var(--text-on-dark);
  font-size: 1.1rem;
  opacity: 0.8;
}

/* --- Card (Glassmorphism) --- */
.card {
  position: absolute;
  width: clamp(200px, 22vw, 260px);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  box-shadow: var(--glass-shadow);
  overflow: hidden;
  will-change: transform, opacity;
  transition: box-shadow 0.3s;
  animation: cardFloat 6s ease-in-out infinite;
}

@keyframes cardFloat {
  0%, 100% { margin-top: 0; }
  50%      { margin-top: -6px; }
}

.card:hover {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.card:active {
  cursor: grabbing;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
}

.card-accent {
  height: 5px;
  width: 100%;
}

.card-message {
  padding: 1rem 1rem 0.4rem;
  font-size: 0.95rem;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
  color: var(--text-primary);
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 1rem 0.7rem;
  gap: 0.5rem;
}

.card-badge {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  background: rgba(255, 185, 0, 0.2);
  border-radius: 8px;
}

.card-time {
  font-size: 0.75rem;
  color: var(--text-secondary);
  opacity: 0.7;
  margin-left: auto;
}

/* --- Footer --- */
.footer {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 0.8rem 1rem;
  background: rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.2rem;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
}

.connpass-link {
  color: var(--text-on-dark);
  text-decoration: none;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-btn);
  transition: background 0.2s, transform 0.2s;
}

.connpass-link:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.share-btn {
  padding: 0.5rem 1.2rem;
  border: none;
  border-radius: var(--radius-btn);
  background: #000;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.share-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.copyright {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.8rem;
}

/* --- Share Modal (PC用 Xシェアプレビュー) --- */
.share-modal-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s;
  padding: 1rem;
}

.share-modal-overlay.active {
  opacity: 1;
}

.share-modal {
  position: relative;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 2rem;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.3s;
}

.share-modal-overlay.active .share-modal {
  transform: scale(1);
}

.share-modal-close {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  border: none;
  background: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.share-modal-close:hover {
  background: rgba(0, 0, 0, 0.08);
}

.share-modal-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 1.2rem;
  color: var(--text-primary);
}

.share-modal-preview {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  margin-bottom: 1rem;
}

.share-modal-preview img {
  width: 100%;
  display: block;
}

.share-modal-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 1.2rem;
}

.share-modal-post-btn {
  display: inline-block;
  padding: 0.75rem 2rem;
  background: #000;
  color: #fff;
  border: none;
  border-radius: var(--radius-btn);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.share-modal-post-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.share-modal-hint {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: #888;
  line-height: 1.5;
}

.share-modal-dl-btn {
  display: inline-block;
  margin-top: 0.6rem;
  padding: 0.4rem 1.2rem;
  background: transparent;
  color: var(--color-blue);
  border: 1.5px solid var(--color-blue);
  border-radius: var(--radius-btn);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.share-modal-dl-btn:hover {
  background: rgba(0, 120, 212, 0.08);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .card {
    width: clamp(160px, 42vw, 240px);
  }

  .header {
    padding: 1.5rem 1rem 1rem;
  }

  .header-title {
    font-size: clamp(1.5rem, 5vw, 2.2rem);
  }

  .main {
    padding: 0.8rem 0.5rem 1.5rem;
  }

  .post-section {
    margin: 0 auto 1rem;
  }

  .message-input {
    min-height: 60px;
  }
}

@media (max-width: 480px) {
  .card {
    width: clamp(150px, 80vw, 300px);
  }

  .header {
    padding: 1rem 0.8rem 0.8rem;
  }

  .header-title {
    font-size: clamp(1.3rem, 5vw, 1.8rem);
  }

  .header-subtitle {
    font-size: 0.85rem;
    margin-top: 0.2rem;
  }

  .header-nav {
    gap: 0.5rem;
    margin-top: 0.5rem;
  }

  .nav-link {
    font-size: 0.8rem;
    padding: 0.25rem 0.6rem;
  }

  .post-form {
    padding: 0.8rem;
  }

  .message-input {
    min-height: 50px;
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
  }

  .form-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    margin-top: 0.5rem;
  }

  .char-count {
    text-align: right;
    font-size: 0.8rem;
  }

  .submit-btn {
    width: 100%;
    text-align: center;
    padding: 0.5rem 1rem;
  }

  .badge-display {
    margin-top: 0.5rem;
  }

  .corkboard {
    margin-top: 0.5rem;
  }
}

/* --- prefers-reduced-motion --- */
@media (prefers-reduced-motion: reduce) {
  body {
    animation: none;
  }

  .header {
    animation: none;
  }

  .particle {
    display: none;
  }

  .card {
    transition: none;
    animation: none;
  }
}
