@import url('https://fonts.googleapis.com/css2?family=Helvetica+Neue:wght@300;400;500&display=swap');

:root {
  --bg-color: #E8F0F2;
  --text-main: #333333;
  --text-dim: #777777;
  --accent: #5D9CEC;
  --juice-color: #FFB347;
  --juice-level: 1; /* 1.0 (Full) to 0.0 (Empty) */
  --pour-opacity: 0;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  color: var(--text-main);
  background-color: var(--bg-color);
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  -webkit-font-smoothing: antialiased;
}

.app {
  width: 100%;
  max-width: 600px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ヘッダー・共通系 */
.header {
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  width: 100%;
}

.back-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
}

.back-link:hover {
  color: var(--text-main);
}

.btn-nostyle {
  padding: 0;
}

/* 言語トグル */
.lang-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.03);
  color: var(--text-dim);
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  z-index: 100;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-appearance: none;
  appearance: none;
}
.lang-toggle:hover {
  background: rgba(0, 0, 0, 0.08);
  color: var(--text-main);
  transform: translateY(-2px);
}

/* 画面切り替え用 */
.screen {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  animation: fade-in 0.4s ease forwards;
  overflow-y: auto;
}

/* メニュー画面 */
.menu-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2rem;
}

.theme-title {
  font-size: 2rem;
  font-weight: 300;
  letter-spacing: 0.1em;
  color: var(--text-main);
  margin-bottom: 1rem;
}

.time-settings {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3rem;
  width: 100%;
  max-width: 400px;
  padding: 0 1rem;
}

.setting-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  flex: 1 1 auto;
  min-width: 140px;
}

.setting-label {
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  color: var(--text-dim);
}

.setting-control {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.setting-value {
  font-size: 2.2rem;
  font-weight: 300;
  min-width: 2.5ch;
  text-align: center;
  color: var(--text-main);
}

.setting-unit {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-right: 0.2rem;
}

.adj-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-main);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background 0.2s;
}
.adj-btn:hover { background: rgba(0, 0, 0, 0.1); }
.adj-btn:active { transform: scale(0.95); }

/* ドリンク選択 */
.drink-selector {
  margin-top: 1rem;
}
.drink-select {
  padding: 0.8rem 1.5rem;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.1);
  background: rgba(255,255,255,0.5);
  font-size: 1rem;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  text-align: center;
  font-family: inherit;
  transition: all 0.3s;
}
.drink-select:hover {
  background: rgba(255,255,255,0.8);
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

/* メインボタン */
.main-btn {
  background: var(--text-main);
  color: #fff;
  border: none;
  padding: 1rem 3rem;
  border-radius: 999px;
  font-size: 1rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.3s ease;
  outline: none;
  margin-top: 1rem;
}
.main-btn:hover {
  background: #000;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.main-btn:active { transform: scale(0.98); }

/* ==============================================
   タイマー画面 / グラスアニメーション
=============================================== */
.juice-area {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  padding: 0 2rem;
}

.glass-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  /* ストローが突き出る分を考慮して高さを確保 */
  height: 300px; 
}

.glass {
  width: 140px;
  height: 220px;
  border: 6px solid rgba(255, 255, 255, 0.7);
  border-top: none;
  border-radius: 0 0 20px 20px;
  background: rgba(255, 255, 255, 0.2);
  position: relative;
  box-shadow: 0 10px 30px rgba(0,0,0,0.05), inset 0 -10px 20px rgba(0,0,0,0.02);
  display: flex;
  align-items: flex-end;
  /* overflow overflow: hidden 削除（ストローをはみ出させるため） */
  z-index: 2;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.liquid {
  width: 100%;
  height: calc(var(--juice-level) * 100%);
  background: var(--juice-color);
  border-radius: 0 0 14px 14px;
  transition: height 0.1s linear, background-color 0.5s ease;
  position: relative;
  z-index: 1;
}

/* 液面のハイライト/立体感 */
.liquid::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 0;
  width: 100%;
  height: 10px;
  background: inherit;
  border-radius: 50%;
  filter: brightness(1.15) saturate(1.2);
}

.straw {
  position: absolute;
  width: 12px;
  height: 280px;
  border-radius: 6px;
  bottom: 5px;
  left: 30px;
  transform: rotate(15deg);
  transform-origin: bottom center;
  z-index: 0;
  box-shadow: inset -2px 0 5px rgba(0,0,0,0.1);
  transition: filter 0.5s ease;
  overflow: hidden; /* 中のジュースをマスクする */
  border: 1px solid rgba(255,255,255,0.3);
}

/* ストロー自体の模様（半透明） */
.straw::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    -45deg,
    rgba(255,255,255,0.7),
    rgba(255,255,255,0.7) 10px,
    rgba(255,107,107,0.7) 10px,
    rgba(255,107,107,0.7) 20px
  );
  z-index: 2;
}

