:root {
  --bg-color: #f5f5f7;
  --card-bg: #ffffff;
  --text-color: #222222;
  --muted-text: #777777;
  --accent-color: #4a6cf7;
  --accent-soft: rgba(74, 108, 247, 0.1);
  --border-color: #e0e0e0;
  --danger-color: #e74c3c;
  --success-color: #2ecc71;
  --radius: 12px;
  --shadow-soft: 0 10px 25px rgba(0, 0, 0, 0.04);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "M PLUS Rounded 1c", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
}

/* Layout */

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
}

.app-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 20;
}

.app-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  position: relative; /* ★ スマホナビをここ基準で絶対配置 */
}

/* ロゴ（前に書いたRPGフォント） */
.logo {
  font-family: "Dela Gothic One", "M PLUS Rounded 1c", system-ui, sans-serif;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 20px;
}

/* ▼▼ ナビの基本（スマホ用） ▼▼ */

.nav {
  display: none;                      /* デフォルトは非表示（ハンバーガーで開く） */
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 8px 0 10px;
}

.nav--open {
  display: block;
}

.nav a {
  display: block;
  padding: 8px 16px;
  text-decoration: none;
  color: var(--muted-text);
  font-size: 14px;
}

.nav a:hover {
  color: var(--accent-color);
  background: #f5f5f7;
}

/* ハンバーガーボタン */

.nav-toggle {
  border: none;
  background: transparent;
  width: 32px;
  height: 32px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: var(--text-color);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* 開いたときは「×」アイコンに変形 */
.nav-toggle.nav-toggle--open span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.nav-toggle.nav-toggle--open span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.nav-toggle--open span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ▼▼ PCサイズ以上（横並びメニュー） ▼▼ */

@media (min-width: 720px) {
  .nav {
    display: flex;
    position: static;
    border-bottom: none;
    padding: 0;
  }

  .nav a {
    display: inline-block;
    padding: 0;
    margin-left: 16px;
    background: transparent;
  }

  .nav a:hover {
    background: transparent;
    color: var(--accent-color);
  }

  .nav-toggle {
    display: none; /* PCではハンバーガー非表示 */
  }
}


.app-main {
  padding: 24px 0 40px;
}

/* Sections & Cards */

.section {
  margin-bottom: 32px;
}

.section-title {
  margin: 0 0 16px;
  font-size: 20px;
  font-family: "Dela Gothic One", "M PLUS Rounded 1c", system-ui, sans-serif;
  letter-spacing: 0.04em;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 16px;
}

.card__title {
  margin: 0 0 8px;
  font-size: 15px;
  font-family: "Dela Gothic One", "M PLUS Rounded 1c", system-ui, sans-serif;
  letter-spacing: 0.04em;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.summary-value {
  font-size: 24px;
  font-weight: 700;
  margin: 8px 0;
  font-family: "Dela Gothic One", "M PLUS Rounded 1c", system-ui, sans-serif;
  letter-spacing: 0.08em;
}

.summary-sub {
  font-size: 12px;
  color: var(--muted-text);
}

/* Progress bar */

.progress {
  width: 100%;
  height: 8px;
  background: var(--accent-soft);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}

.progress__bar {
  height: 100%;
  background: var(--accent-color);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.progress__label {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted-text);
}

/* Task list */

.task-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.task-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  margin-bottom: 8px;
  gap: 12px;
}

.task-item--done {
  opacity: 0.6;
}

.task-item__main {
  flex: 1;
}

.task-item__title {
  font-weight: 600;
  display: inline-block;
  margin-right: 6px;
}

.task-item__subject {
  font-size: 12px;
  color: var(--muted-text);
  padding: 2px 6px;
  border-radius: 999px;
  background: #f0f0f3;
}

.task-item__meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted-text);
  margin-right: 8px;
  min-width: 120px;
}

.task-item__priority {
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  display: inline-block;
}

.task-item__priority--1 {
  border-color: var(--danger-color);
  color: var(--danger-color);
}

.task-item__priority--2 {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.task-item__priority--3 {
  border-color: #999999;
  color: #999999;
}

.task-item__status {
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11px;
}

.task-item__status--done {
  background: rgba(46, 204, 113, 0.12);
  color: var(--success-color);
}

.task-item__status--open {
  background: rgba(74, 108, 247, 0.08);
  color: var(--accent-color);
}

/* Forms */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 16px;
  align-items: flex-end;
}

