:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.4;
}

* {
  box-sizing: border-box;
}

html,
body {
  overflow-x: hidden;
  touch-action: pan-y;
}

body {
  margin: 0;
  color: #1f2937;
  background: linear-gradient(180deg, #87ceeb 0%, var(--scroll-marine, #87ceeb) 100%);
  transition: background 0.2s linear;
  --ambient-wave-opacity: 0.1;
  --ambient-wave-scale: 1;
  --ambient-cosmos-progress: 0;
}

body[data-ambient-tone="night"] {
  --ambient-wave-opacity: 0.16;
  --ambient-wave-scale: 1.015;
}

body[data-ambient-tone="lively"] {
  --ambient-wave-opacity: 0.18;
  --ambient-wave-scale: 1.02;
}

body[data-ambient-tone="calm"] {
  --ambient-wave-opacity: 0.08;
  --ambient-wave-scale: 1;
}


.ambient-scene {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ambient-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ambient-layer--bubbles {
  opacity: calc(1 - var(--ambient-cosmos-progress));
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.ambient-layer--stars {
  opacity: var(--ambient-cosmos-progress);
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.ambient-bubble {
  position: absolute;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.55) 0 22%, rgba(255, 255, 255, 0.2) 45%, rgba(255, 255, 255, 0.05) 100%);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.28), inset 0 0 6px rgba(255, 255, 255, 0.12);
  will-change: transform;
}

.ambient-star {
  position: absolute;
  color: #f8fafc;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.75), 0 0 14px rgba(125, 211, 252, 0.26);
  line-height: 1;
  opacity: 0.66;
  animation: star-twinkle var(--twinkle-duration, 6s) ease-in-out infinite;
  animation-delay: var(--twinkle-delay, 0s);
}

.page {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 12px 12px 104px;
}

.ambient-header {
  position: relative;
  z-index: 1;
  height: 14px;
  margin-bottom: 4px;
  pointer-events: none;
}

.ambient-wave {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(14, 116, 144, 0) 0,
      rgba(14, 116, 144, 0.14) 6%,
      rgba(14, 116, 144, 0) 12%
    );
  opacity: var(--ambient-wave-opacity);
  transform: scaleX(var(--ambient-wave-scale));
  animation: wave-slide 34s linear infinite;
  transition: opacity 0.25s ease, transform 0.25s ease;
}


.surface {
  background: #fff;
  border: 1px solid #dbe6db;
  border-radius: 12px;
  padding: 10px;
}

.talk-area {
  min-height: 60vh;
  background: transparent;
  border: none;
  padding: 44px 0 0;
}

.notice,
.error {
  font-size: 0.88rem;
  min-height: 1.2em;
}

.view-tabs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(956px, calc(100% - 24px));
  z-index: 30;
  background: transparent;
  padding: 6px 0;
  border-bottom: 1px solid #e2e8f0;
}

.view-tabs {
  display: inline-flex;
  gap: 6px;
}

.view-tab {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #475569;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.84rem;
}

.view-tab.is-active {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
}

.top-button {
  border: none;
  background: transparent;
  color: #f97316;
  font-size: 0.84rem;
  padding: 4px 2px;
}

.top-button:hover {
  text-decoration: underline;
}

.notice {
  color: #334155;
}

.error {
  color: #b91c1c;
}

.results {
  display: grid;
  gap: 8px;
  margin-top: 2px;
}

.card {
  border: 1px solid #e4ece4;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  transition:
    transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
    border-color 0.2s ease,
    box-shadow 0.5s ease;
}

.card:hover,
.card:focus-within {
  border-color: #bae6fd;
  transform: translateY(-2px);
}

body[data-ambient-tone="lively"] .card:hover,
body[data-ambient-tone="lively"] .card:focus-within {
  box-shadow: 0 8px 24px rgba(255, 215, 0, 0.15);
}

body[data-ambient-tone="night"] .card:hover,
body[data-ambient-tone="night"] .card:focus-within {
  box-shadow: 0 8px 24px rgba(138, 43, 226, 0.15);
}

body[data-ambient-tone="calm"] .card:hover,
body[data-ambient-tone="calm"] .card:focus-within {
  box-shadow: 0 8px 24px rgba(0, 206, 209, 0.15);
}

.card.is-new-highlight {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.22), 0 2px 12px rgba(245, 158, 11, 0.2);
}

.card-summary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 8px;
  cursor: pointer;
}

.card-main {
  min-width: 0;
}

.card-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 4px;
}

.card-title-row {
  margin-bottom: 4px;
  font-size: 14px;
}

.card-title-row a {
  color: #1d4ed8;
  text-decoration: none;
  font-weight: 600;
}

