/* ===== Reset & Base ===== */
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--color-primary); outline-offset: 3px; }

.auth-label { display: block; text-align: left; font-size: 0.85rem; margin-bottom: 6px; }

.data-status {
  padding: 14px 18px;
  margin-bottom: 20px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  overflow-wrap: anywhere;
}
.data-status button { margin-left: 12px; padding: 8px 14px; cursor: pointer; }
.data-status.is-error { border-color: #ef4444; }

.link-card, .news-title { overflow-wrap: anywhere; min-width: 0; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; transition-delay: 0ms !important; }
  .section { opacity: 1 !important; transform: none !important; }
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --color-bg: #f8f9fa;
  --color-surface: #ffffff;
  --color-primary: #2563eb;
  --color-primary-light: #eff6ff;
  --color-text: #1e293b;
  --color-text-sub: #64748b;
  --color-border: #e2e8f0;
  --color-sun: #ef4444;
  --color-sat: #3b82f6;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.08);
  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --color-bg: #0f172a;
  --color-surface: #1e293b;
  --color-primary: #3b82f6;
  --color-primary-light: #1e3a5f;
  --color-text: #e2e8f0;
  --color-text-sub: #94a3b8;
  --color-border: #334155;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.4);
}

html {
  scroll-behavior: smooth;
}

/* タッチデバイスでのタップ遅延を除去 */
* {
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Meiryo", sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.7;
  min-height: 100vh;
  position: relative;
}

/* ===== Background Pattern ===== */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.4;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(37, 99, 235, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(59, 130, 246, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(37, 99, 235, 0.04) 0%, transparent 70%);
  transition: opacity 0.3s ease;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.3;
  background-image:
    linear-gradient(30deg, var(--color-border) 12%, transparent 12.5%, transparent 87%, var(--color-border) 87.5%, var(--color-border)),
    linear-gradient(150deg, var(--color-border) 12%, transparent 12.5%, transparent 87%, var(--color-border) 87.5%, var(--color-border)),
    linear-gradient(30deg, var(--color-border) 12%, transparent 12.5%, transparent 87%, var(--color-border) 87.5%, var(--color-border)),
    linear-gradient(150deg, var(--color-border) 12%, transparent 12.5%, transparent 87%, var(--color-border) 87.5%, var(--color-border)),
    linear-gradient(60deg, rgba(37, 99, 235, 0.04) 25%, transparent 25.5%, transparent 75%, rgba(37, 99, 235, 0.04) 75%, rgba(37, 99, 235, 0.04));
  background-size: 80px 140px;
  background-position: 0 0, 0 0, 40px 70px, 40px 70px, 0 0;
  transition: opacity 0.3s ease;
}

[data-theme="dark"] body::before {
  opacity: 0.3;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(59, 130, 246, 0.06) 0%, transparent 70%);
}

[data-theme="dark"] body::after {
  opacity: 0.15;
}

/* ===== Header ===== */
.header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  position: relative;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ===== Clock ===== */
.clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}

.clock-time {
  font-family: "Consolas", "Menlo", "Courier New", monospace;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: 0.08em;
}

.clock-date {
  font-size: 0.7rem;
  color: var(--color-text-sub);
  letter-spacing: 0.02em;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: -0.02em;
}

/* ===== Hamburger (hidden on desktop) ===== */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  width: 34px;
  height: 34px;
  padding: 6px;
  cursor: pointer;
}

