/* ほのぼのタイムカード ブラウザ版（Android版 Theme.kt の配色・フォントを引き継ぐ） */
:root {
  --cream: #FBF3E3;
  --paper: #FFF8EA;
  --orange: #F2994A;
  --orange-dark: #D97B2E;
  --orange-soft: #FCD9B0;
  --surface-variant: #FFF3DC;
  --sky: #CDE9F6;
  --ink: #3B2F2A;
  --brown: #8B5A2B;
  --muted: #8a7a70;
  --error: #C8473A;
  --line-green: #06C755;
  --discord: #5865F2;
  --sidebar-w: 270px;
  --rightbar-w: 290px;
  --emph: 'Mochiy Pop One', 'Zen Maru Gothic', sans-serif;
  --body: 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', 'Meiryo', sans-serif;
  --shadow: 0 4px 14px rgba(120, 80, 40, .12);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--body);
  font-weight: 700;
  color: var(--ink);
  background-color: var(--sky);
  /* PC用の横長背景（img/bg_pc.webp）を置くと自動で使われる。無い間はAndroid版の背景を並べて表示する。 */
  background-image: url(../img/bg_pc.webp), url(../img/bg_default.webp);
  background-size: cover, 560px auto;
  background-position: center, top left;
  background-repeat: no-repeat, repeat;
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  line-height: 1.6;
}
img { max-width: 100%; }
button { font-family: inherit; font-weight: 700; color: inherit; }
a { color: var(--orange-dark); }
svg { width: 100%; height: 100%; display: block; }
p { margin: .5em 0; }
small { font-size: .78em; }
.small { font-size: .85rem; }
.center { text-align: center; }
.accent { color: var(--orange-dark); }
.muted { color: var(--muted); }
.danger-text { color: var(--error); }
.caution { color: var(--brown); }

