/* css/windows.css - 各ウィンドウの中身（ストレージ・ログ・決算・ターミナル・エンディング・通知） */

.win-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 6px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* 案内（Day1 など）: 黄色い吹き出し */
.guidance-banner {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  padding: 0.55rem 0.75rem;
  background: var(--balloon);
  box-shadow: 1px 1px 0 var(--face-dk), inset 0 0 0 1px var(--face-lo);
  font-size: 0.9rem;
  line-height: 1.5;
}

.storage-list-hint {
  font-size: 0.8rem;
  color: var(--ink-muted);
  padding: 0 0.2rem;
}

/* ===================================================
   ストレージ: ファイル一覧（エクスプローラーの詳細表示）
   =================================================== */
.file-list-container {
  flex: 1 1 auto;
  min-height: 7rem;
  overflow-y: auto;
  background: var(--field);
  box-shadow: var(--sunken);
  padding: 3px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
  border-bottom: 1px dotted #cfcac0;
  touch-action: manipulation;
}

.file-item:hover {
  background: #e9eef8;
}

.file-item.selected {
  background: var(--sel);
  color: var(--sel-ink);
}

.file-item.selected .file-tag {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}

.file-item.deleted .file-name,
.file-item.deleted .file-size-badge {
  text-decoration: line-through;
  opacity: 0.55;
}

.file-icon {
  flex-shrink: 0;
  width: 1.6rem;
  text-align: center;
  font-size: 1.1rem;
}

.file-info-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.file-name {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.file-tags-row:empty {
  display: none;
}

.file-tag {
  font-size: 0.72rem;
  line-height: 1.4;
  padding: 0 0.35rem;
  background: #e7ecf6;
  color: var(--accent);
  border: 1px solid #b9c6e2;
}

.file-tag.emotion-tag {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #e3a29d;
}

.file-tag.lock-tag {
  background: var(--warn-bg);
  color: var(--warn);
  border-color: #dcc27c;
}

.file-tag.unknown-tag {
  background: var(--balloon);
  color: var(--warn);
  border-color: #dcc27c;
}

.file-tag.attach-tag {
  background: #fbe3ea;
  color: #b0234f;
  border-color: #e8a4b8;
  letter-spacing: 0.1em;
}

.file-tag.permanent-tag {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.file-size-badge {
  flex-shrink: 0;
  font-family: var(--font-pixel);
  font-size: 1rem;
  min-width: 3.6rem;
  text-align: right;
}

.file-list-divider {
  margin: 0.5rem 0 0.1rem;
  padding: 0.1rem 0.4rem;
  font-family: var(--font-pixel);
  font-size: 0.8rem;
  color: var(--ink-muted);
  background: var(--face-lt);
}

/* 選択中ファイルのプロパティ */
.file-detail-pane {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.6rem 0.7rem;
  background: var(--face-lt);
  box-shadow: var(--sunken);
}

.file-detail-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.file-detail-desc {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--ink);
}

.file-detail-dep {
  font-size: 0.82rem;
  line-height: 1.5;
  padding: 0.35rem 0.55rem;
  background: var(--warn-bg);
  color: var(--warn);
  border-left: 3px solid var(--warn);
}

.file-detail-dep.is-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-left-color: var(--danger);
}

.file-detail-dep.is-info {
  background: #e7ecf6;
  color: var(--accent);
  border-left-color: var(--accent);
}

.file-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.file-detail-actions .btn {
  min-height: 40px;
  padding: 0.35rem 0.85rem;
  font-size: 0.9rem;
}

.btn-letter {
  color: var(--gold);
}

.btn-analyze {
  color: var(--accent);
}

.detail-note {
  font-size: 0.8rem;
  color: var(--ink-muted);
}

/* 確定バー */
.storage-commit-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 6px 6px;
  padding: 0.55rem 0.7rem;
  background: var(--face);
  box-shadow: var(--sunken);
}

