* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  font-family:
    "Yu Gothic",
    "Hiragino Kaku Gothic ProN",
    Meiryo,
    Arial,
    sans-serif;
  color: #1f1f1f;
  background: #f6f8fc;
  font-weight: 500;
}

button,
input,
textarea,
select {
  font-family: inherit;
}

button {
  cursor: pointer;
}

.umail-app {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #f6f8fc;
}

/* 上部ヘッダー */

.umail-header {
  height: 72px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 8px 18px;
  background: #f6f8fc;
  border-bottom: 1px solid #e0e3eb;
}

.header-left {
  width: 250px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.umail-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.umail-logo img {
  width: 170px;
  height: 52px;
  object-fit: contain;
  display: block;
  padding: 6px 10px;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px #e8eaed;
}

.header-search {
  height: 46px;
  flex: 1;
  min-width: 420px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  background: #edf2fa;
  border-radius: 24px;
  color: #5f6368;
}

.search-icon {
  font-size: 18px;
}

.header-search input {
  width: 100%;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: #3c4043;
  font-size: 15px;
  font-weight: 500;
}

.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.icon-button,
.small-icon-button {
  border: none;
  background: transparent;
  color: #4b5563;
}

.icon-button {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  font-size: 22px;
}

.small-icon-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 18px;
}

.icon-button:hover,
.small-icon-button:hover,
.dummy-button:hover {
  background: #e8eaed;
}

.user-circle {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #d2e3fc;
  color: #1967d2;
  font-size: 18px;
  font-weight: 700;
}

/* メイン */

.umail-main {
  height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: 250px 360px 1fr;
  overflow: hidden;
}

/* 左サイドバー */

.sidebar {
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 14px 12px;
  background: #f6f8fc;
  border-right: 1px solid #e0e3eb;
}

.compose-button {
  width: 164px;
  height: 64px;
  margin: 0 0 18px 0;
  border: none;
  border-radius: 18px;
  background: #c2e7ff;
  color: #001d35;
  font-size: 16px;
  font-weight: 700;
  box-shadow:
    0 1px 2px rgba(60, 64, 67, 0.3),
    0 1px 3px rgba(60, 64, 67, 0.15);
}

.compose-button:hover {
  background: #b3ddf7;
}

.mail-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  height: 40px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  border: none;
  border-radius: 0 20px 20px 0;
  background: transparent;
  color: #263238;
  font-size: 15px;
  font-weight: 500;
  text-align: left;
}

.nav-item.active {
  background: #d3e3fd;
  color: #001d35;
  font-weight: 700;
}

.nav-icon {
  width: 24px;
  text-align: center;
  font-size: 19px;
}

.storage-text {
  margin-top: auto;
  padding: 16px 10px 6px;
  color: #4b5563;
  font-size: 13px;
  font-weight: 500;
}

.fiction-notice {
  padding: 0 10px 16px;
  color: #6b7280;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.6;
}

.fiction-notice p {
  margin: 0;
}

.fiction-notice p + p {
  margin-top: 4px;
}

/* メール一覧 */

.mail-list-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-right: 1px solid #e0e3eb;
}

.mail-list-toolbar {
  height: 54px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 10px;
  border-bottom: 1px solid #e8eaed;
}

.mail-list {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
}

.mail-item {
  min-height: 84px;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid #f0f0f0;
  background: #ffffff;
  cursor: pointer;
}

.mail-item:hover {
  box-shadow: inset 1px 0 0 #dadce0, inset -1px 0 0 #dadce0;
  background: #f8fafd;
}

.mail-item.unread {
  background: #ffffff;
  font-weight: 700;
}

.mail-item.opened {
  background: #f2f6fc;
  font-weight: 500;
}

.mail-list-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #c2e7ff;
  color: #1967d2;
  font-size: 16px;
  font-weight: 700;
}

.mail-item.unread .mail-list-icon {
  background: #a8d8ff;
}

.mail-list-content {
  min-width: 0;
}

.mail-list-sender {
  margin-bottom: 5px;
  color: #202124;
  font-size: 15px;
  font-weight: 700;
}

.mail-list-subject {
  overflow: hidden;
  color: #202124;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mail-list-new {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 6px;
  border-radius: 10px;
  background: #1a73e8;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
}

.mail-list-time {
  color: #4b5563;
  font-size: 13px;
  font-weight: 500;
}

/* メール本文 */

.mail-detail-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

.mail-detail-toolbar {
  height: 54px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 14px;
  border-bottom: 1px solid #e8eaed;
  flex-shrink: 0;
}

.mail-detail {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 40px 64px 120px;
  background: #ffffff;
}

.empty-message {
  margin-top: 80px;
  color: #5f6368;
  font-size: 15px;
  font-weight: 500;
  text-align: center;
}