/* ストロー内のジュース */
.straw-juice {
  position: absolute;
  bottom: 0; left: 0; width: 100%;
  /* 普段はグラスの液面と同じくらいの高さ */
  height: calc(var(--juice-level) * 100%); 
  background: var(--juice-color);
  z-index: 1;
  transition: background-color 0.5s ease, height 0.5s ease;
}

/* 飲んでいる最中のアニメーション */
.glass.drinking .straw-juice {
  height: 100%; /* 一気に上まで吸い上がる */
  background-image: repeating-linear-gradient(
    to bottom,
    var(--juice-color) 0px,
    var(--juice-color) 15px,
    transparent 15px,
    transparent 20px
  );
  background-size: 100% 20px;
  animation: strawSip 0.4s linear infinite;
}

@keyframes strawSip {
  0% { background-position: 0 0px; }
  100% { background-position: 0 -20px; }
}

/* グラス自体の反射ハイライト */
.glass-reflection {
  position: absolute;
  top: 10px;
  right: 15px;
  width: 15px;
  height: 160px;
  background: linear-gradient(to bottom, rgba(255,255,255,0.6), transparent);
  border-radius: 10px;
  z-index: 5;
  pointer-events: none;
}

/* 注ぐときのアニメーション用（水滴） */
.drop {
  position: absolute;
  background: var(--juice-color);
  border-radius: 50%;
  opacity: 0.8;
  animation: dropFall linear forwards;
  z-index: 1;
}

@keyframes dropFall {
  0% { transform: translateY(0); opacity: 0; }
  10% { opacity: 0.8; }
  85% { opacity: 0.8; }
  100% { transform: translateY(var(--drop-dist)); opacity: 0; }
}

/* 炭酸の泡 */
.bubbles-container {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  z-index: 3;
}

.bubble {
  position: absolute;
  bottom: 5px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  animation: floatUp linear forwards;
}

@keyframes floatUp {
  0% { transform: translateY(0) scale(1); opacity: 0; }
  10% { opacity: 1; }
  80% { opacity: 1; transform: translateY(calc(-1 * var(--travel-dist))) scale(1.2); }
  100% { transform: translateY(calc(-1 * var(--travel-dist) - 10px)) scale(1.5); opacity: 0; }
}

/* フッター操作系 */
.controls {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  z-index: 10;
}

.status-msg {
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

/* 一時休止オーバーレイ */
.pause-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(232, 240, 242, 0.85); /* テーマイメージに合わせて明るめ */
  backdrop-filter: blur(4px);
  z-index: 50;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2rem;
}

.pause-text {
  font-size: 1.2rem;
  letter-spacing: 0.2em;
  color: var(--text-main);
}

.pause-drink-selector {
  margin-bottom: 1rem;
}

.pause-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

.resume-btn, .pause-btn {
  border: none;
  padding: 0.8rem 2.5rem;
  border-radius: 999px;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
  background: var(--text-main);
  color: #fff;
}
.resume-btn:hover {
  transform: scale(1.05);
  background: #000;
}

.pause-btn-break {
  background: var(--accent);
  color: #fff;
}
.pause-btn-break:hover { background: #4a8cdb; }

.pause-btn-menu {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--text-dim);
}
.pause-btn-menu:hover {
  background: rgba(0,0,0,0.05);
  color: var(--text-main);
}

.hidden {
  display: none !important;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 400px) {
  .glass { width: 120px; height: 190px; }
  .straw { height: 250px; }
  .controls { padding: 1rem; }
}