.commit-status-box {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.commit-status-label {
  font-weight: 700;
  font-size: 0.95rem;
}

.commit-status-ok {
  color: var(--success);
}

.commit-status-warn {
  color: var(--danger);
}

.commit-status-sub {
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.commit-btn {
  flex-shrink: 0;
  min-height: 48px;
  padding: 0.45rem 1.4rem;
  font-size: 1rem;
}

/* ===================================================
   ログ（イベントビューアー）
   =================================================== */
.log-list-container {
  background: var(--field);
  box-shadow: var(--sunken);
  margin: 6px;
  padding: 4px;
  gap: 0;
}

.log-empty {
  padding: 1.5rem;
  text-align: center;
  color: var(--ink-muted);
  font-size: 0.88rem;
}

.log-item {
  padding: 0.45rem 0.55rem;
  border-bottom: 1px dotted #cfcac0;
  font-size: 0.85rem;
}

.log-header-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.log-time {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-muted);
}

.log-badge {
  font-family: var(--font-pixel);
  font-size: 0.75rem;
  padding: 0 0.35rem;
}

.log-badge-info {
  background: #e7ecf6;
  color: var(--accent);
}

.log-badge-warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.log-badge-error {
  background: var(--danger);
  color: #fff;
}

.log-text {
  margin-top: 0.15rem;
  line-height: 1.45;
}

.log-cause {
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: var(--danger);
  line-height: 1.45;
}

/* ===================================================
   夜: 決算レポート
   =================================================== */
.night-summary-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.night-header {
  /* タイトルバーとして描く */
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 1.9rem;
  padding: 0.15rem 0.5rem;
  background: linear-gradient(90deg, var(--title-a), var(--title-b));
  color: #fff;
  font-family: var(--font-pixel);
}

.night-title-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.night-phase-badge {
  font-size: 0.75rem;
  padding: 0 0.35rem;
  background: rgba(255, 255, 255, 0.2);
}

.night-title {
  font-size: 0.95rem;
  font-weight: 400;
}

.night-time-stamp {
  font-size: 0.8rem;
  opacity: 0.85;
}

.night-params-grid {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px 6px 4px;
}

.night-param-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  padding: 0.5rem;
  background: var(--field);
  box-shadow: var(--sunken);
}

.night-param-label {
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.night-param-val {
  font-family: var(--font-pixel);
  font-size: 1.8rem;
  line-height: 1.1;
}

.night-param-val.good {
  color: var(--success);
}

.night-param-val.bad {
  color: var(--danger);
}

.night-param-delta {
  font-size: 0.85rem;
  font-family: var(--font-pixel);
  color: var(--ink-muted);
}

.night-param-delta.up {
  color: var(--success);
}

.night-param-delta.down {
  color: var(--danger);
}

.night-sections-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 6px;
}

.night-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.night-section-title {
  font-family: var(--font-pixel);
  font-weight: 400;
  font-size: 0.95rem;
}

.night-files-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.night-file-item {
  padding: 0.5rem 0.7rem;
  background: var(--field);
  box-shadow: var(--sunken);
  border-left: 4px solid var(--face-lo);
}

.night-file-item.emotion {
  border-left-color: var(--danger);
}

.night-file-item.good {
  border-left-color: var(--success);
}

.night-file-item.skipped {
  border-left-color: var(--accent);
}

.night-file-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.night-file-name {
  flex: 1;
  font-weight: 700;
  font-size: 0.92rem;
}

.night-file-size {
  font-family: var(--font-pixel);
}

.night-file-desc {
  margin-top: 0.15rem;
  font-size: 0.85rem;
  color: var(--ink-muted);
  line-height: 1.5;
}

.night-empty-note {
  font-size: 0.85rem;
  color: var(--ink-muted);
  padding: 0.4rem 0.2rem;
}

.night-tomorrow-box {
  padding: 0.6rem 0.75rem;
  background: var(--balloon);
  box-shadow: 1px 1px 0 var(--face-dk), inset 0 0 0 1px var(--face-lo);
}

.night-tomorrow-header {
  display: flex;
  gap: 0.4rem;
  font-weight: 700;
}

.night-tomorrow-body {
  margin-top: 0.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.88rem;
}

.night-tomorrow-hint {
  color: var(--accent);
}

.night-tomorrow-req {
  color: var(--warn);
}

.night-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  padding: 8px 6px 6px;
}

.night-next-btn {
  min-height: 48px;
  padding: 0.4rem 1.4rem;
  font-size: 1rem;
}

.night-btn-sub {
  font-family: var(--font-pixel);
  font-size: 0.8rem;
  color: var(--ink-muted);
  font-weight: 400;
}