/* 共通メール表示 */

.mail-view {
  max-width: 920px;
}

.mail-subject {
  margin: 0 0 26px;
  color: #202124;
  font-size: 30px;
  font-weight: 500;
  line-height: 1.35;
}

.mail-meta {
  display: grid;
  grid-template-columns: 50px 1fr auto;
  gap: 14px;
  align-items: start;
  margin-bottom: 30px;
}

.sender-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #c2e7ff;
  color: #1967d2;
  font-size: 19px;
  font-weight: 700;
}

.sender-line {
  margin-bottom: 4px;
  color: #202124;
  font-size: 16px;
  font-weight: 700;
}

.sender-email {
  margin-left: 4px;
  color: #4b5563;
  font-size: 13px;
  font-weight: 500;
}

.to-line {
  color: #4b5563;
  font-size: 13px;
  font-weight: 500;
}

.mail-time {
  color: #3c4043;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.mail-body {
  margin-left: 64px;
  color: #202124;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.95;
}

.mail-body p {
  margin: 0 0 18px;
}

.mail-body a {
  color: #0b57d0;
  font-weight: 700;
}

.mail-actions {
  margin: 34px 0 0 64px;
}

.reply-button {
  min-width: 112px;
  height: 42px;
  padding: 0 22px;
  border: 1px solid #dadce0;
  border-radius: 22px;
  background: #ffffff;
  color: #1a73e8;
  font-size: 15px;
  font-weight: 700;
}

.reply-button:hover {
  background: #f6fafe;
  border-color: #d2e3fc;
}

/* 送信内容引用 */

.sent-quote {
  margin: 36px 0 0 64px;
  padding: 16px 18px;
  border-left: 4px solid #dadce0;
  border-radius: 8px;
  background: #f8f9fa;
  color: #4b5563;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.8;
}

.sent-quote-title {
  margin-bottom: 8px;
  color: #3c4043;
  font-weight: 700;
}

.sent-quote-meta {
  margin-bottom: 8px;
  color: #6b7280;
  font-size: 12px;
  font-weight: 500;
}

.sent-quote-body {
  white-space: pre-wrap;
}

/* メール作成画面 */

.compose-mail {
  max-width: 900px;
  overflow: hidden;
  border: 1px solid #dadce0;
  border-radius: 10px;
  background: #ffffff;
  box-shadow:
    0 1px 2px rgba(60, 64, 67, 0.2),
    0 2px 6px rgba(60, 64, 67, 0.15);
}

.compose-title {
  padding: 12px 18px;
  background: #f2f6fc;
  color: #202124;
  font-size: 14px;
  font-weight: 700;
}

.compose-row {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  border-bottom: 1px solid #e8eaed;
}

.compose-label {
  width: 42px;
  color: #4b5563;
  font-size: 13px;
  font-weight: 500;
}

.compose-value {
  color: #202124;
  font-size: 14px;
  font-weight: 500;
}

.compose-body {
  min-height: 310px;
  padding: 26px 18px;
  color: #202124;
  font-size: 16px;
  font-weight: 500;
  line-height: 2;
}

.compose-body p {
  margin: 0 0 22px;
}

.compose-actions {
  display: flex;
  align-items: center;
  padding: 12px 18px 18px;
}

/* 入力欄 */

.inline-input,
.reply-input,
.inline-select {
  height: 40px;
  border: 1px solid #c7d0df;
  border-radius: 12px;
  background: #ffffff;
  color: #202124;
  font-size: 15px;
  font-weight: 500;
  outline: none;
}

.inline-input {
  width: 220px;
  padding: 0 12px;
  vertical-align: middle;
}

.first-target-input {
  width: 250px;
}

.reply-input {
  width: 320px;
  padding: 0 12px;
}

.inline-select {
  min-width: 180px;
  padding: 0 36px 0 12px;
  vertical-align: middle;
}

.inline-input:focus,
.reply-input:focus,
.inline-select:focus {
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.12);
}

.send-button {
  min-width: 96px;
  height: 42px;
  padding: 0 24px;
  border: none;
  border-radius: 22px;
  background: #0b57d0;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
}

.send-button:hover {
  background: #1a73e8;
}

/* 旧返信ボックス用 */

.reply-box {
  max-width: 720px;
  margin: 28px 0 0 64px;
  padding: 16px;
  border: 1px solid #dadce0;
  border-radius: 12px;
  background: #ffffff;
}

.reply-box textarea,
.reply-box input {
  width: 100%;
  border: none;
  outline: none;
  resize: vertical;
  color: #202124;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.7;
}

.reply-box textarea {
  min-height: 110px;
}

.reply-box input {
  height: 42px;
  border-bottom: 1px solid #e8eaed;
}