.hamburger span {
  display: block;
  height: 2px;
  background: var(--color-text);
  border-radius: 1px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.hamburger.open span:nth-child(1) {
  transform: rotate(45deg) translate(4px, 4px);
}

.hamburger.open span:nth-child(2) {
  opacity: 0;
}

.hamburger.open span:nth-child(3) {
  transform: rotate(-45deg) translate(4px, -4px);
}

.nav {
  display: flex;
  gap: 8px;
}

.nav-link {
  text-decoration: none;
  color: var(--color-text-sub);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 8px;
  transition: background var(--transition), color var(--transition);
}

.nav-link:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.nav-admin {
  border: 1px solid var(--color-border);
}

/* ===== Theme Toggle ===== */
.theme-toggle {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background var(--transition), transform var(--transition);
  line-height: 1;
  padding: 0;
}

.theme-toggle:hover {
  background: var(--color-primary-light);
  transform: rotate(20deg);
}

/* ダークモード時のヘッダー調整 */
[data-theme="dark"] .header {
  background: var(--color-surface);
  border-bottom-color: var(--color-border);
}

[data-theme="dark"] .news-category[data-cat="重要"] {
  background: #3b1818;
  color: #f87171;
}
[data-theme="dark"] .news-category[data-cat="総務"] {
  background: #14291a;
  color: #4ade80;
}
[data-theme="dark"] .news-category[data-cat="IT"] {
  background: #172554;
  color: #60a5fa;
}
[data-theme="dark"] .news-category[data-cat="人事"] {
  background: #2d2305;
  color: #facc15;
}
[data-theme="dark"] .news-category[data-cat="イベント"] {
  background: #2e1065;
  color: #c084fc;
}
[data-theme="dark"] .news-category[data-cat="不具合修正"] {
  background: #431407;
  color: #fb923c;
}

/* スムーズな切り替えアニメーション */
body, .header, .news-item, .link-card, .gcal-container,
.footer, .news-list, .video-card {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* ===== Greeting ===== */
.greeting {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-text);
  animation: fadeInUp 0.6s ease;
}

.greeting-emoji {
  font-size: 1.5rem;
  display: inline-block;
  animation: greetingBounce 1s ease infinite;
  margin-right: 6px;
}

.greeting-sub {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--color-text-sub);
  margin-top: 4px;
}

@keyframes greetingBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* ===== Animations ===== */

