:root{
  --bg1:#dff3ff;
  --bg2:#f6fbff;
  --card:#ffffffcc;
  --text:#123;
  --muted:#456;
  --border:#d7e7f2;
  --shadow: 0 12px 30px rgba(11, 40, 60, .10);
  --radius: 18px;

  --primary:#2a7bd6;
  --primary2:#1d5fb0;
  --danger:#d84a4a;

  --font: system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Segoe UI", sans-serif;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family:var(--font);
  color:var(--text);
  background:
    radial-gradient(1200px 600px at 20% 10%, #ffffffcc, transparent 60%),
    radial-gradient(900px 500px at 90% 0%, #ffffffaa, transparent 60%),
    linear-gradient(180deg, var(--bg1), var(--bg2));
}

.topbar{
  position:sticky;
  top:0;
  z-index:10;
  backdrop-filter: blur(10px);
  background: linear-gradient(180deg, #ffffffcc, #ffffff99);
  border-bottom:1px solid var(--border);
}
.topbar__inner{
  max-width: 980px;
  margin:0 auto;
  padding: 12px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.brand{
  display:flex; align-items:center; gap:10px;
  font-weight:800;
  letter-spacing:.02em;
}
.brand__mark{ font-size: 22px; }
.brand__name{ font-size: 20px; }
.topbar__right{
  display:flex; align-items:center; gap:10px;
}

.app{
  max-width: 980px;
  margin: 18px auto 40px;
  padding: 0 16px 40px;
}

.screen{ display:none; }
.screen.active{ display:block; }

.card{
  background: var(--card);
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.hero{ padding: 22px; }
.hero__title{ font-size: 26px; margin: 0 0 6px; }
.hero__sub{ margin: 0 0 16px; color: var(--muted); font-size: 16px; }

.title{ font-size: 24px; margin: 0 0 6px; }
.sub{ margin: 0 0 14px; color: var(--muted); line-height:1.55; }

.row-between{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}
.rowWrap{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}

.grid2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width:640px){
  .grid2{ grid-template-columns:1fr; }
}

.form{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-top: 10px;
}

.label{ font-weight: 700; margin-top: 6px; }
.input{
  padding: 14px 14px;
  border-radius: 14px;
  border:1px solid var(--border);
  background: #fff;
  font-size: 18px;
  outline:none;
}
.input:focus{
  border-color: rgba(42, 123, 214, .65);
  box-shadow: 0 0 0 4px rgba(42,123,214,.12);
}
.input--small{ width: 180px; }

.btn{
  border:0;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 18px;
  font-weight: 800;
  cursor:pointer;
  transition: transform .05s ease, filter .15s ease;
}
.btn:active{ transform: translateY(1px); }
.btn--primary{
  background: linear-gradient(180deg, var(--primary), var(--primary2));
  color:#fff;
}
.btn--ghost{
  background:#ffffffaa;
  border:1px solid var(--border);
  color:var(--text);
}
.btn--danger{
  background: linear-gradient(180deg, #e15d5d, #c63f3f);
  color:#fff;
}
.btn--sm{
  font-size: 14px;
  padding: 9px 10px;
  border-radius: 12px;
}
.btn--xl{
  padding: 16px 14px;
  font-size: 20px;
  border-radius: 16px;
}

.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 8px 12px;
  border-radius: 999px;
  border:1px solid var(--border);
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
}
.pill--soft{ background:#ffffffbb; }
.pill--info{ background: rgba(42,123,214,.10); border-color: rgba(42,123,214,.25); }

.error{
  margin: 8px 0 0;
  color: var(--danger);
  font-weight: 800;
  min-height: 22px;
}

.hint{
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  border:1px dashed rgba(42,123,214,.35);
  background: rgba(255,255,255,.65);
}
.hint__title{ font-weight: 900; margin-bottom: 6px; }
.hint__list{ margin: 0; padding-left: 18px; color: var(--muted); }
.hint__note{ margin: 8px 0 0; color: var(--muted); }

.homeGrid{
  margin-top: 12px;
  display:grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}
@media (max-width:900px){
  .homeGrid{ grid-template-columns: 1fr 1fr; }
}
@media (max-width:540px){
  .homeGrid{ grid-template-columns: 1fr; }
}

.tile{
  background: #ffffffcc;
  border:1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  text-align:left;
  cursor:pointer;
  box-shadow: 0 10px 18px rgba(11, 40, 60, .06);
}
.tile:hover{ filter: brightness(1.01); }
.tile__icon{ font-size: 30px; }
.tile__title{ font-size: 20px; font-weight: 900; margin-top: 4px; }
.tile__desc{ color: var(--muted); margin-top: 4px; line-height:1.4; }
.tile--admin{ border-color: rgba(216, 74, 74, .35); }

.bigBox{
  background: #ffffffcc;
  border:1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
}
.bigBox__label{ color: var(--muted); font-size: 18px; }
.bigBox__value{ margin-top: 10px; font-size: 42px; font-weight: 1000; letter-spacing: .02em; }

.actions{
  margin-top: 14px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.footerBar{
  margin-top: 10px;
  display:flex;
  gap:8px;
  justify-content:flex-start;
  padding: 0 6px;
}

.taskMeta{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
  margin: 10px 0 10px;
}
.taskMeta__right{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.levelBox{
  margin: 10px 0 12px;
  padding: 12px;
  border-radius: 18px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.70);
}
.note{ margin-top: 6px; color: var(--muted); line-height: 1.45; font-weight: 800; }
.noteSmall{ margin-top: 8px; color: #567; font-weight: 800; font-size: 13px; }

.taskList{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-top: 12px;
}
.taskItem{
  border:1px solid var(--border);
  background:#ffffffcc;
  border-radius: 18px;
  padding: 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.taskLeft{ min-width: 0; }
.taskTitle{ font-weight: 1000; font-size: 18px; margin-bottom: 4px; }
.taskMetaLine{ color: var(--muted); display:flex; gap:10px; flex-wrap:wrap; }
.badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 13px;
  border:1px solid var(--border);
  background:#fff;
}
.badge--rehab{ background: rgba(46, 157, 92, .10); border-color: rgba(46,157,92,.25); }
.badge--social{ background: rgba(42, 123, 214, .10); border-color: rgba(42,123,214,.25); }

.taskBtnRow{
  display:flex;
  flex-direction:column;
  gap:8px;
  align-items:flex-end;
}
.btn--done{
  background: #e9eef3;
  border:1px solid var(--border);
  color: #678;
}

/* ✅ 達成率バー */
.progressRow{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  margin: 10px 0 8px;
}
.progressBar{
  flex: 1;
  min-width: 220px;
  height: 14px;
  background: #ffffffcc;
  border:1px solid var(--border);
  border-radius: 999px;
  overflow:hidden;
}
.progressBar__fill{
  height:100%;
  width:0%;
  background: linear-gradient(90deg, var(--primary), #55b6ff);
  border-radius: 999px;
}

/* Profile */
.profile{
  display:flex;
  gap:12px;
  align-items:flex-start;
  padding: 14px;
  border-radius: 18px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.75);
}
.avatar{
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display:grid;
  place-items:center;
  font-size: 26px;
  background: rgba(42,123,214,.10);
  border:1px solid rgba(42,123,214,.20);
}
.profile__main{ flex:1; min-width:0; }
.profile__nameRow{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
}
.profile__name{ font-size: 22px; font-weight: 1000; }
.profile__meta{ margin-top: 10px; display:flex; gap:14px; flex-wrap:wrap; }
.metaItem{
  padding: 10px 12px;
  border-radius: 14px;
  border:1px solid var(--border);
  background:#fff;
}
.metaLabel{ color: var(--muted); font-weight: 900; font-size: 12px; }
.metaValue{ font-weight: 1000; font-size: 16px; margin-top: 2px; }

.impression{
  margin-top: 12px;
  padding: 14px;
  border-radius: 18px;
  border:1px solid var(--border);
  background:#ffffffcc;
}
.impression__title{ font-weight: 1000; margin-bottom: 6px; }
.impression__body{ color: var(--text); line-height: 1.6; font-size: 18px; }

/* ✅ カレンダー */
.calendar{
  display:grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 10px;
}
.calCell{
  border:1px solid var(--border);
  border-radius: 12px;
  background:#fff;
  padding: 8px;
  min-height: 52px;
}
.calTop{
  display:flex;
  align-items:center;
  justify-content:space-between;
  font-weight: 1000;
  color:#345;
  font-size: 12px;
}
.calMark{
  display:inline-flex;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border:1px solid var(--border);
  background:#f6fbff;
}
.calMark--done{
  background: rgba(42,123,214,.18);
  border-color: rgba(42,123,214,.35);
}
.calHead{
  font-weight: 1000;
  color:#456;
  text-align:center;
  font-size: 12px;
}

/* ✅ 最近の履歴 */
.historyList{
  display:flex;
  flex-direction:column;
  gap:8px;
  margin-top: 10px;
}
.historyItem{
  border:1px solid var(--border);
  background:#fff;
  border-radius: 14px;
  padding: 10px 12px;
  color:#234;
}
.historyMeta{
  color:#567;
  font-weight: 900;
  font-size: 12px;
  margin-bottom: 4px;
}
.historyText{
  font-weight: 1000;
  line-height: 1.4;
}

/* Admin */
.adminTopGrid{
  display:grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 900px){
  .adminTopGrid{ grid-template-columns: 1fr 1fr; }
  .adminTopGrid .adminBox:last-child{ grid-column: 1 / -1; }
}
.adminBox{
  border:1px solid var(--border);
  background:#ffffffcc;
  border-radius: 18px;
  padding: 14px;
}
.adminBox__title{ font-weight: 1000; margin-bottom: 10px; }
.adminList{ display:flex; flex-direction:column; gap:10px; }
.adminForm{ display:flex; flex-direction:column; gap:10px; }

.select{
  border:1px solid var(--border);
  border-radius: 12px;
  padding: 10px 10px;
  background:#fff;
  font-weight: 900;
  font-size: 14px;
}
.logBox{
  margin-top: 8px;
  padding: 10px;
  border-radius: 14px;
  border:1px solid var(--border);
  background:#fff;
  min-height: 80px;
  max-height: 260px;
  overflow:auto;
  font-size: 14px;
  color:#234;
  line-height: 1.45;
}

/* Game */
.gamePanel{ display:flex; flex-direction:column; gap:12px; }
.betBox{
  padding: 12px;
  border:1px solid var(--border);
  border-radius: 18px;
  background: rgba(255,255,255,.75);
  display:flex;
  flex-direction:column;
  gap:8px;
}
.jankenBtns{
  display:grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap:10px;
}
@media (max-width:640px){
  .jankenBtns{ grid-template-columns: 1fr; }
}
.resultBox{
  padding: 14px;
  border-radius: 18px;
  border:1px solid var(--border);
  background:#ffffffcc;
  font-weight: 1000;
  font-size: 18px;
  line-height: 1.5;
}
.gameLog{
  padding: 12px;
  border-radius: 18px;
  border:1px solid var(--border);
  background:#ffffffcc;
  color:#345;
  font-size: 14px;
  max-height: 200px;
  overflow:auto;
}

/* Modal */
.modal{
  position:fixed;
  inset:0;
  display:none;
  z-index:50;
}
.modal.show{ display:block; }
.modal__backdrop{
  position:absolute; inset:0;
  background: rgba(0,0,0,.35);
}
.modal__panel{
  position:relative;
  max-width: 520px;
  margin: 80px auto 0;
  background:#fff;
  border-radius: 18px;
  border:1px solid var(--border);
  box-shadow: var(--shadow);
  overflow:hidden;
}
@media (max-width:560px){
  .modal__panel{ margin: 60px 16px 0; }
}
.modal__head{
  padding: 12px 14px;
  border-bottom:1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  background: linear-gradient(180deg, #f7fbff, #ffffff);
}
.modal__title{ font-weight: 1000; }
.modal__body{ padding: 14px; }
.staffGrid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.staffBtn{
  border:1px solid var(--border);
  background:#fff;
  border-radius: 14px;
  padding: 12px;
  font-weight: 1000;
  cursor:pointer;
}
.staffBtn.active{
  border-color: rgba(42,123,214,.6);
  box-shadow: 0 0 0 4px rgba(42,123,214,.12);
}
.spacer{ height: 10px; }

.toast{
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 20px;
  background: rgba(18, 34, 51, .92);
  color:#fff;
  padding: 12px 16px;
  border-radius: 999px;
  font-weight: 1000;
  display:none;
  z-index: 60;
  max-width: 92vw;
  text-align:center;
}
.toast.show{ display:block; }

/* ===== 勝利アニメーション ===== */
@keyframes pop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.06); }
  70%  { transform: scale(0.99); }
  100% { transform: scale(1); }
}
@keyframes shine {
  0%   { box-shadow: 0 0 0 rgba(42,123,214,.00); }
  50%  { box-shadow: 0 0 0 8px rgba(42,123,214,.18); }
  100% { box-shadow: 0 0 0 rgba(42,123,214,.00); }
}
@keyframes shake {
  0% { transform: translateX(0); }
  20% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
  100% { transform: translateX(0); }
}
.resultBox.win { animation: pop 420ms ease, shine 700ms ease; }
.resultBox.lose { animation: shake 420ms ease; }
.resultBox.draw { animation: pop 360ms ease; }

.fx {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 80;
}
.fx__sparkle {
  position: absolute;
  top: -10%;
  font-size: 26px;
  opacity: .95;
  animation: fall 900ms ease-in forwards;
}
@keyframes fall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 0; }
  15%  { opacity: 1; }
  100% { transform: translateY(120vh) rotate(220deg); opacity: 0; }
}
/* ===== Admin Dashboard / Weekly Report ===== */
.dashList{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-top: 10px;
}

.dashCard{
  border:1px solid var(--border);
  background:#fff;
  border-radius: 16px;
  padding: 12px;
}

.dashTop{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
}

.dashName{
  font-weight: 1000;
  font-size: 16px;
}

.dashRow{
  margin-top: 10px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.badge2{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding: 8px 10px;
  border-radius: 999px;
  font-weight: 1000;
  font-size: 13px;
  border:1px solid var(--border);
  background:#f7fbff;
}

.badge2--ok{ background: rgba(46,157,92,.10); border-color: rgba(46,157,92,.25); }
.badge2--warn{ background: rgba(216,74,74,.10); border-color: rgba(216,74,74,.25); }

.reportBox{
  margin-top: 10px;
  border:1px solid var(--border);
  background:#fff;
  border-radius: 16px;
  padding: 12px;
  line-height: 1.6;
}

.reportGrid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
  margin-top: 10px;
}

@media (max-width: 640px){
  .reportGrid{ grid-template-columns: 1fr; }
}

.reportItem{
  border:1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  background:#f7fbff;
}

.reportLabel{
  font-weight: 1000;
  color:#456;
  font-size: 12px;
}

.reportValue{
  font-weight: 1000;
  font-size: 18px;
  margin-top: 4px;
}

body.sky-day   { background: linear-gradient(180deg, #bfe7ff 0%, #f7fbff 60%, #ffffff 100%); }
body.sky-sunset{ background: linear-gradient(180deg, #ffd1a6 0%, #ff9fb1 55%, #fff3e6 100%); }
body.sky-night { background: linear-gradient(180deg, #0b1630 0%, #132c5a 60%, #1b3b7a 100%); }
