/* =========================================
   基本テーマ変数
========================================= */
:root {
  --bg: #e3edf7;
  --primary: #1f2933;
  --accent: #3b82f6;
  --second-color: #ff7e5f;
  --text-main: #111827;
  --text-sub: #6b7280;
  --shadow-light: rgba(255, 255, 255, 0.9);
  --shadow-dark: rgba(163, 177, 198, 0.8);
  --radius: 22px;

  --glass-bg: rgba(255, 255, 255, 0.18);
  --glass-border: rgba(255, 255, 255, 0.4);
}

/* =========================================
   LED風フォント（Digital-7）
========================================= */
@font-face {
  font-family: 'Digital-7';
  src: local('Digital-7'), local('digital-7');
}

/* =========================================
   ダークモード
========================================= */
body.dark {
  --bg: #020617;
  --primary: #e5e7eb;
  --accent: #60a5fa;
  --second-color: #ffb347;
  --text-main: #e5e7eb;
  --text-sub: #9ca3af;
  --shadow-light: rgba(55, 65, 81, 0.9);
  --shadow-dark: rgba(0, 0, 0, 0.9);
  --glass-bg: rgba(15, 23, 42, 0.6);
  --glass-border: rgba(148, 163, 184, 0.4);
}

/* =========================================
   全体レイアウト
========================================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  background: radial-gradient(circle at top left, #f5f9ff, #d7e1ec);
  color: var(--text-main);
  min-height: 100vh;
  padding: 16px;
  transition: background 0.3s ease, color 0.3s ease;
}

body.dark {
  background: radial-gradient(circle at top left, #020617, #020617);
}

.app {
  max-width: 1500px;
  margin: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* =========================================
   Header
========================================= */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: 9px 9px 16px var(--shadow-dark),
              -9px -9px 16px var(--shadow-light);
  flex-wrap: wrap;
  gap: 8px;
}

.brand-title {
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: 1rem;
}

.brand-sub {
  font-size: 0.8rem;
  color: var(--text-sub);
}

nav {
  display: flex;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-sub);
}

nav span {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg);
  box-shadow: inset 2px 2px 4px var(--shadow-dark),
              inset -2px -2px 4px var(--shadow-light);
}

/* テーマ切り替えボタン */
.theme-toggle {
  border: none;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--bg);
  box-shadow: 3px 3px 6px var(--shadow-dark),
              -3px -3px 6px var(--shadow-light);
  cursor: pointer;
}

/* =========================================
   Main：PCでは左右並び
========================================= */
main {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
}