/* フェードイン + 上にスライド */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeOutUp {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* フェードイン + スケール */
@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* 左からスライドイン */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* セクション全体のアニメーション（スクロール連動） */
.section {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.section.visible {
  opacity: 1;
  transform: translateY(0);
}

/* セクションタイトル */
.section.visible .section-title {
  animation: slideInLeft 0.5s ease both;
}

/* お知らせアイテム：順番にふわっと */
.section.visible .news-item {
  opacity: 0;
  animation: fadeInUp 0.4s ease both;
}
.section.visible .news-item:nth-child(1) { animation-delay: 0.05s; }
.section.visible .news-item:nth-child(2) { animation-delay: 0.1s; }
.section.visible .news-item:nth-child(3) { animation-delay: 0.15s; }
.section.visible .news-item:nth-child(4) { animation-delay: 0.2s; }
.section.visible .news-item:nth-child(5) { animation-delay: 0.25s; }
.section.visible .news-item:nth-child(6) { animation-delay: 0.3s; }

/* リンクカード：順番にポップイン */
.section.visible .link-card {
  opacity: 0;
  animation: fadeInScale 0.4s ease both;
}
.section.visible .link-card:nth-child(1) { animation-delay: 0.05s; }
.section.visible .link-card:nth-child(2) { animation-delay: 0.1s; }
.section.visible .link-card:nth-child(3) { animation-delay: 0.15s; }
.section.visible .link-card:nth-child(4) { animation-delay: 0.2s; }
.section.visible .link-card:nth-child(5) { animation-delay: 0.25s; }
.section.visible .link-card:nth-child(6) { animation-delay: 0.3s; }
.section.visible .link-card:nth-child(7) { animation-delay: 0.35s; }
.section.visible .link-card:nth-child(8) { animation-delay: 0.4s; }

/* カレンダー */
.section.visible .gcal-container {
  animation: fadeInScale 0.5s ease 0.1s both;
}

/* 動画 */
.section.visible .video-card {
  animation: fadeInUp 0.5s ease 0.1s both;
}

/* リンクカードのホバーアニメーション強化 */
.link-card {
  transition: box-shadow var(--transition), transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.link-card:hover {
  transform: translateY(-4px) scale(1.02);
}

.link-card:active {
  transform: translateY(-1px) scale(0.98);
  transition-duration: 0.1s;
}

/* ===== Main ===== */
.main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  display: flex;
  flex-direction: column;
  gap: 48px;
}

/* ===== Section ===== */
.section-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 20px;
  padding-left: 12px;
  border-left: 3px solid var(--color-primary);
}

/* ===== News ===== */
.news-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.news-item {
  background: var(--color-surface);
  padding: 0;
  display: flex;
  flex-direction: column;
  transition: background var(--transition);
}

.news-item:hover {
  background: var(--color-primary-light);
}

.news-date {
  font-size: 0.8rem;
  color: var(--color-text-sub);
  white-space: nowrap;
}

.news-category {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 4px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.news-category[data-cat="重要"] {
  background: #fef2f2;
  color: #dc2626;
}

.news-category[data-cat="総務"] {
  background: #f0fdf4;
  color: #16a34a;
}

.news-category[data-cat="IT"] {
  background: #eff6ff;
  color: #2563eb;
}

.news-category[data-cat="人事"] {
  background: #fefce8;
  color: #ca8a04;
}

.news-category[data-cat="イベント"] {
  background: #faf5ff;
  color: #9333ea;
}

.news-category[data-cat="不具合修正"] {
  background: #fff7ed;
  color: #ea580c;
}

/* お知らせヘッダー：アコーディオン */
.news-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 20px;
  width: 100%;
  transition: background 0.2s ease;
}

.news-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.news-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 詳細ありのヘッダー */
.news-item.has-detail .news-header {
  cursor: pointer;
}

.news-item.has-detail:hover {
  background: var(--color-primary-light);
}

/* 詳細なしのヘッダー */
.news-item:not(.has-detail) .news-header {
  padding: 14px 20px;
}

.news-item:not(.has-detail):hover {
  background: var(--color-primary-light);
}

/* 矢印 */
.news-arrow {
  font-size: 0.7rem;
  color: var(--color-text-sub);
  margin-left: auto;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}

.news-item.open .news-arrow {
  transform: rotate(180deg);
}

/* 展開コンテンツ */
.news-detail {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding: 0 20px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text);
  line-height: 1.8;
  border-top: 1px solid transparent;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.3s ease 0.05s,
              padding 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.3s ease;
}

.news-item.open .news-detail {
  opacity: 1;
  padding: 16px 20px;
  border-top-color: var(--color-border);
}

.news-detail-text {
  margin-bottom: 12px;
}

.news-detail-text:last-child {
  margin-bottom: 0;
}

.news-detail-video {
  margin-top: 8px;
  max-width: 480px;
}

.news-detail-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.news-gallery-img {
  width: 100%;
  border-radius: 8px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.news-gallery-img:hover {
  transform: scale(1.03);
}

.news-badge {
  font-size: 0.6rem;
  font-weight: 700;
  color: #fff;
  background: #ef4444;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
  animation: badgePulse 1.5s ease infinite;
  letter-spacing: 0.05em;
}

@keyframes badgePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

[data-theme="dark"] .news-badge {
  background: #dc2626;
}

.news-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text);
  line-height: 1.5;
}

.news-toggle-item {
  background: var(--color-surface);
  padding: 12px 16px;
  display: flex;
  justify-content: center;
}

.news-hidden-wrap {
  background: transparent;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
}

.news-hidden-wrap.open {
  max-height: 1600px;
  opacity: 1;
}

.news-hidden-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.news-hidden-list .news-item {
  animation: fadeInUp 0.35s ease both;
}

