:root {
  color-scheme: dark;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", system-ui, sans-serif;
  background: #071321;
  color: #f7fbff;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { width: 100%; min-height: 100%; margin: 0; }

body { overflow: hidden; }

button, input { font: inherit; }

.app {
  position: relative;
  width: 100vw;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
}

#sky { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; }

.app::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(2, 10, 24, .08), rgba(2, 10, 24, .3));
}

.brand { position: absolute; top: clamp(24px, 5vw, 56px); left: clamp(22px, 6vw, 76px); }
.brand h1 { margin: 2px 0 7px; font-family: serif; font-size: clamp(2.4rem, 6vw, 4.6rem); font-weight: 400; letter-spacing: .18em; }
.brand > p:last-child { margin: 0; opacity: .78; letter-spacing: .12em; }
.eyebrow { margin: 0; font-size: .65rem; font-weight: 700; letter-spacing: .32em; opacity: .64; }

.panel {
  position: absolute;
  right: clamp(18px, 5vw, 64px);
  bottom: clamp(18px, 5vw, 56px);
  width: min(390px, calc(100vw - 36px));
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 20px;
  background: rgba(8, 24, 43, .5);
  box-shadow: 0 22px 70px rgba(0, 0, 0, .22);
  backdrop-filter: blur(18px);
}