.reply-actions {
  margin-top: 14px;
}

/* トースト */

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  z-index: 100;
  padding: 12px 22px;
  border-radius: 6px;
  background: #323232;
  color: #ffffff;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
}

.toast.show {
  animation: toastFade 3s ease forwards;
}

@keyframes toastFade {
  0% {
    opacity: 0;
    transform: translate(-50%, 12px);
  }

  12% {
    opacity: 1;
    transform: translate(-50%, 0);
  }

  72% {
    opacity: 1;
    transform: translate(-50%, 0);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -8px);
  }
}

/* ダミーボタン */

.dummy-button {
  user-select: none;
}

/* 狭い画面用 */

@media (max-width: 1100px) {
  .header-left {
    width: 220px;
  }

  .header-search {
    min-width: 260px;
  }

  .umail-main {
    grid-template-columns: 210px 300px 1fr;
  }

  .umail-logo img {
    width: 145px;
    height: 48px;
  }

  .mail-detail {
    padding: 28px 34px 100px;
  }

  .mail-body,
  .mail-actions,
  .sent-quote {
    margin-left: 58px;
  }
}

.thought-popup {
  position: fixed;
  left: 50%;
  bottom: 92px;
  z-index: 200;
  max-width: 520px;
  padding: 18px 28px;
  border: 1px solid rgba(194, 231, 255, 0.9);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #32445a;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.7;
  text-align: center;
  box-shadow:
    0 12px 32px rgba(60, 64, 67, 0.18),
    0 0 0 6px rgba(194, 231, 255, 0.22);
  opacity: 0;
  transform: translate(-50%, 16px) scale(0.98);
  pointer-events: none;
  backdrop-filter: blur(8px);
}

.thought-popup.show {
  animation: thoughtFloat 2.4s ease forwards;
}

@keyframes thoughtFloat {
  0% {
    opacity: 0;
    transform: translate(-50%, 18px) scale(0.96);
  }

  15% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }

  72% {
    opacity: 1;
    transform: translate(-50%, -4px) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -14px) scale(0.98);
  }
}

.ending-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 22px;
  border-radius: 22px;
  background: #0b57d0;
  color: #ffffff !important;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  box-shadow:
    0 1px 2px rgba(60, 64, 67, 0.25),
    0 2px 6px rgba(60, 64, 67, 0.18);
}

.ending-link-button:hover {
  background: #1a73e8;
  text-decoration: none;
}

/* スマホ表示 */