/* ---------- 全体レイアウト（PC） ---------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--rightbar-w);
  min-height: 100vh;
  transition: grid-template-columns .25s;
}
body.sidebar-collapsed { --sidebar-w: 92px; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 10px;
  padding: 18px 16px;
  background: rgba(251, 243, 227, .94);
  box-shadow: 2px 0 12px rgba(120, 80, 40, .1);
  overflow: hidden auto;
}
.logo { display: block; padding: 4px 0 10px; margin: 0 -9px; }
.logo-full { width: 100%; display: block; }
.logo-mini { display: none; width: 56px; height: 56px; border-radius: 16px; margin: 0 auto; }
body.sidebar-collapsed .logo-full { display: none; }
body.sidebar-collapsed .logo-mini { display: block; }

.side-nav { display: flex; flex-direction: column; gap: 10px; }
.nav-item {
  display: flex; align-items: center; gap: 16px;
  padding: 13px 18px; border-radius: 18px;
  text-decoration: none; color: var(--ink); font-size: 1.15rem;
  background: rgba(255, 255, 255, .7);
  box-shadow: 0 2px 6px rgba(120, 80, 40, .08);
  transition: background .15s, transform .1s;
}
.nav-item:hover { background: #fff; }
.nav-item:active { transform: scale(.98); }
.nav-item.active { background: linear-gradient(180deg, #FCD3A5, #F8BE84); }
.nav-icon { width: 30px; height: 30px; flex: none; color: var(--orange); display: inline-block; }
.nav-item.active .nav-icon { color: var(--orange-dark); }
body.sidebar-collapsed .nav-item { justify-content: center; padding: 13px 0; }
body.sidebar-collapsed .nav-label { display: none; }

.collapse-btn {
  margin-top: auto; display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; background: transparent; color: var(--brown); cursor: pointer; padding: 10px; border-radius: 12px; font-size: .85rem;
}
.collapse-btn:hover { background: rgba(255, 255, 255, .6); }
.collapse-arrow { width: 20px; height: 20px; display: inline-block; transition: transform .25s; }
body.sidebar-collapsed .collapse-arrow { transform: rotate(180deg); }

.main { padding: 28px 28px 90px; min-width: 0; }
#view { max-width: 960px; margin: 0 auto; }

.rightbar { padding: 24px 18px 24px 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.rightbar .link-list {
  background: rgba(251, 243, 227, .8); border-radius: 26px; padding: 14px; box-shadow: var(--shadow);
}

/* ---------- リンク（公式サイト・Discord・LINE・コーヒー） ---------- */
.link-list { display: flex; flex-direction: column; gap: 12px; }
.link-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 14px; border-radius: 20px; border: 0; width: 100%; text-align: left;
  background: #fff; box-shadow: 0 2px 8px rgba(120, 80, 40, .1);
  color: var(--ink); text-decoration: none; cursor: pointer; font-size: 1rem;
  transition: transform .1s, box-shadow .15s;
}
.link-card:hover { box-shadow: 0 4px 14px rgba(120, 80, 40, .18); }
.link-card:active { transform: scale(.98); }
.link-icon { width: 46px; height: 46px; flex: none; }
.link-icon.globe { color: #2F7FD8; }
.link-icon.discord { color: var(--discord); }
.link-icon.line { color: var(--line-green); }
.link-icon.cup { color: var(--brown); width: 30px; height: 30px; }
.link-text { flex: 1; display: flex; flex-direction: column; line-height: 1.35; }
.link-text small { color: var(--muted); margin-top: 4px; }
.chev { width: 18px; height: 18px; color: var(--ink); flex: none; }
.link-card.coffee { padding: 9px 14px; font-size: .85rem; background: #FFF6E8; }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 24px; border-radius: 999px;
  border: 2px solid transparent; cursor: pointer; font-size: 1rem; text-decoration: none;
  transition: transform .08s, filter .15s, background .15s;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--orange); color: #fff; box-shadow: 0 3px 0 var(--orange-dark); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.05); }
.btn.outline { background: #fff; color: var(--orange-dark); border-color: var(--orange-dark); }
.btn.text { background: transparent; color: var(--orange-dark); padding: 10px 14px; }
.btn.soft { background: var(--surface-variant); border: 1px solid var(--orange-dark); color: var(--ink); min-height: 40px; }
.btn.wide { width: 100%; margin-top: 12px; }
.btn.fixed { width: 140px; }
.btn.big { min-height: 64px; font-size: 1.3rem; padding: 12px 40px; }
.btn.small-btn { min-height: 38px; padding: 6px 16px; }
.btn.themed { color: var(--theme); border-color: var(--theme); }
.plus { width: 34px; height: 34px; border-radius: 50%; background: #fff; color: var(--orange); padding: 6px; display: inline-block; }
.btn-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.icon-btn {
  width: 40px; height: 40px; border: 0; background: transparent; padding: 8px; border-radius: 50%;
  color: var(--orange-dark); cursor: pointer; flex: none; font-size: 1.3rem; line-height: 1;
}
.icon-btn:hover { background: rgba(242, 153, 74, .14); }
.icon-btn.danger { color: var(--error); }
.icon-btn.themed { color: var(--theme); }
.back-link { align-self: flex-start; border: 0; background: none; cursor: pointer; font-family: var(--emph); font-size: 1.2rem; color: var(--ink); padding: 8px 4px; margin-top: 8px; }
.clickable { cursor: pointer; }

/* ---------- ホーム ---------- */
.home { display: flex; flex-direction: column; align-items: center; }
.mobile-logo { display: none; }
.home-heading { margin: 4px 0 22px; width: min(560px, 90%); }
.home-heading img { width: 100%; display: block; }
.blink { animation: blink 1.536s linear infinite alternate; }
@keyframes blink { from { opacity: .35; } to { opacity: 1; } }

.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; width: 100%; }
.card-grid.single { grid-template-columns: minmax(0, 440px); justify-content: center; }
.tc-card {
  position: relative; display: flex; align-items: center; gap: 8px;
  background: var(--paper); border: 3px solid var(--orange); border-radius: 26px;
  padding: 22px 18px 20px 26px; box-shadow: var(--shadow); min-height: 170px;
  transition: transform .12s, box-shadow .15s;
}
.tc-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(120, 80, 40, .18); }
.tc-info { flex: 1; min-width: 0; }
.tc-info h3 { font-family: var(--emph); font-weight: 400; font-size: 1.7rem; margin: 0 40px 2px 0; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-wage { font-size: 1.15rem; padding-bottom: 10px; margin-bottom: 10px; border-bottom: 2px solid #F0DCC0; }
.tc-total { display: flex; flex-direction: column; }
.tc-total-label { display: flex; align-items: center; gap: 8px; font-size: .95rem; color: #5a4a40; }
.tc-total-label svg { width: 22px; height: 22px; }
.tc-total-value { font-family: var(--emph); font-weight: 400; font-size: 1.6rem; padding-left: 30px; }
.tc-total-value small { font-size: .75em; }
.tc-chara { position: relative; flex: none; width: 110px; display: flex; justify-content: center; }
.tc-chara img { height: 112px; width: auto; }
.working-badge {
  position: absolute; left: -26px; top: -10px; transform: rotate(-14deg);
  background: #fff; border: 1.5px solid var(--orange); color: var(--orange); border-radius: 8px;
  font-size: .62rem; line-height: 1.15; padding: 3px 6px; text-align: center; box-shadow: 0 2px 4px rgba(0, 0, 0, .12);
}
.working-badge.rest { color: #4A8BC0; border-color: #4A8BC0; }
.tc-edit { position: absolute; top: 10px; right: 10px; }
.add-btn { margin-top: 26px; min-width: min(560px, 100%); }

/* お知らせ */
.notices { width: 100%; max-width: 860px; margin: 26px auto 0; display: flex; flex-direction: column; gap: 14px; }
.release-banner {
  display: flex; align-items: center; justify-content: center; gap: 18px;
  background: rgba(255, 248, 234, .95); border-radius: 22px; padding: 10px 24px; box-shadow: var(--shadow);
  font-family: var(--emph); font-size: clamp(1.25rem, 3.2vw, 2rem); color: #E0452F; text-decoration: none;
  width: min(620px, 100%); margin: 0 auto;
}
.release-banner img { height: 64px; width: auto; }
.release-banner.released { color: var(--orange-dark); }
.release-banner.released small { display: block; font-family: var(--body); font-size: .9rem; color: var(--ink); }
.notice {
  display: flex; gap: 14px; align-items: flex-start;
  background: rgba(255, 255, 255, .92); border-radius: 22px; padding: 14px 20px; box-shadow: var(--shadow); font-size: .9rem;
}
.notice-icon { width: 34px; height: 34px; flex: none; color: #F6C343; margin-top: 2px; }
.notice ul { margin: 0; padding-left: 1.1em; }
.notice li + li { margin-top: 4px; }

/* ---------- 各画面の共通パネル ---------- */
.panel {
  max-width: 640px; margin: 0 auto;
  background: rgba(251, 243, 227, .93); border-radius: 30px; padding: 28px 30px 30px; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.screen-title { font-family: var(--emph); font-weight: 400; font-size: 1.6rem; margin: 0 0 6px; line-height: 1.35; }
.screen-title.center { text-align: center; }
.title-row { display: flex; align-items: center; gap: 6px; width: 100%; }
.title-row .screen-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; }
.sub-title { font-family: var(--emph); font-weight: 400; font-size: 1.05rem; margin: 16px 0 6px; }

/* 計測画面 */
.card-screen { align-items: center; text-align: center; }
.speech {
  position: relative; background: var(--surface-variant); border-radius: 22px; padding: 8px 18px; margin-top: 10px; font-size: 1.05rem;
}
.speech::after {
  content: ''; position: absolute; left: 50%; bottom: -9px; margin-left: -9px;
  border: 9px solid transparent; border-top-color: var(--surface-variant); border-bottom: 0;
}
.chara-main { height: 170px; width: auto; margin: 14px 0; }
.status { font-family: var(--emph); font-size: 1.3rem; margin-top: 14px; }
.elapsed { font-family: var(--emph); font-size: 2.6rem; line-height: 1.2; }
.amount { font-size: 1.2rem; }
.main-actions .btn { min-width: 130px; }
.main-actions .btn.wide { margin-top: 0; }

.picker { display: flex; gap: 14px; overflow-x: auto; width: 100%; padding: 12px 4px 10px; scroll-snap-type: x proximity; }
.picker-item { flex: none; width: 92px; border: 0; background: none; cursor: pointer; padding: 0; display: flex; flex-direction: column; align-items: center; scroll-snap-align: start; }
.picker-img {
  position: relative; width: 84px; height: 84px; border-radius: 26px; background: #fff;
  border: 1px solid var(--orange-dark); display: flex; align-items: center; justify-content: center; padding: 4px;
}
.picker-item.selected .picker-img { border: 3px solid var(--orange); }
.picker-img img { max-height: 70px; width: auto; }
.picker-img .lock { position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; padding: 4px; background: var(--surface-variant); border-radius: 50%; color: var(--brown); }
.picker-name { font-size: .78rem; margin-top: 4px; line-height: 1.3; }
.picker-pack { font-size: .7rem; color: var(--muted); }

/* カード切り替え */
.card-switcher { position: relative; display: block; margin: 10px 0 6px; }
.card-switcher select {
  width: 100%; appearance: none; -webkit-appearance: none; font: inherit; color: var(--ink);
  padding: 11px 44px 11px 18px; border-radius: 20px; border: 1px solid var(--orange-dark); background: var(--surface-variant); cursor: pointer;
}
.card-switcher .caret { position: absolute; right: 14px; top: 50%; width: 24px; height: 24px; margin-top: -12px; pointer-events: none; }

/* 記録一覧 */
.history-list { display: flex; flex-direction: column; gap: 10px; margin: 14px 0 6px; }
.history-item {
  position: relative; display: flex; align-items: center; gap: 8px;
  background: #fff; border-radius: 20px; padding: 14px 16px; box-shadow: 0 2px 6px rgba(120, 80, 40, .1);
}
.h-info { flex: 1; min-width: 0; padding-right: 30px; }
.h-info h3 { font-family: var(--emph); font-weight: 400; margin: 0; font-size: 1.15rem; }
.h-chara { height: 56px; width: auto; }
.h-delete { position: absolute; top: 6px; right: 6px; }
.empty { text-align: center; color: var(--muted); padding: 20px 0; }

/* カレンダー */
.seg { display: flex; gap: 8px; margin: 10px 0; }
.seg-btn {
  flex: 1; min-height: 42px; border-radius: 999px; border: 1.5px solid var(--theme, var(--orange-dark));
  background: #fff; color: var(--theme, var(--orange-dark)); cursor: pointer; font-size: 1rem; padding: 6px 14px;
}
.seg-btn.on { background: var(--theme, var(--orange)); border-color: var(--theme, var(--orange)); color: #fff; }
.period-row { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.period-label { flex: 1; text-align: center; color: var(--theme); font-size: 1.05rem; }
.totals { display: flex; margin: 12px 0 4px; }
.totals > div { flex: 1; text-align: center; display: flex; flex-direction: column; }
.totals b { color: var(--theme); font-size: 1.15rem; }
.week-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.week-row { display: flex; align-items: center; gap: 16px; padding: 10px 12px; border-radius: 14px; border: 1px solid; }
.week-row.today { border-width: 2px; }
.week-day { width: 48px; height: 48px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; flex: none; }
.week-info { display: flex; flex-direction: column; }
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 12px; }
.month-wd { text-align: center; font-size: .9rem; }
.month-cell { aspect-ratio: 1; max-height: 60px; width: 100%; border-radius: 10px; border: 2px solid transparent; cursor: pointer; font-size: .95rem; color: var(--ink); background: transparent; }
.month-cell.out { color: rgba(59, 47, 42, .35); }
.month-cell.dark { color: #fff; }
.month-cell:hover { outline: 2px solid rgba(0, 0, 0, .08); }

/* 設定 */
.settings-screen { gap: 14px; }
.s-card { background: #fff; border-radius: 22px; padding: 18px 20px; box-shadow: 0 2px 6px rgba(120, 80, 40, .08); }
.s-card h2 { font-family: var(--emph); font-weight: 400; font-size: 1.2rem; margin: 0 0 6px; }
.s-card > .btn { display: flex; margin: 12px auto 0; }
.s-card > .btn.wide { margin-top: 0; }
.lineup { display: flex; gap: 6px; overflow-x: auto; margin-top: 8px; }
.lineup img { height: 52px; width: auto; }
.switch-row, .range-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 10px; }
.range-row input { flex: 1; max-width: 70%; accent-color: var(--orange); }
.switch { appearance: none; -webkit-appearance: none; width: 52px; height: 30px; border-radius: 999px; background: #d9cfc6; position: relative; cursor: pointer; transition: background .2s; flex: none; margin: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.switch:checked { background: var(--orange); }
.switch:checked::after { left: 25px; }

.simple-screen .btn.primary:not(.wide):not(.pill-btn) { align-self: flex-start; margin-top: 10px; }
.color-list { margin: 14px 0; }
.color-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.swatch { width: 36px; height: 36px; border-radius: 50%; flex: none; }
.color-name { flex: 1; }
.pill-btn { width: 96px; min-height: 40px; padding: 6px; }
.pill-btn svg { width: 18px; height: 18px; }

/* 入力欄 */
.field { display: flex; flex-direction: column; gap: 4px; margin-top: 14px; font-size: .9rem; }
.field input {
  font: inherit; font-size: 1.05rem; padding: 11px 14px; border-radius: 12px; border: 1.5px solid #cdb9a6; background: #fff; color: var(--ink);
}
.field input:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(242, 153, 74, .25); }
.field-error { color: var(--error); font-size: .85rem; margin: 6px 0 0; }
.hm-inputs { display: flex; gap: 10px; }
.small-field { width: 100px; margin-top: 8px; }
.label { margin: 14px 0 0; }

/* ---------- ダイアログ ---------- */
.dlg-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(40, 30, 20, .42);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
@keyframes fade { from { opacity: 0; } }
.dlg {
  width: min(440px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--cream); border-radius: 28px; padding: 24px 24px 16px; box-shadow: 0 16px 40px rgba(0, 0, 0, .25);
  animation: pop .18s ease-out;
}
@keyframes pop { from { transform: scale(.96); } }
.dlg-title { font-family: var(--emph); font-weight: 400; font-size: 1.3rem; margin: 0 0 8px; }
.dlg-body { font-size: 1rem; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.dlg-actions .btn { min-height: 42px; padding: 8px 20px; }
.dlg-stack { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin-top: 14px; }
.center-dlg { text-align: center; }
.chara-finish { height: 110px; width: auto; }
.adj-row { display: flex; align-items: center; justify-content: space-between; }
.notice-text { background: #fff; border-radius: 12px; padding: 10px 12px; }
.big-time { font-family: var(--emph); font-size: 1.8rem; margin: 4px 0; }
.share-text { width: 100%; font: inherit; padding: 10px; border-radius: 12px; border: 1px solid #cdb9a6; resize: none; }

/* アラームの時刻ホイール */
.wheel-box { position: relative; }
.wheel-box::after { content: ''; position: absolute; left: 0; right: 0; top: 52px; height: 52px; border: 2px solid var(--orange); border-radius: 8px; pointer-events: none; }
.wheel-wrap { display: flex; align-items: center; justify-content: center; gap: 16px; text-align: center; }
.wheel-wrap small { display: block; margin-top: 4px; }
.colon { font-family: var(--emph); font-size: 1.6rem; }
.wheel {
  width: 96px; height: 156px; overflow-y: scroll; scroll-snap-type: y mandatory; scrollbar-width: none;
  position: relative; border-radius: 12px; background: #fff;
}
.wheel::-webkit-scrollbar { display: none; }
.wheel-pad { height: 52px; }
.wheel-item { height: 52px; line-height: 52px; scroll-snap-align: center; font-size: 1.3rem; color: var(--muted); cursor: pointer; }
.wheel-item.sel { font-family: var(--emph); font-size: 1.9rem; color: var(--orange); }

.stepper-row { display: flex; justify-content: center; gap: 30px; }
.stepper { display: flex; flex-direction: column; align-items: center; }
.stepper b { font-family: var(--emph); font-weight: 400; font-size: 1.7rem; }

/* ---------- アラーム・タイマーの残り時間表示 ---------- */
.countdowns {
  position: fixed; z-index: 40; top: 14px; right: calc(var(--rightbar-w) + 16px);
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
}
.cd-badge {
  display: flex; flex-direction: column; align-items: center; background: var(--error); color: #fff;
  border: 0; border-radius: 12px; padding: 6px 12px; box-shadow: 0 3px 8px rgba(0, 0, 0, .2); cursor: pointer; line-height: 1.3;
}
.cd-badge small { font-size: .7rem; }
.cd-badge b { font-size: 1.1rem; }
.cd-badge.ringing { cursor: default; }
.cd-badge.ringing span { display: flex; gap: 8px; margin-top: 4px; }
.cd-badge.ringing button { border: 0; background: #fff; color: var(--error); border-radius: 8px; padding: 6px 12px; cursor: pointer; font-family: var(--emph); }

/* ---------- 共有ボタン ---------- */
.share-fab {
  position: fixed; z-index: 30; right: 18px; bottom: 18px;
  width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--orange); background: #fff; color: var(--orange-dark);
  padding: 10px; cursor: pointer; box-shadow: 0 3px 10px rgba(0, 0, 0, .18);
}
.share-fab:hover { background: #FFF3DC; }

.toast {
  position: fixed; z-index: 60; left: 50%; bottom: 90px; transform: translate(-50%, 20px);
  background: rgba(59, 47, 42, .92); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: .9rem;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- チュートリアル ---------- */
.tutorial { position: fixed; inset: 0; z-index: 70; background: #fff; display: flex; flex-direction: column; }
.tutorial[hidden] { display: none; }
.tut-inner { position: relative; flex: 1; overflow: hidden; }
.tut-track { display: flex; height: 100%; transition: transform .3s; }
.tut-page { flex: none; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 12px; }
.tut-page img { max-height: 100%; max-width: 100%; object-fit: contain; }
.tut-skip { position: absolute; top: 20px; right: 20px; background: rgba(0, 0, 0, .35); color: #fff; border: 0; border-radius: 999px; padding: 8px 16px; cursor: pointer; }
.tut-arrow { position: absolute; top: 50%; width: 48px; height: 48px; margin-top: -24px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .3); color: #fff; padding: 12px; cursor: pointer; }
.tut-arrow.left { left: 16px; }
.tut-arrow.right { right: 16px; }
.tut-foot { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 14px 0 calc(16px + var(--safe-b)); }
.tut-dots { display: flex; gap: 8px; background: rgba(0, 0, 0, .35); padding: 8px 14px; border-radius: 999px; }
.tut-dots span { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, .4); }
.tut-dots span.on { background: var(--orange-dark); }

/* ---------- スマホ・タブレット ---------- */
.bottombar { display: none; }
.mobile-only { display: none; }

@media (max-width: 1180px) and (min-width: 861px) {
  :root { --rightbar-w: 250px; }
  .card-grid { grid-template-columns: minmax(0, 1fr); }
  .card-grid.single { grid-template-columns: minmax(0, 440px); }
}

@media (max-width: 860px) {
  :root { --rightbar-w: 0px; }
  body { background-image: url(../img/bg_default.webp); background-size: cover; background-repeat: no-repeat; background-position: center top; }
  body[data-screen="home"] { background-image: url(../img/bg_home.webp); }
  .layout { display: block; }
  .sidebar, .rightbar { display: none; }
  .main { padding: 12px 16px calc(96px + var(--safe-b)); }
  .mobile-only { display: block; }
  .link-list.mobile-only { display: flex; }
  .pc-br { display: none; }

  .mobile-logo { display: block; width: 98%; margin: 4px auto 0; }
  .home-heading { width: 80%; margin: 4px 0 14px; }
  .card-grid, .card-grid.single { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .tc-card { min-height: 0; padding: 14px 12px 14px 16px; border-width: 2px; border-radius: 22px; background: var(--surface-variant); border-color: var(--orange-dark); }
  .tc-info h3 { font-size: 1.2rem; }
  .tc-wage { font-size: .95rem; padding-bottom: 4px; margin-bottom: 4px; }
  .tc-total { flex-direction: row; align-items: baseline; gap: 6px; flex-wrap: wrap; }
  .tc-total-label { font-size: .85rem; gap: 4px; }
  .tc-total-label svg { width: 16px; height: 16px; }
  .tc-total-value { font-size: 1.05rem; padding-left: 0; }
  .tc-chara { width: 70px; }
  .tc-chara img { height: 60px; }
  .tc-edit { top: 4px; right: 4px; }
  .btn.big.add-btn { min-width: 0; width: 100%; margin-top: 14px; min-height: 52px; font-size: 1.05rem; padding: 10px 16px; }
  .plus { width: 26px; height: 26px; padding: 5px; }

  .link-list.mobile-only, .settings-screen .link-list { margin-top: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
  .link-card { padding: 10px; gap: 8px; border-radius: 16px; font-size: .85rem; }
  .link-icon { width: 32px; height: 32px; }
  .link-text small { display: none; }
  .chev { display: none; }
  .link-card.coffee { padding: 10px; font-size: .8rem; }

  .notices { margin-top: 18px; }
  .release-banner { font-size: 1.2rem; padding: 8px 14px; gap: 10px; }
  .release-banner img { height: 46px; }
  .notice { padding: 12px 14px; font-size: .82rem; }
  .notice-icon { width: 26px; height: 26px; }

  .panel { background: transparent; box-shadow: none; padding: 10px 6px; border-radius: 0; }
  .list-screen .history-list { margin-top: 12px; }
  .chara-main { height: 140px; }

  .bottombar {
    display: flex; position: fixed; z-index: 35; left: 0; right: 0; bottom: 0;
    background: #fff; box-shadow: 0 -2px 10px rgba(0, 0, 0, .08); padding: 6px 4px calc(6px + var(--safe-b));
  }
  .bottombar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none;
    color: var(--orange-dark); font-size: .75rem; padding: 4px 0;
  }
  .bottombar .nav-icon { width: 46px; height: 30px; padding: 3px 11px; border-radius: 999px; color: var(--orange-dark); }
  .bottombar a.active { color: var(--orange); }
  .bottombar a.active .nav-icon { background: var(--surface-variant); color: var(--orange); }

  .countdowns { top: 10px; right: 10px; }
  .share-fab { right: 14px; bottom: calc(84px + var(--safe-b)); width: 40px; height: 40px; padding: 8px; }
  .toast { bottom: calc(140px + var(--safe-b)); }
  .tut-arrow { display: none; }
}

/* 購入の復元コード */
.key-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.purchase-key { font-family: ui-monospace, Consolas, monospace; font-size: 1.1rem; letter-spacing: .05em; background: var(--surface-variant); padding: 6px 12px; border-radius: 10px; }

/* 特定商取引法に基づく表記へのリンク */
.legal-link { text-align: center; font-size: .8rem; margin: 14px 0 0; }
.legal-link a { color: var(--brown); }
.rightbar .legal-link { margin-top: 12px; }

/* アラーム時刻の入力（直接入力・マウスホイール・上下の数字クリック） */
.tp-hint { display: flex; gap: 8px; align-items: flex-start; background: #fff; border-radius: 12px; padding: 8px 12px; font-size: .82rem; margin: 6px 0 10px; }
.tp-hint svg { width: 18px; height: 18px; flex: none; color: var(--orange-dark); margin-top: 2px; }
.tp-wrap { display: flex; align-items: center; justify-content: center; gap: 14px; }
.tp-col { display: flex; flex-direction: column; align-items: center; gap: 4px; touch-action: none; user-select: none; }
.tp-near { border: 0; background: transparent; color: var(--muted); font-size: 1.15rem; width: 96px; height: 34px; border-radius: 10px; cursor: pointer; }
.tp-near:hover { background: rgba(242, 153, 74, .12); color: var(--orange-dark); }
.tp-field { position: relative; display: block; cursor: text; }
.tp-input {
  width: 104px; height: 64px; text-align: center; font-family: var(--emph); font-size: 2.1rem; color: var(--orange-dark);
  background: #fff; border: 2.5px solid var(--orange); border-radius: 14px; padding: 0 22px 0 6px; caret-color: var(--orange-dark);
  box-shadow: inset 0 2px 4px rgba(120, 80, 40, .08);
}
.tp-input:hover { border-color: var(--orange-dark); }
.tp-input:focus { outline: none; border-color: var(--orange-dark); box-shadow: 0 0 0 4px rgba(242, 153, 74, .28); background: #FFFDF8; }
.tp-pen { position: absolute; right: 8px; bottom: 8px; width: 16px; height: 16px; color: var(--orange); pointer-events: none; }
.tp-col small { margin-top: 2px; }

/* 開発者にコーヒーを奢るボタン（画像） */
.coffee-btn { display: block; width: 100%; border: 0; padding: 0; background: none; cursor: pointer; transition: transform .1s, filter .15s; }
.coffee-btn img { display: block; width: 100%; height: auto; }
.coffee-btn:hover { filter: brightness(1.05); }
.coffee-btn:active { transform: scale(.98); }
.rightbar .coffee-btn { width: 88%; margin: 0 auto; }

/* ホームのお知らせは画面のいちばん下へ */
section.home { min-height: calc(100vh - 56px); }
section.home .notices { margin-top: auto; padding-top: 26px; }
.card-screen .notices { margin-top: 22px; }

@media (max-width: 860px) {
  .link-list.mobile-only .coffee-btn, .settings-screen .link-list .coffee-btn { grid-column: 1 / -1; width: 80%; margin: 4px auto 0; }
  section.home { min-height: calc(100vh - 108px); }
}
.card-screen .notice { text-align: left; width: 100%; }
.card-screen .notice p { margin: 0; }

/* 記録・カレンダー画面の案内は、カードの外・ページの最下部に置く */
.page-bottom { max-width: 640px; margin: 0 auto; }
.page-bottom .notices { margin-top: 24px; }
#view:has(> .page-bottom) { min-height: calc(100vh - 56px); display: flex; flex-direction: column; }
#view:has(> .page-bottom) > .page-bottom { margin-top: auto; width: 100%; }
#view:has(> .page-bottom) > .panel { width: 100%; }
@media (max-width: 860px) {
  #view:has(> .page-bottom) { min-height: calc(100vh - 108px); }
}

/* PC版の共有ポップアップ */
.share-box { background: #fff; border-radius: 14px; padding: 14px 16px; }
.share-box p { margin: 0; }
.share-url { margin-top: 4px !important; word-break: break-all; color: var(--orange-dark); user-select: all; }

@media (max-width: 860px) {
  /* スマホ：タイムカードで作業する画面では共有ボタンを出さない */
  body[data-screen="card"] .share-fab { display: none; }
}

/* 「ほのぼのタイムカードとは？」への小さな文字リンク（公式サイトボタンのすぐ上） */
.about-link { align-self: flex-start; font-size: .85rem; color: var(--orange-dark); text-decoration: underline; text-underline-offset: 3px; margin: 0 0 -4px 6px; }
.about-link:hover { color: var(--brown); }
@media (max-width: 860px) {
  .link-list.mobile-only .about-link, .settings-screen .link-list .about-link { grid-column: 1 / -1; margin: 0 0 -2px 4px; }
}

/* 下部メニュー（5項目：ホーム｜リマインド｜記録｜カレンダー｜設定）。すべて同じ幅・高さ・文字サイズにし、文字を1行に収める */
@media (max-width: 860px) {
  .bottombar a { flex: 1 1 0; min-width: 0; font-size: .72rem; line-height: 1.2; white-space: nowrap; }
  .bottombar .nav-icon { width: 44px; height: 30px; padding: 3px 10px; }
}
@media (max-width: 360px) {
  .bottombar a { font-size: .64rem; }
  .bottombar .nav-icon { width: 40px; padding: 3px 9px; }
}

/* ホーム画面のGoogle Playバナー（画像の縦横比を保ったまま、幅に合わせて縮小） */
.play-banner { display: block; width: min(620px, 100%); margin: 0 auto; border-radius: 22px; transition: transform .1s, filter .15s; }
.play-banner img { display: block; width: 100%; height: auto; }
.play-banner:hover { filter: brightness(1.03); }
.play-banner:active { transform: scale(.99); }