.form-label {
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-input,
.form-select {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  font-size: 14px;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

.form-actions {
  margin-top: 12px;
}

.inline-form {
  margin: 0;
}

/* Buttons */

.btn {
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  background: #e3e5ef;
  color: #222222;
  transition: background 0.15s ease, transform 0.05s ease;
}

.btn:hover {
  background: #d3d5e1;
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background: var(--accent-color);
  color: #ffffff;
}

.btn--primary:hover {
  background: #3854cc;
}

.btn--ghost {
  background: transparent;
  border: 1px solid var(--border-color);
}

.btn--small {
  padding: 4px 10px;
  font-size: 12px;
}

/* Timer */

.timer {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.timer__display {
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  padding: 12px 0;
  background: #111111;
  color: #f5f5f5;
  border-radius: var(--radius);
  letter-spacing: 0.18em;
  font-family: "Dela Gothic One", "M PLUS Rounded 1c", system-ui, sans-serif;
}

.timer__controls {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.timer__form {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Table */

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.table th,
.table td {
  padding: 8px 10px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-color);
}

.table th {
  background: #f5f5f7;
  text-align: left;
}

.table tr:last-child td {
  border-bottom: none;
}

/* Calendar */

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.calendar-title {
  font-weight: 600;
}

.calendar-nav {
  font-size: 13px;
  text-decoration: none;
  color: var(--accent-color);
}

.calendar {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  margin-top: 8px;
}

.calendar__head {
  padding: 6px 4px;
  font-size: 12px;
  background: #f5f5f7;
  text-align: center;
}

.calendar__head--sun {
  color: #e74c3c;
}

.calendar__head--sat {
  color: #3498db;
}

.calendar__cell {
  height: 60px;
  border-bottom: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  vertical-align: top;
  font-size: 12px;
  padding: 4px;
  position: relative;
}

.calendar__cell:last-child {
  border-right: none;
}

.calendar__cell--empty {
  background: #fafafa;
}

.calendar__date {
  font-size: 11px;
  color: var(--muted-text);
}

.calendar__minutes {
  margin-top: 4px;
  font-weight: 600;
}

.calendar__minutes--zero {
  color: #cccccc;
}

/* ヒートマップの色 */
.calendar__cell--level-0 {
  background: #ffffff;
}

.calendar__cell--level-1 {
  background: #e8f0ff;
}

.calendar__cell--level-2 {
  background: #c7d6ff;
}

.calendar__cell--level-3 {
  background: #9ab4ff;
}

.calendar__cell--level-4 {
  background: #768fff;
  color: #ffffff;
}

.calendar__cell--today {
  outline: 2px solid var(--accent-color);
  outline-offset: -2px;
}

.calendar-legend {
  margin-top: 8px;
  font-size: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.legend-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding: 2px 4px;
  border-radius: 999px;
  font-size: 11px;
}

.legend-box--0 { background: #ffffff; border: 1px solid #dddddd; }
.legend-box--1 { background: #e8f0ff; }
.legend-box--2 { background: #c7d6ff; }
.legend-box--3 { background: #9ab4ff; }
.legend-box--4 { background: #768fff; color: #ffffff; }

/* Footer */

.app-footer {
  border-top: 1px solid var(--border-color);
  background: #ffffff;
  padding: 10px 0;
  font-size: 12px;
  color: var(--muted-text);
}

/* Misc */

.section-link {
  margin-top: 8px;
  font-size: 13px;
}

.section-link a {
  color: var(--accent-color);
  text-decoration: none;
}

.section-link a:hover {
  text-decoration: underline;
}

/* Responsive */

@media (max-width: 600px) {
  .task-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .task-item__meta {
    flex-direction: row;
    flex-wrap: wrap;
  }
}
/* Focus Mode Overlay */

.focus-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, #1f2933 0, #050711 60%);
  color: #f5f5f5;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.focus-overlay--active {
  display: flex;
}

.focus-overlay__inner {
  max-width: 480px;
  width: 100%;
  text-align: center;
}

.focus-overlay__label {
  font-size: 13px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: 8px;
}

.focus-overlay__task {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
}

.focus-overlay__time {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 0.16em;
  margin-bottom: 20px;
}

.focus-overlay__bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
  margin-bottom: 16px;
}

.focus-overlay__bar-fill {
  width: 100%;
  height: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(90deg, #4a6cf7, #9b72ff);
  animation: focus-bar 30s linear infinite;
}

@keyframes focus-bar {
  0% { transform: scaleX(0); }
  100% { transform: scaleX(1); }
}

.focus-overlay__hint {
  font-size: 13px;
  opacity: 0.8;
  margin-bottom: 18px;
}

.focus-overlay__exit {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #f5f5f5;
}

.focus-overlay__exit:hover {
  background: rgba(255, 255, 255, 0.08);
}
/* Achievements */

.badge-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.badge-item {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px dashed var(--border-color);
  font-size: 13px;
  gap: 6px;
}

.badge-item__icon {
  font-size: 18px;
  width: 22px;
  text-align: center;
}

.badge-item__label {
  flex: 1;
  font-family: "M PLUS Rounded 1c", system-ui, sans-serif;
  font-size: 13px;
}

/* 解除済み */
.badge-item--on {
  border-style: solid;
  border-color: var(--accent-color);
  background: var(--accent-soft);
}

/* 未解除 */
.badge-item--off {
  opacity: 0.7;
}
/* --------------------
   Gacha Machine
-------------------- */

.gacha-card {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gacha-machine {
  position: relative;
  margin: 0 auto;
  padding: 12px 12px 16px;
  max-width: 260px;
}

.gacha-machine__top {
  display: flex;
  justify-content: center;
  margin-bottom: 4px;
}

.gacha-machine__light {
  width: 46px;
  height: 8px;
  border-radius: 999px;
  background: radial-gradient(circle at 50% 0, #ffffff, #fde68a);
  box-shadow: 0 0 12px rgba(250, 204, 21, 0.7);
}

.gacha-machine__body {
  background: linear-gradient(145deg, #f97316, #facc15);
  border-radius: 18px 18px 12px 12px;
  padding: 10px;
  box-shadow: var(--shadow-soft);
}

.gacha-machine__glass {
  background: radial-gradient(circle at 20% 0%, rgba(255,255,255,0.9), rgba(255,255,255,0.8), rgba(255,255,255,0.35));
  border-radius: 999px;
  height: 150px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

/* 転がってるカプセルたち（飾り） */
.gacha-machine__capsule {
  position: absolute;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  opacity: 0.85;
}

.gacha-machine__capsule--1 {
  left: 16px;
  bottom: 12px;
  background: linear-gradient(145deg, #4a6cf7, #9b72ff);
}

.gacha-machine__capsule--2 {
  right: 18px;
  bottom: 10px;
  background: linear-gradient(145deg, #22c55e, #86efac);
}

.gacha-machine__capsule--3 {
  left: 40px;
  bottom: 40px;
  background: linear-gradient(145deg, #ec4899, #f9a8d4);
}

/* メインで出てくるカプセル */
.gacha-machine__capsule--main {
  width: 48px;
  height: 48px;
  bottom: 18px;
  background: linear-gradient(145deg, #fbbf24, #f97316);
  box-shadow:
    0 0 0 3px rgba(255,255,255,0.8),
    0 10px 18px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gacha-machine__main-icon {
  font-size: 24px;
  color: #ffffff;
  font-family: "Dela Gothic One", "M PLUS Rounded 1c", system-ui, sans-serif;
}

/* 受け皿 */
.gacha-machine__slot {
  width: 80px;
  height: 8px;
  margin: 4px auto 0;
  border-radius: 999px;
  background: rgba(0,0,0,0.18);
}

.gacha-machine__panel {
  margin-top: 12px;
  text-align: center;
}

.gacha-machine__button {
  width: 100%;
  margin-top: 4px;
}

.gacha-machine__note {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted-text);
}

/* エラー & 結果表示 */

.gacha-error {
  margin-top: 10px;
  font-size: 13px;
  color: #e74c3c;
}

.gacha-result {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(120deg, rgba(250,204,21,0.15), rgba(250,204,21,0.3));
  border: 1px solid rgba(250,204,21,0.8);
  text-align: center;
  transform: translateY(8px);
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.gacha-result--visible {
  opacity: 1;
  transform: translateY(0);
}

.gacha-result__label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: #b58100;
  margin-bottom: 4px;
}

.gacha-result__text {
  font-size: 14px;
  font-weight: 600;
}

/* --------------------
   Gacha Animations
-------------------- */

@keyframes gacha-shake {
  0%   { transform: translateX(0); }
  20%  { transform: translateX(-4px); }
  40%  { transform: translateX(4px); }
  60%  { transform: translateX(-2px); }
  80%  { transform: translateX(2px); }
  100% { transform: translateX(0); }
}

@keyframes gacha-bounce {
  0%   { transform: translateY(12px) scale(0.7); opacity: 0; }
  60%  { transform: translateY(-4px) scale(1.05); opacity: 1; }
  100% { transform: translateY(0) scale(1); }
}

/* ガチャボタン押した瞬間のガシャガシャ演出 */
.gacha-machine--spinning .gacha-machine__glass,
.gacha-machine--spinning .gacha-machine__capsule {
  animation: gacha-shake 0.9s cubic-bezier(.36,.07,.19,.97);
}

/* 結果が出たとき、メインカプセルがポンッと出る */
.gacha-machine__capsule--pop {
  animation: gacha-bounce 0.6s ease-out;
}

/* 結果が出た直後はガチャ本体も少しだけ光らせておく */
.gacha-machine--result .gacha-machine__body {
  box-shadow:
    0 0 0 1px rgba(250,204,21,0.7),
    0 12px 25px rgba(0,0,0,0.25);
}