/* ===================================================
   朝 Day3〜: 解析ターミナル（コマンドプロンプト）
   =================================================== */
.cmd-terminal-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.cmd-terminal-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 1.9rem;
  padding: 0.15rem 0.5rem;
  background: linear-gradient(90deg, var(--title-a), var(--title-b));
  color: #fff;
  font-family: var(--font-pixel);
  font-size: 0.95rem;
}

.cmd-header-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.cmd-slots-badge {
  font-size: 0.85rem;
}

.cmd-guidance {
  flex-shrink: 0;
  display: flex;
  gap: 0.45rem;
  margin: 6px 6px 0;
  padding: 0.45rem 0.65rem;
  background: var(--balloon);
  box-shadow: 1px 1px 0 var(--face-dk);
  font-size: 0.85rem;
  line-height: 1.5;
}

.cmd-output-area {
  flex: 1;
  min-height: 3.5rem;
  margin: 6px 6px 0;
  padding: 0.5rem 0.65rem;
  background: var(--term-bg);
  color: var(--term-fg);
  box-shadow: var(--sunken);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.55;
  overflow-y: auto;
  -webkit-user-select: text;
  user-select: text;
}

.cmd-quick-actions {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 6px 6px 0;
}

.cmd-quick-label {
  font-family: var(--font-pixel);
  font-size: 0.8rem;
  color: var(--ink-muted);
  white-space: nowrap;
}

.cmd-quick-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  max-height: 5.4rem;
  overflow-y: auto;
}

.cmd-quick-btn {
  min-height: 36px;
  padding: 0.25rem 0.7rem;
  border: none;
  background: var(--face);
  box-shadow: var(--raised);
  color: var(--accent);
  font-size: 0.82rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.cmd-quick-btn:active:not(:disabled) {
  box-shadow: var(--pressed);
}

.cmd-quick-btn.disabled,
.cmd-quick-btn:disabled {
  color: var(--face-lo);
  cursor: not-allowed;
}

.cmd-no-targets {
  font-size: 0.82rem;
  color: var(--ink-muted);
}

.cmd-input-row {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 6px;
}

.cmd-prompt-symbol {
  font-family: var(--font-mono);
  font-weight: 700;
}

.cmd-input {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  padding: 0 0.5rem;
  border: none;
  background: var(--field);
  box-shadow: var(--sunken);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--ink);
  -webkit-user-select: text;
  user-select: text;
}

.cmd-input:focus {
  outline: 1px dotted var(--ink);
  outline-offset: -4px;
}

.cmd-submit-btn {
  min-height: 36px;
}

/* ===================================================
   削除確認（抵抗する記憶）
   =================================================== */
.purge-modal-actions .btn {
  transition: transform 0.15s;
}

.purge-confirm-btn.fleeing {
  transition: transform 0.12s steps(3);
}

.memory-flash {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: center;
}

.memory-flash-photo {
  width: 6.5rem;
  height: 5rem;
  display: grid;
  place-items: center;
  padding: 6px 6px 14px;
  background: #fffdf6;
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.3), inset 0 0 0 1px #d8d2c2;
  transform: rotate(-3deg);
}

