:root {
  color-scheme: dark;
  --bg: #101820;
  --side: #151f29;
  --panel: #1b2834;
  --line: #334653;
  --text: #e9f5f7;
  --muted: #9eafb6;
  --cyan: #b1e9ed;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  font-family: 'Segoe UI', Meiryo, sans-serif;
  background: var(--bg);
  color: var(--text);
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button,
select,
.attach {
  background: #23323e;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 9px 15px;
  cursor: pointer;
}
button:hover,
.attach:hover {
  background: #30434e;
}
.primary {
  background: var(--cyan);
  color: #11252a;
  border-color: transparent;
  font-weight: 700;
}
.primary:hover {
  background: #d5f8fa;
}
input,
textarea {
  background: #111c24;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px;
  outline: none;
}
input:focus,
textarea:focus {
  border-color: var(--cyan);
}
label {
  display: grid;
  gap: 6px;
}
small,
.caption {
  color: var(--muted);
}
[hidden] {
  display: none !important;
}
.center {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.card,
dialog {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 28px;
  max-width: 440px;
  width: 100%;
}
.card {
  display: grid;
  gap: 14px;
}
.card h1 {
  color: var(--cyan);
  margin: 0;
}
.card p {
  color: var(--muted);
  margin: 0;
}
.card input {
  width: 100%;
}
#app {
  height: 100dvh;
  display: flex;
}
aside {
  width: 275px;
  flex: none;
  background: var(--side);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-right: 1px solid var(--line);
}
.brand {
  font-size: 22px;
  font-weight: 700;
  color: var(--cyan);
  padding: 4px 7px;
}
#close-sidebar {
  display: none;
  float: right;
}
#history {
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 5px;
}
.history-item {
  text-align: left;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  background: transparent;
  border: 0;
}
.history-item.active {
  background: #2a3e49;
}
.sidebar-bottom {
  margin-top: auto;
  display: grid;
  gap: 7px;
}
.sidebar-bottom button {
  text-align: left;
  background: transparent;
  border: 0;
}
main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}
header {
  height: 70px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
}
header strong {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
header select {
  max-width: 35%;
}
#open-sidebar {
  display: none;
}
#messages {
  flex: 1;
  overflow: auto;
  padding: 32px max(24px, calc((100% - 850px) / 2));
  scroll-behavior: smooth;
}
.welcome {
  text-align: center;
  margin: 15vh auto;
  color: var(--muted);
}
.welcome h1 {
  color: var(--text);
  font-size: 24px;
}
.snow {
  font-size: 60px;
  color: var(--cyan);
}
.message {
  line-height: 1.75;
  margin: 0 0 25px;
  overflow-wrap: anywhere;
}
.message .label {
  font-size: 13px;
  color: var(--cyan);
  font-weight: 700;
}
.message.user {
  background: #223441;
  border-radius: 18px;
  padding: 14px 18px;
  margin-left: 12%;
}
.message pre,
.message .table-wrap {
  overflow: auto;
  max-width: 100%;
  background: #101b23;
  border-radius: 12px;
  padding: 12px;
}
.message img {
  max-width: 100%;
  border-radius: 12px;
}
.message a {
  color: var(--cyan);
}
.compose-wrap {
  width: min(900px, 100%);
  margin: auto;
  padding: 0 20px calc(14px + env(safe-area-inset-bottom));
  text-align: center;
}
.compose-wrap small {
  font-size: 11px;
}
#composer {
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 12px;
  margin-bottom: 8px;
}
#input {
  width: 100%;
  resize: none;
  border: 0;
  background: transparent;
  max-height: 30vh;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}
.toolbar #context {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}
#progress {
  min-height: 20px;
  color: var(--cyan);
  font-size: 13px;
  padding: 0 24px;
}
#attachment-list {
  text-align: left;
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.chip {
  background: #293b46;
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 12px;
}
.chip button {
  padding: 0 4px;
  border: 0;
  background: none;
}
.actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
dialog::backdrop {
  background: #0009;
}
dialog input {
  width: 100%;
}
#info-content {
  max-height: 60vh;
  overflow: auto;
  white-space: pre-wrap;
}
.notice {
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}
#shade {
  display: none;
}
@media (max-width: 700px) {
  aside {
    position: fixed;
    z-index: 3;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.18s;
    width: min(85vw, 300px);
  }
  body.drawer aside {
    transform: none;
  }
  body.drawer #shade {
    display: block;
    position: fixed;
    inset: 0;
    background: #0009;
    z-index: 2;
  }
  #open-sidebar,
  #close-sidebar {
    display: block;
  }
  header {
    height: 60px;
    padding: 0 10px;
    gap: 5px;
  }
  header button {
    padding: 8px;
  }
  #messages {
    padding: 22px 16px;
  }
  .compose-wrap {
    padding: 0 10px calc(8px + env(safe-area-inset-bottom));
  }
  .welcome {
    margin-top: 12vh;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

.logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  vertical-align: middle;
}
