/* 色は明るい画面が既定。ダークは body.dark で切り替える */
:root {
  --bg: #ffffff;
  --bg2: #f2f2f7;
  --text: #000000;
  --sub: #8a8a8e;
  --line: #d1d1d6;
  --blue: #007aff;
  --flag: #ff9500;
  --bar: rgba(249, 249, 249, 0.94);
  --top: env(safe-area-inset-top, 0px);
  --bottom: env(safe-area-inset-bottom, 0px);
}
body.dark {
  --bg: #000000;
  --bg2: #1c1c1e;
  --text: #ffffff;
  --sub: #8d8d93;
  --line: #38383a;
  --blue: #0a84ff;
  --flag: #ff9f0a;
  --bar: rgba(22, 22, 24, 0.94);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body.look-g { background: var(--g-gap); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-user-select: none; user-select: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

/* iPhone のホーム画面から開くと、上を透かした分だけ高さが足りず下に隙間が出る。画面の高さいっぱいに取る */
#app { position: fixed; top: 0; left: 0; right: 0; height: 100vh; height: 100lvh; overflow: hidden; }
.screen {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  background: var(--bg);
  transition: transform .35s cubic-bezier(.2, .8, .2, 1);
}
.screen.off { transform: translateX(100%); }
body.still .screen { transition: none; }
#inbox.behind { transform: translateX(-28%); }
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* 上の帯 */
.navbar {
  padding: calc(var(--top) + 6px) 8px 6px;
  min-height: calc(var(--top) + 44px);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg);
}
.nav-left, .nav-right { color: var(--blue); font-size: 17px; display: flex; align-items: center; }
.nav-left .chev { font-size: 34px; line-height: 0; margin: -4px 4px 0 0; font-weight: 300; }
.nav-right { padding-right: 8px; }

.big-title { font-size: 34px; font-weight: 700; margin: 2px 16px 8px; letter-spacing: .01em; }
.search {
  margin: 0 16px 10px; height: 36px; border-radius: 10px; background: var(--bg2);
  display: flex; align-items: center; gap: 6px; padding: 0 8px; color: var(--sub); font-size: 17px;
}
.mag { width: 14px; height: 14px; border: 2px solid var(--sub); border-radius: 50%; position: relative; margin: 0 2px 2px 2px; }
.mag::after { content: ""; position: absolute; width: 2px; height: 6px; background: var(--sub); right: -4px; bottom: -5px; transform: rotate(-45deg); border-radius: 1px; }

/* 受信箱の一覧 */
.list { list-style: none; margin: 0; padding: 0; }
.list li { position: relative; padding: 10px 16px 11px 34px; }
.list li::after { content: ""; position: absolute; left: 34px; right: 0; bottom: 0; height: .5px; background: var(--line); }
.list li:active { background: var(--bg2); }
.list .dot { position: absolute; left: 12px; top: 16px; width: 11px; height: 11px; border-radius: 50%; background: var(--blue); }
.list .flag { position: absolute; left: 14px; top: 34px; width: 8px; height: 8px; border-radius: 50%; background: var(--flag); }
.list .r1 { display: flex; align-items: baseline; gap: 8px; }
.list .name { flex: 1; font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .time { color: var(--sub); font-size: 15px; white-space: nowrap; }
.list .time::after { content: "›"; margin-left: 6px; font-size: 20px; color: var(--line); position: relative; top: 1px; }
.list .subj { font-size: 15px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .prev {
  color: var(--sub); font-size: 15px; line-height: 1.33; margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.list .clip { display: inline-block; width: 14px; height: 14px; margin-left: 4px; vertical-align: -2px; }
.list .clip svg { width: 100%; height: 100%; stroke: var(--sub); fill: none; stroke-width: 2; stroke-linecap: round; }

/* 下の帯 */
.toolbar {
  padding: 8px 18px calc(var(--bottom) + 8px);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bar); border-top: .5px solid var(--line);
  min-height: calc(var(--bottom) + 46px);
}
.toolbar .status { text-align: center; font-size: 12px; }
.toolbar .sub { color: var(--sub); font-size: 11px; margin-top: 1px; }
.tool-icon { width: 24px; height: 24px; position: relative; display: inline-block; }
.tool-icon.compose { border: 2px solid var(--blue); border-radius: 5px; width: 21px; height: 21px; }
.tool-icon.compose::after { content: ""; position: absolute; width: 2px; height: 16px; background: var(--blue); right: 1px; top: -6px; transform: rotate(45deg); border-radius: 1px; }
.tool-icon.filter { border: 2px solid var(--blue); border-radius: 50%; width: 22px; height: 22px; }
.tool-icon.filter::before, .tool-icon.filter::after { content: ""; position: absolute; left: 50%; height: 2px; background: var(--blue); transform: translateX(-50%); border-radius: 1px; }
.tool-icon.filter::before { top: 6px; width: 10px; }
.tool-icon.filter::after { top: 11px; width: 5px; }
.tool-icon.trash { border: 2px solid var(--blue); border-top: 0; border-radius: 0 0 4px 4px; width: 16px; height: 19px; margin-top: 4px; }
.tool-icon.trash::before { content: ""; position: absolute; top: -4px; left: -5px; width: 22px; height: 2px; background: var(--blue); border-radius: 1px; }
.tool-icon.folder { border: 2px solid var(--blue); border-radius: 3px; width: 24px; height: 18px; margin-top: 3px; }
.tool-icon.reply { width: 22px; height: 16px; border: 2px solid var(--blue); border-right: 0; border-bottom: 0; border-radius: 12px 0 0 0; margin-top: 6px; }
.tool-icon.reply::before { content: ""; position: absolute; left: -7px; top: -6px; border: 6px solid transparent; border-right-color: var(--blue); }

/* 開いたメール */
.arrows { gap: 22px; }
.arrow { width: 12px; height: 12px; border-left: 2px solid var(--blue); border-top: 2px solid var(--blue); transform: rotate(45deg); margin-top: 5px; }
.arrow.down { transform: rotate(225deg); margin-top: -5px; }
.head { display: flex; gap: 12px; padding: 8px 16px 12px; align-items: flex-start; }
.avatar {
  flex: 0 0 40px; height: 40px; border-radius: 50%; color: #fff; font-weight: 600; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(#a5abb8, #858b98);
}
.who { flex: 1; min-width: 0; }
.row1 { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.from { font-size: 17px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.date { color: var(--sub); font-size: 14px; white-space: nowrap; }
.to { color: var(--sub); font-size: 15px; margin-top: 3px; }
.to span { color: var(--blue); }
.subject { font-size: 20px; font-weight: 700; margin: 2px 16px 12px; line-height: 1.35; }
.attach:empty { display: none; }
.attach {
  margin: 0 16px 14px; padding: 10px 12px; border-radius: 10px; background: var(--bg2);
  display: flex; gap: 10px; align-items: center; font-size: 15px;
}
.attach .file { width: 28px; height: 34px; border-radius: 3px; background: #e5484d; color: #fff; font-size: 9px; font-weight: 700; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 4px; }
.body { padding: 0 16px 40px; font-size: 17px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; -webkit-user-select: text; user-select: text; }

/* 編集の画面 */
.editor { background: var(--bg2); }
.ed-bar {
  padding: calc(var(--top) + 8px) 12px 8px; display: flex; align-items: center; gap: 8px;
  background: var(--bar); border-bottom: .5px solid var(--line);
}
.ed-title { flex: 1; text-align: center; font-weight: 600; font-size: 17px; }
.ed-btn { color: var(--blue); font-size: 16px; min-width: 80px; text-align: left; }
.ed-bar .ed-btn:last-child { text-align: right; }
.ed-spacer { min-width: 80px; }
.ed-scroll { padding: 4px 16px calc(var(--bottom) + 40px); }
.editor h3 { font-size: 13px; color: var(--sub); font-weight: 600; margin: 22px 4px 8px; }
.editor h3 small { font-weight: 400; margin-left: 6px; }
.editor label { display: block; font-size: 13px; color: var(--sub); margin: 10px 0; }
.editor input:not([type=checkbox]), .editor textarea {
  display: block; width: 100%; margin-top: 5px; padding: 10px 12px; border-radius: 10px;
  border: 0; background: var(--bg); color: var(--text); font: inherit; font-size: 16px;
  -webkit-user-select: text; user-select: text;
}
.editor textarea { resize: vertical; line-height: 1.5; }
.editor label.check { display: flex; align-items: center; gap: 10px; font-size: 16px; color: var(--text); background: var(--bg); padding: 12px; border-radius: 10px; }
.editor label.check input { width: 20px; height: 20px; }
.seg { display: flex; background: var(--line); border-radius: 9px; padding: 2px; margin: 12px 0; }
.seg button { flex: 1; padding: 7px; border-radius: 7px; font-size: 15px; }
.seg button.on { background: var(--bg); font-weight: 600; }
.ed-list { list-style: none; margin: 0; padding: 0; background: var(--bg); border-radius: 10px; overflow: hidden; }
.ed-list li { display: flex; align-items: center; gap: 8px; padding: 10px 8px 10px 12px; border-bottom: .5px solid var(--line); }
.ed-list li:last-child { border-bottom: 0; }
.ed-list .t { flex: 1; min-width: 0; }
.ed-list .t b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-list .t span { display: block; font-size: 13px; color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-list .mv { width: 34px; height: 34px; border-radius: 8px; background: var(--bg2); color: var(--blue); font-size: 15px; }
.ed-list .mv:disabled { opacity: .3; }
.ed-wide { display: block; width: 100%; padding: 13px; border-radius: 10px; background: var(--bg); color: var(--blue); font-size: 16px; margin-top: 10px; }
.danger { color: #ff3b30 !important; }
.hint { color: var(--sub); font-size: 13px; line-height: 1.5; margin: 16px 4px; }