.news-hidden-list .news-item:nth-child(1) { animation-delay: 0.02s; }
.news-hidden-list .news-item:nth-child(2) { animation-delay: 0.05s; }
.news-hidden-list .news-item:nth-child(3) { animation-delay: 0.08s; }
.news-hidden-list .news-item:nth-child(4) { animation-delay: 0.11s; }
.news-hidden-list .news-item:nth-child(5) { animation-delay: 0.14s; }
.news-hidden-list .news-item:nth-child(6) { animation-delay: 0.17s; }

.news-hidden-wrap.closing .news-item {
  animation: fadeOutUp 0.28s ease both;
}

.news-hidden-wrap.closing .news-item:nth-child(1) { animation-delay: 0.12s; }
.news-hidden-wrap.closing .news-item:nth-child(2) { animation-delay: 0.10s; }
.news-hidden-wrap.closing .news-item:nth-child(3) { animation-delay: 0.08s; }
.news-hidden-wrap.closing .news-item:nth-child(4) { animation-delay: 0.06s; }
.news-hidden-wrap.closing .news-item:nth-child(5) { animation-delay: 0.04s; }
.news-hidden-wrap.closing .news-item:nth-child(6) { animation-delay: 0.02s; }

.news-toggle-btn {
  appearance: none;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-primary);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform 0.15s ease;
}

.news-toggle-btn:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
}

.news-toggle-btn:active {
  transform: translateY(1px);
}

/* ===== Links ===== */
.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.link-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: var(--color-text);
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition), transform var(--transition);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.link-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.link-icon {
  font-size: 1.75rem;
  line-height: 1;
}

.link-icon-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 6px;
}

.link-name {
  font-size: 0.925rem;
  font-weight: 600;
}

.link-desc {
  font-size: 0.8rem;
  color: var(--color-text-sub);
}

.link-new-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  background: #ef4444;
  color: #fff;
  padding: 1px 6px;
  border-radius: 3px;
  vertical-align: middle;
}

/* ===== Video ===== */
.video-section {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.video-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.video-label {
  padding: 16px 20px;
  font-size: 0.925rem;
  font-weight: 600;
}

.video-desc {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--color-text-sub);
}

.video-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
}

.video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* ===== Google Calendar Embed ===== */
.gcal-container {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.gcal-iframe {
  width: 100%;
  height: 600px;
  border: none;
}

.event-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  padding: 8px 12px;
  background: var(--color-primary-light);
  border-radius: 8px;
}

.event-date-label {
  font-weight: 600;
  color: var(--color-primary);
  white-space: nowrap;
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 24px;
  font-size: 0.8rem;
  color: var(--color-text-sub);
  border-top: 1px solid var(--color-border);
}

/* ===== Responsive: Tablet ===== */
@media (max-width: 768px) {
  .link-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
}