.memory-flash-photo span {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 2.4rem;
  background: linear-gradient(180deg, #e9d9b8, #c9a978);
  filter: sepia(0.35);
}

.memory-flash figcaption {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.95rem;
  line-height: 1.5;
}

.memory-flash-desc {
  font-size: 0.88rem;
  color: var(--ink-muted);
}

.purge-resistance-hint {
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: var(--warn);
}

.purge-card-critical .modal-title {
  background: linear-gradient(90deg, #6b0d10, #c0392b);
}

@media (prefers-reduced-motion: reduce) {
  .purge-modal-actions .btn,
  .purge-confirm-btn.fleeing {
    transition: none;
  }
}

/* ===================================================
   章の終わり / エピタフ（クラッシュダンプ報告書）
   =================================================== */
#screen-ending {
  align-items: center;
}

.ending-content-card {
  width: min(760px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--face);
  box-shadow: var(--raised), var(--drop);
  padding: 3px;
}

.ending-paper {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin: 6px;
  padding: 1.4rem 1.6rem;
  background: var(--field);
  box-shadow: var(--sunken);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.life-title-box {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.8rem 1rem;
  background: var(--balloon);
  box-shadow: inset 0 0 0 1px var(--face-lo);
}

.life-title-label {
  font-family: var(--font-pixel);
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.life-title-name {
  font-family: var(--font-pixel);
  font-weight: 400;
  font-size: 1.5rem;
  line-height: 1.3;
}

.life-title-reason {
  font-size: 0.9rem;
  line-height: 1.6;
}

.ending-rank-badge {
  align-self: flex-start;
  font-family: var(--font-pixel);
  font-size: 0.95rem;
  padding: 0.1rem 0.6rem;
  border: 2px solid var(--ink);
}

.ending-main-title {
  font-family: var(--font-pixel);
  font-weight: 400;
  font-size: clamp(1.4rem, 1.5vw + 0.8rem, 2rem);
  line-height: 1.3;
}

.ending-narrative {
  font-size: 0.95rem;
  line-height: 1.8;
}

.epitaph-box {
  padding: 1rem 1.2rem;
  border: 2px dashed var(--ink);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.epitaph-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.epitaph-text {
  font-family: var(--font-pixel);
  font-size: 1.15rem;
  line-height: 1.7;
  white-space: pre-wrap;
}

.ending-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--ink);
  border-left: 1px solid var(--ink);
}

.ending-stat-box {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.45rem 0.7rem;
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.ending-stat-label {
  font-size: 0.82rem;
  color: var(--ink-muted);
}

.ending-stat-val {
  font-family: var(--font-pixel);
  font-size: 1.15rem;
}

.ending-sub-title {
  font-family: var(--font-pixel);
  font-weight: 400;
  font-size: 0.95rem;
  margin-bottom: 0.4rem;
}

.ending-files-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.ending-file-chip {
  font-size: 0.8rem;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--face-lo);
  background: var(--face-lt);
}

.ending-file-chip.emotion {
  color: var(--danger);
  border-color: #e3a29d;
}

.ending-file-chip.core-chip {
  color: var(--gold);
  border-color: var(--gold);
  font-weight: 700;
}

.ending-action-buttons {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 6px 6px 8px;
}

@media (max-width: 600px) {
  .ending-paper {
    padding: 1rem;
  }

  .ending-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===================================================
   通知（タスクバーから出る吹き出し）
   =================================================== */
#toast-container {
  position: fixed;
  right: 14px;
  bottom: calc(60px + env(safe-area-inset-bottom));
  z-index: 1500;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  width: min(380px, calc(100% - 28px));
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--balloon);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--face-dk), 3px 3px 0 rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.15s, transform 0.15s;
  cursor: pointer;
}

.toast-item.toast-show {
  opacity: 1;
  transform: translateY(0);
}

.toast-item.toast-fade-out {
  opacity: 0;
}

.toast-icon {
  flex-shrink: 0;
  width: 1.4rem;
  height: 1.4rem;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border-radius: 50%;
}

.toast-error .toast-icon {
  background: var(--danger);
}

.toast-warn .toast-icon {
  background: var(--warn);
}

.toast-success .toast-icon {
  background: var(--success);
}

.toast-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.toast-title {
  font-family: var(--font-pixel);
  font-size: 0.9rem;
}

.toast-message {
  font-size: 0.85rem;
  line-height: 1.45;
}

.toast-cause {
  font-size: 0.78rem;
  color: var(--danger);
  line-height: 1.45;
}

@media (max-width: 899px) {
  #toast-container {
    left: 8px;
    right: 8px;
    width: auto;
    bottom: calc(96px + env(safe-area-inset-bottom));
  }
}

/* 最期の日: 残す記憶を1つだけ選ぶ */
.final-choice-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px;
  background: var(--field);
  box-shadow: var(--sunken);
}

.final-choice-card {
  display: grid;
  grid-template-columns: 2.6rem 1fr;
  gap: 0.75rem;
  align-items: center;
  padding: 0.6rem 0.75rem;
  border: none;
  background: var(--face);
  box-shadow: var(--raised);
  text-align: left;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
}

.final-choice-card:hover {
  background: var(--face-lt);
}

.final-choice-card:active {
  box-shadow: var(--pressed);
}

.final-choice-icon {
  font-size: 1.8rem;
  text-align: center;
}

.final-choice-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.final-choice-text span {
  font-size: 0.84rem;
  color: var(--ink-muted);
  line-height: 1.45;
}