.panel-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.panel-heading-actions { display: flex; align-items: center; gap: 8px; }
.panel h2 { margin: 3px 0 0; font-size: 1.12rem; letter-spacing: .08em; }
.sky-state { padding: 6px 10px; border-radius: 20px; background: rgba(255,255,255,.12); font-size: .72rem; }
.panel-toggle { min-width: 31px; min-height: 31px; padding: 0; border-radius: 50%; font-size: 1.1rem; line-height: 1; }
.panel-content { display: block; }
.panel.collapsed { width: min(390px, calc(100vw - 36px)); padding: 13px 15px; }
.panel.collapsed .panel-heading { margin: 0; cursor: pointer; }
.panel.collapsed .panel-heading .eyebrow, .panel.collapsed .sky-state { display: none; }
.panel.collapsed .panel-content { display: block; }
.panel.collapsed .panel-content > form,
.panel.collapsed .status,
.panel.collapsed .layers,
.panel.collapsed .facts,
.panel.collapsed .sun-times { display: none; }
.panel.collapsed .time-control { margin: 10px 0 0; padding: 10px 0 0; }
.panel.collapsed .panel-toggle { border: 0; background: transparent; font-size: 1rem; }
.panel.collapsed .panel-toggle::before { content: "開く"; margin-right: 5px; font-size: .65rem; opacity: .7; }
.coordinates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
label span { display: block; margin: 0 0 5px 2px; font-size: .72rem; opacity: .72; }
input { width: 100%; padding: 11px 12px; border: 1px solid rgba(255,255,255,.2); border-radius: 10px; outline: 0; background: rgba(3,12,25,.36); color: white; }
input:focus { border-color: rgba(255,255,255,.7); box-shadow: 0 0 0 3px rgba(255,255,255,.1); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 11px; }
button { min-height: 42px; padding: 9px 12px; border: 1px solid rgba(255,255,255,.22); border-radius: 10px; background: rgba(255,255,255,.08); color: white; cursor: pointer; }
button:hover { background: rgba(255,255,255,.15); }
button:disabled { cursor: wait; opacity: .55; }
button.primary { border-color: transparent; background: #eef7ff; color: #10243a; font-weight: 700; }
.status { min-height: 1.4em; margin: 12px 1px; font-size: .75rem; opacity: .72; }
.status.error { color: #ffd0c8; opacity: 1; }
.time-control { margin: 13px 0; padding: 12px 0; border-top: 1px solid rgba(255,255,255,.13); }
.time-control-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.time-control-heading label { font-size: .72rem; opacity: .72; }
.text-button { min-height: 0; padding: 3px 0; border: 0; background: transparent; font-size: .68rem; opacity: .8; }
.text-button:hover { background: transparent; opacity: 1; }
#time-slider { height: 18px; padding: 0; border: 0; box-shadow: none; accent-color: #eef7ff; cursor: ew-resize; }
.time-scale { display: flex; justify-content: space-between; margin-top: 1px; font-size: .58rem; opacity: .48; }
.layers { display: flex; gap: 15px; margin: -2px 0 12px; padding: 0; border: 0; }
.layers legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.layers label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.layers input { width: 15px; height: 15px; margin: 0; padding: 0; accent-color: #eef7ff; }
.layers label span { margin: 0; font-size: .67rem; opacity: .75; }
.facts { display: grid; grid-template-columns: 1.4fr 1fr; padding-top: 13px; border-top: 1px solid rgba(255,255,255,.13); }
.facts div + div { padding-left: 14px; border-left: 1px solid rgba(255,255,255,.13); }
.facts span, .facts strong { display: block; }
.facts span { margin-bottom: 3px; font-size: .64rem; opacity: .58; }
.facts strong { font-size: .84rem; font-weight: 500; }
.sun-times { display: flex; gap: 18px; margin-top: 9px; font-size: .65rem; opacity: .62; }
.sun-times strong { margin-left: 3px; font-size: .72rem; font-weight: 600; }
.mobile-controls { position: absolute; left: clamp(18px, 5vw, 64px); bottom: clamp(18px, 5vw, 56px); display: flex; gap: 8px; z-index: 2; }
.mobile-controls button { min-height: 40px; background: rgba(8,24,43,.56); backdrop-filter: blur(14px); }
.sensor-status { position: absolute; left: 50%; top: 60px; margin: 0; transform: translateX(-50%); font-size: .72rem; opacity: .74; }
.sensor-mode .brand, .sensor-mode .panel, .sensor-mode .orientation { opacity: 0; pointer-events: none; transform: translateY(10px); }
.sensor-mode .mobile-controls { left: 50%; transform: translateX(-50%); }
.brand, .panel, .orientation { transition: opacity .25s ease, transform .25s ease; }

.orientation { position: absolute; bottom: 20px; left: 50%; margin: 0; transform: translateX(-50%); font-size: .66rem; opacity: .45; }

noscript { position: fixed; inset: auto 20px 20px; padding: 16px; background: #111; color: white; }

@media (max-width: 680px) {
  .brand { top: 23px; left: 22px; }
  .brand h1 { font-size: 2rem; }
  .brand > p:last-child { font-size: .78rem; }
  .panel { right: 12px; bottom: 66px; width: calc(100vw - 24px); max-height: calc(100svh - 170px); padding: 16px; overflow-y: auto; scrollbar-width: thin; }
  .panel.collapsed { width: calc(100vw - 24px); }
  .mobile-controls { left: 12px; right: 12px; bottom: 12px; }
  .mobile-controls button { flex: 1; }
  .orientation { display: none; }
}

@media (max-width: 900px) and (orientation: landscape) {
  .brand { top: 15px; left: 18px; }
  .brand h1 { font-size: 1.7rem; margin-bottom: 2px; }
  .brand > p:last-child { display: none; }
  .panel { right: 10px; bottom: 10px; width: min(350px, 45vw); max-height: calc(100svh - 20px); padding: 13px; overflow-y: auto; }
  .panel-heading { margin-bottom: 9px; }
  .status { margin: 6px 1px; }
  .time-control { margin: 6px 0; padding: 6px 0; }
  .mobile-controls { left: 12px; bottom: 12px; right: auto; }
}

@media (max-height: 620px) {
  .brand > p:last-child { display: none; }
  .panel { bottom: 10px; padding: 14px; }
  .panel-heading { margin-bottom: 10px; }
  .status { margin: 7px 1px; }
  .time-control { margin: 7px 0; padding: 7px 0; }
}