.card-title-row a:hover {
  text-decoration: underline;
}

.card-meta-row {
  color: #475569;
  font-size: 12px;
  white-space: nowrap;
}

.thumbnail {
  width: 88px;
  height: 50px;
  border-radius: 8px;
  object-fit: cover;
  background: #f1f5f9;
}

.card-date-corner {
  color: #64748b;
  font-size: 0.68rem;
  line-height: 1;
}

.card-detail {
  border-top: 1px solid #edf2ed;
  padding: 8px;
  display: none;
}

.card.is-open .card-detail {
  display: block;
}

.section-list {
  display: grid;
  gap: 6px;
}

.section-item {
  border: 1px solid #edf2ed;
  border-radius: 8px;
  padding: 6px;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-toggle {
  border: none;
  background: transparent;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  color: #475569;
}

.section-toggle-placeholder {
  width: 24px;
  height: 24px;
  display: inline-block;
  flex: 0 0 24px;
}

.section-link {
  color: #1d4ed8;
  text-decoration: none;
  font-size: 0.9rem;
}

.section-link:hover {
  text-decoration: underline;
}

.sub-list {
  margin: 6px 0 0 30px;
  padding: 0;
  list-style: none;
  display: none;
  color: #475569;
  font-size: 0.86rem;
}

.sub-list.is-open {
  display: block;
}

.talk-video-title {
  margin-bottom: 2px;
  color: #334155;
  font-size: 0.8rem;
}

.talk-video-title a {
  color: #1d4ed8;
  text-decoration: none;
}

.talk-video-title a:hover {
  text-decoration: underline;
}

.tags {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.recommend {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #dbeafe;
}

.recommend-title {
  margin: 0 0 6px;
  font-size: 0.8rem;
  color: #0f172a;
}

.recommend-empty {
  margin: 0;
  font-size: 0.76rem;
  color: #64748b;
}

.recommend-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.recommend-item {
  animation: recommend-rise 0.26s ease both;
}

.recommend-button {
  width: 100%;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  padding: 6px 8px;
  background: #f8fdff;
  color: #0f172a;
  text-align: left;
}

.recommend-main {
  display: block;
  font-size: 0.84rem;
  margin-bottom: 2px;
}

.recommend-sub {
  display: block;
  font-size: 0.74rem;
  color: #64748b;
}

.recommend-reason {
  display: block;
  font-size: 0.72rem;
  color: #0e7490;
}

@keyframes wave-slide {
  from {
    background-position-x: 0;
  }
  to {
    background-position-x: 340px;
  }
}


@keyframes star-twinkle {
  from {
    opacity: 0.35;
  }
  50% {
    opacity: 0.95;
  }
  to {
    opacity: 0.45;
  }
}

@keyframes recommend-rise {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}



/* 演出を強くしすぎないための安全弁:
   ここを上げると主張が強くなるため、opacity と duration の変更は小さく保つ。 */
@media (prefers-reduced-motion: reduce) {
  .ambient-wave,
  .recommend-item,
  .ambient-star {
    animation: none;
  }
}

.tag {
  background: #ecfeff;
  border: 1px solid #c7f0f5;
  color: #0f766e;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.78rem;
}

.no-results-fallback {
  display: inline-block;
  margin-top: 2px;
  font-size: 0.78rem;
  color: #64748b;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.no-results-fallback:hover {
  color: #475569;
}

.control-menu {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  max-width: 956px;
  margin: 0 auto;
}

.control-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.control-row + .control-row {
  margin-top: 8px;
}

.top-row {
  justify-content: space-between;
}

.server-status {
  flex: 1;
  min-width: 0;
  border: 1px solid #dbe6db;
  background: #f8fafc;
  border-radius: 8px;
  padding: 8px;
  font-size: 0.84rem;
  color: #0f172a;
}

.server-status--loading {
  background: #fef9c3;
  border-color: #fde047;
}

.server-status--error {
  background: #fee2e2;
  border-color: #f87171;
}

.server-status--ok {
  background: #dcfce7;
  border-color: #4ade80;
}

.menu-buttons {
  display: flex;
  gap: 6px;
}

.search-row input {
  flex: 1;
}

button,
input {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
}

button {
  padding: 8px 10px;
  cursor: pointer;
}

input {
  width: 100%;
  padding: 10px;
}

@media (max-width: 699px) {
  .talk-area {
    padding-top: 48px;
  }

  .view-tab {
    padding: 6px 10px;
    font-size: 0.8rem;
  }
}

@media (min-width: 700px) {
  .thumbnail {
    width: 96px;
    height: 54px;
  }
}
