/* 背景を透過させる：html / body とも背景を持たせない */
html,
body {
  margin: 0;
  height: 100%;
  background: transparent;
  overflow: hidden;
  user-select: none;
  font-family: "SF Pro Rounded", "Hiragino Maru Gothic ProN", system-ui, sans-serif;
}

:root {
  --ink: #ffffff;
  --ink-soft: rgba(255, 255, 255, 0.72);
  --accent: #ff6b4a;
  --shadow: rgba(0, 0, 0, 0.55);
}

/*
 * インストール済み IWA として動いているとき。
 * Chrome 156 時点では unframed ウィンドウでも OS レベルの透過はできず、
 * ウィンドウ背景は不透明に塗られるため、暗い背景を敷いて可読性を確保する。
 */
@media (display-mode: standalone), (display-mode: unframed), (display-mode: borderless) {
  html {
    background: radial-gradient(120% 120% at 30% 20%, #2a2e6b 0%, #16181d 70%);
  }

  /* 背景が暗く固定されるので、文字色の切り替えは不要 */
  #btn-theme {
    display: none;
  }
}

:root[data-ink="dark"] {
  --ink: #16181d;
  --ink-soft: rgba(22, 24, 29, 0.7);
  --shadow: rgba(255, 255, 255, 0.6);
}

/* ウィンドウ全体をドラッグ領域にする（unframed / borderless ではタイトルバーがないため） */
.clock {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  app-region: drag;
  -webkit-app-region: drag;
  window-drag: move;
}

#dial {
  width: min(78vw, 64vh);
  height: auto;
  aspect-ratio: 1;
  filter: drop-shadow(0 2px 6px var(--shadow));
}

.digital {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: min(9vw, 7vh);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 4px var(--shadow);
}

.date {
  margin: 0;
  color: var(--ink-soft);
  font-size: min(4.2vw, 3.4vh);
  letter-spacing: 0.08em;
  text-shadow: 0 1px 3px var(--shadow);
}

/* ボタンはクリックを受け取れるようドラッグ領域から除外する */
.controls {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 160ms ease-out;
  app-region: no-drag;
  -webkit-app-region: no-drag;
  window-drag: none;
}

.clock:hover .controls,
.controls:focus-within {
  opacity: 1;
}

.controls button {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 14px;
  line-height: 26px;
  cursor: pointer;
}

.controls button:hover {
  background: rgba(0, 0, 0, 0.7);
}

@media (prefers-reduced-motion: reduce) {
  .controls {
    transition: none;
  }
}