/* ===== Responsive: Mobile ===== */
@media (max-width: 640px) {
  /* ヘッダー：2段構成 */
  .header-inner {
    padding: 8px 12px;
    height: auto;
    flex-wrap: wrap;
    gap: 6px;
  }

  .logo { font-size: 1rem; }

  .header-right {
    gap: 8px;
    flex: 1;
    justify-content: flex-end;
  }

  .clock-time { font-size: 0.85rem; }
  .clock-date { font-size: 0.55rem; }

  .theme-toggle {
    width: 30px;
    height: 30px;
    font-size: 0.9rem;
  }

  /* ハンバーガー表示 */
  .hamburger {
    display: flex;
  }

  /* ナビをドロップダウンに（ヘッダー下に固定表示） */
  .nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    gap: 0;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 8px 0;
    z-index: 200;
  }

  .nav.open {
    display: flex;
  }

  .nav-link {
    font-size: 0.85rem;
    padding: 12px 20px;
    border-radius: 0;
    text-align: left;
  }

  .nav-link:hover {
    background: var(--color-primary-light);
  }

  .nav .theme-toggle {
    align-self: flex-start;
    margin: 8px 16px;
  }

  .nav-viewer-logout {
    font-size: 0.8rem;
    padding: 12px 20px;
  }

  .nav-admin {
    padding: 12px 20px;
    border: none;
  }

  /* 挨拶 */
  .greeting {
    font-size: 1.1rem;
  }
  .greeting-sub {
    font-size: 0.8rem;
  }

  /* メイン */
  .main {
    padding: 20px 12px 40px;
    gap: 28px;
  }

  .section-title {
    font-size: 1rem;
    margin-bottom: 14px;
  }

  /* お知らせ */
  .news-list {
    border-radius: 10px;
  }

  .news-item {
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px;
  }

  .news-header {
    padding: 12px 14px;
    gap: 4px;
  }

  .news-meta { gap: 6px; }

  .news-detail {
    padding: 12px 14px;
    font-size: 0.8rem;
  }

  .news-item-top {
    display: flex;
    gap: 8px;
    align-items: center;
  }

  .news-date {
    font-size: 0.75rem;
  }

  .news-category {
    font-size: 0.65rem;
  }

  .news-title {
    font-size: 0.875rem;
  }

  /* リンク集 */
  .link-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .link-card {
    padding: 14px;
    border-radius: 10px;
    gap: 6px;
  }

  .link-icon { font-size: 1.5rem; }
  .link-icon-img { width: 32px; height: 32px; }
  .link-name { font-size: 0.85rem; }
  .link-desc { font-size: 0.7rem; }

  /* 動画 */
  .video-section { margin-top: 16px; }
  .video-label {
    padding: 12px 16px;
    font-size: 0.85rem;
  }

  /* カレンダー */
  .gcal-iframe {
    height: 450px;
  }

  /* フッター */
  .footer {
    padding: 20px 12px;
    font-size: 0.75rem;
  }
}

/* ===== Responsive: Small Mobile ===== */
@media (max-width: 380px) {
  .logo { font-size: 0.9rem; }
  .clock-time { font-size: 0.8rem; }
  .nav-link { font-size: 0.65rem; padding: 4px 6px; }
  .link-grid { gap: 8px; }
  .link-card { padding: 12px; }
  .link-name { font-size: 0.8rem; }
  .greeting { font-size: 1rem; }
}

/* ===== Viewer Login Overlay ===== */
.viewer-login-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.viewer-login-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  padding: 40px 36px;
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.viewer-login-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 8px;
}

.viewer-login-desc {
  font-size: 0.85rem;
  color: var(--color-text-sub);
  margin-bottom: 24px;
}

.viewer-login-input {
  display: block;
  width: 100%;
  padding: 12px 16px;
  font-size: 1rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg);
  color: var(--color-text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  margin-bottom: 12px;
}

.viewer-login-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.viewer-login-code {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.5em;
  padding-left: calc(0.5em + 16px);
}

.viewer-login-btn {
  display: block;
  width: 100%;
  padding: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: var(--color-primary);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

.viewer-login-btn:hover {
  background: #1d4ed8;
}

.viewer-login-btn:active {
  transform: scale(0.98);
}

.viewer-login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.viewer-login-sent {
  font-size: 0.85rem;
  color: var(--color-text-sub);
  margin-bottom: 16px;
  line-height: 1.5;
}

.viewer-login-link {
  display: block;
  margin-top: 12px;
  background: none;
  border: none;
  color: var(--color-primary);
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
}

.viewer-login-error {
  color: #ef4444;
  font-size: 0.85rem;
  margin-top: 12px;
  min-height: 1.2em;
}

.nav-viewer-logout {
  color: #ef4444 !important;
  border-color: #ef4444 !important;
}

.nav-viewer-logout:hover {
  background: #fef2f2 !important;
}

[data-theme="dark"] .nav-viewer-logout:hover {
  background: #450a0a !important;
}

@media (max-width: 600px) {
  .viewer-login-box {
    padding: 28px 20px;
  }

  .viewer-login-code {
    font-size: 1.3rem;
  }
}