@media (max-width: 760px) {
  html,
  body {
    height: auto;
    min-height: 100%;
  }

  body {
    overflow-x: hidden;
    background: #ffffff;
  }

  .umail-app {
    width: 100%;
    min-height: 100dvh;
    height: auto;
    overflow: visible;
    background: #ffffff;
  }

  .umail-header {
    position: sticky;
    top: 0;
    z-index: 50;
    height: auto;
    min-height: 64px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(246, 248, 252, 0.96);
    backdrop-filter: blur(10px);
  }

  .header-left {
    width: auto;
    gap: 8px;
  }

  .umail-logo img {
    width: 132px;
    height: 44px;
    padding: 5px 8px;
    border-radius: 12px;
  }

  .header-search {
    min-width: 0;
    height: 42px;
    padding: 0 12px;
    border-radius: 22px;
  }

  .header-search input {
    font-size: 14px;
  }

  .header-right {
    gap: 2px;
  }

  .icon-button {
    width: 40px;
    height: 40px;
    font-size: 19px;
  }

  .header-right .dummy-button:first-child {
    display: none;
  }

  .user-circle {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }

  .umail-main {
    height: auto;
    min-height: calc(100dvh - 64px);
    display: block;
    overflow: visible;
  }

  .sidebar {
    min-height: 0;
    display: block;
    padding: 10px 10px 8px;
    border-right: none;
    border-bottom: 1px solid #e0e3eb;
    background: #f6f8fc;
  }

  .compose-button {
    width: 100%;
    height: 48px;
    margin: 0 0 10px;
    border-radius: 18px;
    font-size: 15px;
  }

  .mail-nav {
    display: flex;
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .mail-nav::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    height: 38px;
    flex: 0 0 auto;
    gap: 8px;
    padding: 0 13px;
    border-radius: 999px;
    white-space: nowrap;
    font-size: 13px;
  }

  .nav-icon {
    width: auto;
    font-size: 16px;
  }

  .storage-text {
    margin-top: 10px;
    padding: 8px 4px 3px;
    font-size: 11px;
  }

  .fiction-notice {
    padding: 0 4px 4px;
    font-size: 10px;
    line-height: 1.5;
  }

  .mail-list-panel {
    height: auto;
    max-height: 300px;
    border-right: none;
    border-bottom: 1px solid #e0e3eb;
  }

  .mail-list-toolbar,
  .mail-detail-toolbar {
    height: 46px;
    padding: 0 10px;
  }

  .small-icon-button {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .mail-list {
    max-height: 254px;
    overflow-y: auto;
  }

  .mail-item {
    min-height: 74px;
    grid-template-columns: 38px 1fr auto;
    gap: 8px;
    padding: 10px 12px;
  }

  .mail-list-icon {
    width: 32px;
    height: 32px;
    font-size: 15px;
  }

  .mail-list-sender,
  .mail-list-subject {
    font-size: 14px;
  }

  .mail-list-time {
    font-size: 12px;
  }

  .mail-detail-panel {
    display: block;
    min-height: 0;
  }

  .mail-detail {
    min-height: 0;
    height: auto;
    overflow: visible;
    padding: 24px 16px 90px;
  }

  .empty-message {
    margin: 34px 0;
  }

  .mail-view {
    max-width: none;
  }

  .mail-subject {
    margin-bottom: 20px;
    font-size: 23px;
    line-height: 1.45;
  }

  .mail-meta {
    grid-template-columns: 42px 1fr;
    gap: 10px;
    margin-bottom: 22px;
  }

  .sender-icon {
    width: 42px;
    height: 42px;
    font-size: 17px;
  }

  .sender-line {
    font-size: 15px;
    line-height: 1.5;
  }

  .sender-email {
    display: block;
    margin: 2px 0 0;
    word-break: break-all;
  }

  .mail-time {
    grid-column: 2;
    font-size: 12px;
  }

  .mail-body,
  .mail-actions,
  .sent-quote {
    margin-left: 0;
  }

  .mail-body {
    font-size: 15px;
    line-height: 1.9;
  }

  .mail-actions {
    margin-top: 28px;
  }

  .reply-button,
  .send-button,
  .ending-link-button {
    min-height: 44px;
    font-size: 15px;
  }

  .sent-quote {
    margin-top: 28px;
    padding: 14px 15px;
    font-size: 13px;
  }

  .compose-mail {
    max-width: none;
    border-radius: 14px;
  }

  .compose-row {
    min-height: 50px;
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
    padding: 10px 14px;
  }

  .compose-label {
    width: auto;
  }

  .compose-value {
    max-width: 100%;
    word-break: break-word;
  }

  .compose-body {
    min-height: 260px;
    padding: 22px 14px;
    font-size: 15px;
    line-height: 1.9;
  }

  .compose-actions {
    padding: 10px 14px 16px;
  }

  .inline-input,
  .reply-input,
  .inline-select {
    width: 100%;
    max-width: 100%;
    height: 44px;
    margin: 8px 0;
    font-size: 16px;
  }

  .first-target-input {
    width: 100%;
  }

  .inline-select {
    min-width: 0;
  }

  .reply-box {
    max-width: none;
    margin: 24px 0 0;
    padding: 14px;
  }

  .reply-box textarea {
    min-height: 120px;
    font-size: 16px;
  }

  .toast {
    width: calc(100% - 32px);
    left: 16px;
    right: 16px;
    bottom: 22px;
    transform: translateY(12px);
    text-align: center;
  }

  @keyframes toastFade {
    0% {
      opacity: 0;
      transform: translateY(12px);
    }

    12% {
      opacity: 1;
      transform: translateY(0);
    }

    72% {
      opacity: 1;
      transform: translateY(0);
    }

    100% {
      opacity: 0;
      transform: translateY(-8px);
    }
  }

  .thought-popup {
    width: calc(100% - 32px);
    max-width: none;
    left: 16px;
    right: 16px;
    bottom: 78px;
    padding: 15px 18px;
    border-radius: 22px;
    font-size: 14px;
    transform: translateY(16px) scale(0.98);
  }

  @keyframes thoughtFloat {
    0% {
      opacity: 0;
      transform: translateY(18px) scale(0.96);
    }

    15% {
      opacity: 1;
      transform: translateY(0) scale(1);
    }

    72% {
      opacity: 1;
      transform: translateY(-4px) scale(1);
    }

    100% {
      opacity: 0;
      transform: translateY(-14px) scale(0.98);
    }
  }
}

@media (max-width: 430px) {
  .umail-header {
    grid-template-columns: 1fr auto;
  }

  .header-left {
    grid-column: 1;
  }

  .header-search {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }

  .header-right {
    grid-column: 2;
    grid-row: 1;
  }

  .umail-logo img {
    width: 124px;
  }

  .mail-list-panel {
    max-height: 260px;
  }

  .mail-list {
    max-height: 214px;
  }

  .mail-detail {
    padding: 22px 14px 84px;
  }

  .mail-subject {
    font-size: 21px;
  }
}