@media (max-width: 900px) {
  main {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: 9px 9px 16px var(--shadow-dark),
              -9px -9px 16px var(--shadow-light);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* =========================================
   ガラスモーフィズム時計背景
========================================= */
.clock-glass {
  border-radius: 26px;
  padding: 18px 16px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow:
    0 18px 40px rgba(15, 23, 42, 0.25),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(18px) saturate(140%);
}

/* =========================================
   フリップ時計（1枚パネル）
========================================= */
.flip-clock-wrapper {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.flip-row {
  display: flex;
  justify-content: center;
  gap: clamp(20px, 4vw, 60px);
}

.flip-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.flip-label {
  font-size: 0.7rem;
  color: var(--text-sub);
}

.flip-card {
  position: relative;
  width: clamp(120px, 14vw, 220px);
  height: clamp(160px, 18vw, 300px);
  perspective: 1400px;
}

.flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

.flip-face {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: radial-gradient(circle at top left, #050816, #020617);
  color: #f9fafb;
  display: flex;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
  box-shadow:
    0 14px 26px rgba(0,0,0,0.8),
    0 0 0 1px rgba(15,23,42,0.9);
}

.flip-number {
  font-family: 'Digital-7', monospace;
  font-size: clamp(4rem, 7vw, 7rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

/* 秒だけ色変更 */
.second-color {
  color: var(--second-color);
}

/* アニメーション */
.flip-current {
  transform: rotateX(0deg);
}

.flip-next {
  transform: rotateX(90deg) translateY(20%);
  opacity: 0;
  transform-origin: center bottom;
}

.flip-card.flip-animating .flip-current {
  animation: flipOut 0.35s ease-in forwards;
}

.flip-card.flip-animating .flip-next {
  animation: flipIn 0.35s ease-out 0.35s forwards;
}

@keyframes flipOut {
  0% { transform: rotateX(0deg); opacity: 1; }
  100% { transform: rotateX(-90deg); opacity: 0; }
}

@keyframes flipIn {
  0% { transform: rotateX(90deg); opacity: 0; }
  100% { transform: rotateX(0deg); opacity: 1; }
}

/* 秒の揺れ */
.flip-second {
  will-change: transform;
  transform: rotateX(var(--sec-tilt, 0deg));
}

/* 日付 */
.flip-meta {
  text-align: center;
  font-size: 1.1rem;
  color: var(--text-sub);
}

/* =========================================
   Google カレンダー風デザイン
========================================= */
.calendar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.calendar-month {
  font-weight: 600;
  font-size: 1.1rem;
}

.calendar-nav button {
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  background: #fff;
  border: 1px solid #d1d5db;
  cursor: pointer;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  background: #e5e7eb;
  padding: 4px;
  border-radius: 12px;
}

.calendar-cell {
  background: #fff;
  padding: 8px 0;
  text-align: center;
  border-radius: 6px;
  font-size: 0.85rem;
  border: 1px solid #e5e7eb;
}

.calendar-cell.header {
  background: #f3f4f6;
  font-weight: 600;
}

.calendar-cell.today {
  background: #3b82f6;
  color: #fff;
  font-weight: 700;
  border-radius: 50%;
}

.calendar-cell.holiday {
  color: #dc2626;
  font-weight: 600;
}

/* =========================================
   天気（WeatherAPI.com）別デザインアイコン
========================================= */
.weather {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.weather-location {
  font-size: 0.85rem;
  color: var(--text-sub);
}

.weather-main {
  display: flex;
  gap: 12px;
  align-items: center;
}

.weather-temp {
  font-size: 2.2rem;
  font-weight: 600;
}

.weather-desc {
  font-size: 0.9rem;
  color: var(--text-sub);
}

.weather-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  font-size: 0.8rem;
}

.weather-meta span {
  padding: 6px 8px;
  border-radius: 12px;
  background: var(--bg);
  box-shadow: 3px 3px 6px var(--shadow-dark),
              -3px -3px 6px var(--shadow-light);
}

/* 別デザイン天気アイコン（派手アニメーション） */
.weather-icon-wrapper {
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.weather-icon {
  width: 90px;
  height: 90px;
  animation:
    floatIcon 3s ease-in-out infinite,
    rotateIcon 12s linear infinite,
    pulseIcon 2.4s ease-in-out infinite;
}

/* 浮遊 */
@keyframes floatIcon {
  0%   { transform: translateY(0px); }
  50%  { transform: translateY(-12px); }
  100% { transform: translateY(0px); }
}

/* ゆっくり回転 */
@keyframes rotateIcon {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 拡大縮小（脈動） */
@keyframes pulseIcon {
  0%   { filter: drop-shadow(0 0 4px rgba(255,255,255,0.4)); transform: scale(1); }
  50%  { filter: drop-shadow(0 0 14px rgba(255,255,255,0.9)); transform: scale(1.15); }
  100% { filter: drop-shadow(0 0 4px rgba(255,255,255,0.4)); transform: scale(1); }
}

/* =========================================
   メモ
========================================= */
.memo {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.memo textarea {
  width: 100%;
  min-height: 150px;
  border-radius: 16px;
  border: none;
  padding: 12px;
  resize: vertical;
  background: var(--bg);
  color: var(--text-main);
  box-shadow:
    inset 4px 4px 8px var(--shadow-dark),
    inset -4px -4px 8px var(--shadow-light);
}

.memo textarea:focus {
  outline: none;
}

.memo-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-sub);
}

.memo-actions button {
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.8rem;
  background: linear-gradient(135deg, #3b82f6, #60a5fa);
  color: #fff;
  cursor: pointer;
}

/* =========================================
   Footer
========================================= */
footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-sub);
  margin-top: 10px;
  padding: 10px 0;
}

/* =========================================
   スマホ最適化
========================================= */
@media (max-width: 900px) {

  main {
    grid-template-columns: 1fr;
  }

  .flip-card {
    width: 110px;
    height: 150px;
  }

  .flip-number {
    font-size: 3.5rem;
  }

  .weather-icon {
    width: 70px;
    height: 70px;
  }

  .weather-main {
    flex-direction: row;
    gap: 10px;
  }

  .memo textarea {
    min-height: 120px;
  }

  .card {
    padding: 14px;
  }
}

/* =========================================
   スクロールバー
========================================= */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: #2563eb;
}
