:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", "Segoe UI", sans-serif;
  --radius: 20px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  display: flex;
  flex-direction: column;
  transition: background-color .3s ease, color .3s ease;
}

.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  font-size: .9rem;
  background: rgba(0,0,0,.18);
  backdrop-filter: blur(8px);
  z-index: 5;
  color: inherit;
}
.app-header h1 { font-size: 1rem; margin: 0; font-weight: 500; opacity: .9; }
.app-header .back { color: inherit; text-decoration: none; opacity: .85; }
.app-header .back:hover { opacity: 1; }

.clock-section {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 80px 20px 40px;
  position: relative;
  z-index: 1;
}
.clock-container {
  border-radius: var(--radius);
  padding: 30px;
  text-align: center;
  transition: all .3s ease;
  position: relative;
  overflow: hidden;
  width: 90%;
  max-width: 400px;
  background-color: rgba(255,255,255,.1);
  backdrop-filter: blur(10px);
}
.date { font-size: 1.2rem; margin-bottom: 10px; opacity: .8; }
.time { font-size: 4.8rem; margin-bottom: 10px; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.custom-time {
  font-size: 2.4rem;
  margin-top: 20px;
  cursor: pointer;
  transition: opacity .2s;
}
.custom-time:hover { opacity: .75; }

.settings { display: none; margin-top: 24px; text-align: left; }
.settings.open { display: block; }
.settings .field {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
  font-size: .85rem;
  gap: 4px;
}
.settings .field span { opacity: .8; }
.settings input, .settings select, .settings button {
  padding: 10px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
}
.settings input, .settings select {
  background: rgba(255,255,255,.9);
  color: #222;
}
.settings .buttons {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.settings button {
  flex: 1;
  background: #2a5bff;
  color: #fff;
  cursor: pointer;
  transition: opacity .2s;
}
.settings button.ghost { background: rgba(255,255,255,.2); }
.settings button:hover { opacity: .85; }

body.theme-white { background-color: #fff; color: #333; }
body.theme-white .clock-container { background-color: rgba(240,240,240,.7); box-shadow: 0 4px 6px rgba(0,0,0,.1); }

body.theme-dark { background-color: #1a1a1a; color: #fff; }
body.theme-dark .clock-container { background-color: rgba(44,44,44,.7); box-shadow: 0 4px 6px rgba(255,255,255,.1); }

body.theme-blue {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
}
body.theme-blue .clock-container {
  background: rgba(255,255,255,.1);
  backdrop-filter: blur(4px);
  box-shadow: 0 8px 32px rgba(31,38,135,.37);
}

body.theme-green { background-color: #2ecc71; color: #fff; }
body.theme-green .clock-container { background-color: rgba(255,255,255,.1); box-shadow: 0 4px 6px rgba(0,0,0,.1); }

body.theme-orange { background-color: #e67e22; color: #fff; }
body.theme-orange .clock-container { background-color: rgba(255,255,255,.1); box-shadow: 0 4px 6px rgba(0,0,0,.1); }

body.theme-wave, body.theme-cute { background-color: #000; color: #fff; }
body.theme-wave .clock-container, body.theme-cute .clock-container {
  background-color: rgba(0,0,0,.3);
  box-shadow: 0 4px 6px rgba(255,255,255,.1);
}

.background-video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -1;
}

@media (min-width: 768px) {
  .clock-section { min-height: 60vh; padding-top: 100px; }
  .clock-container { width: 80%; max-width: 520px; padding: 40px; }
  .date { font-size: 1.4rem; }
  .time { font-size: 5.6rem; }
  .custom-time { font-size: 2.8rem; }
  .settings input, .settings select, .settings button { font-size: 1.05rem; }
}

@media (min-width: 1200px) {
  .clock-container { max-width: 640px; padding: 50px; }
  .time { font-size: 6.4rem; }
  .custom-time { font-size: 3rem; }
}
