html {
  --ae-font-size-m: 16px;
  --ae-font-size-s: 14px;
}

.ae-page {
  margin: 0 auto;
  padding: 0 8px;
  max-width: 768px;
  min-height: 100vh;

  overflow-y: scroll;

  display: grid;
  grid-template-rows: auto 1fr auto;

  font-size: var(--ae-font-size-m);
}

.ae-page-header {
  margin: 16px 0 0;

  display: grid;
  align-items: baseline;
  grid-template-columns: 1fr auto;

  /* @todo: remove this when font will be a variable */
  min-height: 28px;
}

.ae-page-main {
  min-width: 0;
}

.ae-page-footer {
  margin: 0 0 16px;

  font-size: var(--ae-font-size-s);
  text-align: center;
}

.header-link {
  font-weight: 600;
}

.ae-hr {
  margin: 16px 0;
}

.ae-mode-bar {
  margin: 2px 0;
  padding: 2px;
  border-radius: 2px;

  text-align: center;
}

@media (width > 768px) {
  .ae-mode-bar {
    margin: 4px 0;
  }
}

.ae-form {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px;
}

@media (width > 768px) {
  .ae-form {
    gap: 4px;
  }
}

.ae-form.is-compact {
  margin: 16px 24px;
}

.ae-field {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
}

.ae-field-label {
  padding: 4px;
  border-radius: 2px;

  font-size: var(--ae-font-size-s);
}

@media (width > 768px) {
  .ae-field-label {
    font-size: var(--ae-font-size-m);
  }
}

.ae-field-input,
.ae-field-textarea,
.ae-field-select,
.ae-field-button {
  padding: 4px;
  box-sizing: border-box;
}

.ae-field-input,
.ae-field-textarea {
  font-family: monospace;
  font-size: var(--ae-font-size-m);
}

.ae-field-textarea {
  resize: vertical;
}

.ae-field-group {
  display: flex;
  gap: 4px;
  flex-direction: row;
  align-items: center;
}

.ae-field-group .ae-field-input {
  width: 100%;
}

.ae-field.is-misc {
  align-items: center;
}

.ae-field.is-misc .ae-field-label {
  background-color: transparent;
}

.ae-actions {
  margin-top: 12px;

  display: flex;
  justify-content: flex-end;
}

.ae-actions-label {
  font-size: var(--ae-font-size-s);
}

.ae-thread-status {
  margin: 16px 8px;

  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;

  font-size: var(--ae-font-size-s);
}

.ae-post.is-reply,
.ae-post.is-thread {
  display: block;
  max-width: fit-content;
  margin: 2px 0;
  padding: 4px;
}

@media (width > 768px) {
  .ae-post.is-reply,
  .ae-post.is-thread {
    margin: 4px 0;
  }
}

.ae-post.is-catalog {
  display: block;
  margin: 8px 0;

  text-decoration: none;
  color: inherit;

  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.post-numbers {
  font-weight: 600;
}

.ae-post-header {
  margin: 0 4px;
}

.post-checkbox {
  width: 14px;
  height: 14px;

  margin: 3px 2px 3px 0px;
  vertical-align: baseline;
}

.post-subject {
  font-weight: 600;
}

.post-name {
  font-weight: 600;
}

.post-id {
  text-decoration: none;
}

.post-message {
  overflow-wrap: anywhere;
  word-break: normal;
}

.post-truncated {
  text-decoration: dashed underline 0.6px;

  cursor: default;
}

.post-message,
.post-truncated,
.post-backlinks,
.post-omitted {
  margin: 14px 6px;
}

@media (width > 768px) {
  .post-message,
  .post-truncated,
  .post-backlinks,
  .post-omitted {
    margin: 14px 25px;
  }
}

.markup-spoiler:hover {
  color: inherit !important;
  background-color: inherit !important;
}

.markup-banmessage {
  font-weight: 600;
}

.pages {
  padding: 0 24px;
}

.pages-toggle {
  margin: 16px 0;

  display: flex;
  justify-content: space-between;
}

.pages-list {
  margin: 8px 0;

  letter-spacing: 2px;
  text-align: justify;
}

.js-loading {
  animation: loading 0.5s infinite;
}

@keyframes loading {
  50% {
    opacity: 0;
  }
}

.js-floater {
  max-width: 768px;
  box-shadow: 8px 8px 0px 0px #00000010;
  position: fixed;

  background-color: lightgray;
  border-radius: 2px;

  border: solid 1px #ababb5;
}

.js-floater .ae-post {
  margin: 0;
}

.js-hide,
.js-show {
  border: none;
  background: none;
  padding: 0;

  display: inline-block;

  color: inherit;
  letter-spacing: 2px;
}

#img-gd-captcha {
  cursor: pointer;
}

/***************************************************************************
 * Management Panel styles
 *
 * @todo: Should be moved into a separate CSS file
 */

.ae-manage-actions-row {
  margin: 16px 0;

  display: flex;
  flex-wrap: wrap;

  gap: 8px;
}

/***************************************************************************
 * Futaba Style
 */

[data-style='futaba'] a {
  color: #0000ee;
}

[data-style='futaba'] a:hover {
  color: #dd0000;
}

[data-style='futaba'] .ae-page {
  color: #800000;
  background-color: #ffffee;

  font-family: serif;
}

[data-style='futaba'] .ae-hr {
  height: 2px;

  border: none;
  border-radius: 2px;

  background-color: #f0e0d6;
}

[data-style='futaba'] .ae-mode-bar.is-regular {
  color: #ffffff;
  background-color: #e04000;
}

[data-style='futaba'] .ae-mode-bar.is-success {
  color: #ffffff;
  background-color: #00b930;
}

[data-style='futaba'] .ae-field-label {
  color: #800000;
  background-color: #eeaa88;

  font-weight: 600;
}

[data-style='futaba'] .post-subject {
  color: #cc1105;
}

[data-style='futaba'] .post-name {
  color: #117743;
}

[data-style='futaba'] .post-tripcode {
  color: #228854;
}

[data-style='futaba'] .post-id {
  color: inherit;
}

[data-style='futaba'] .markup-quote {
  color: #789922;
}

[data-style='futaba'] .markup-spoiler {
  border-radius: 2px;

  color: #800000;
  background-color: #800000;
}

[data-style='futaba'] .markup-banmessage {
  color: #ff0000;
}

[data-style='futaba'] .post-backlinks,
[data-style='futaba'] .post-truncated,
[data-style='futaba'] .post-omitted {
  font-style: italic;
  color: #707070;
}

[data-style='futaba'] .ae-post.is-thread {
  background-color: #ffffee;
}

[data-style='futaba'] .ae-post.is-reply {
  background-color: #f0e0d6;
  border-radius: 2px;
}

[data-style='futaba'] .post-capcode.is-admin {
  color: #ff0000;
}

[data-style='futaba'] .post-capcode.is-mod {
  color: #800080;
}

[data-style='futaba'] .js-floater {
  background-color: #ffffee;
}

/***************************************************************************
 * Burichan Style
 */

[data-style='burichan'] a {
  color: #34345c;
}

[data-style='burichan'] a:hover {
  color: #dd0000;
}

[data-style='burichan'] .ae-page {
  color: #000000;
  background-color: #eef2ff;

  font-family: serif;
}

[data-style='burichan'] .ae-hr {
  height: 2px;

  border: none;
  border-radius: 2px;

  background-color: #d6daf0;
}

[data-style='burichan'] .ae-mode-bar.is-regular {
  color: #ffffff;
  background-color: #0010e0;
}

[data-style='burichan'] .ae-mode-bar.is-success {
  color: #ffffff;
  background-color: #00b930;
}

[data-style='burichan'] .ae-field-label {
  color: #000000;
  background-color: #9988ee;

  font-weight: 600;
}

[data-style='burichan'] .post-subject {
  color: #0f0c5d;
}

[data-style='burichan'] .post-name {
  color: #117743;
}

[data-style='burichan'] .post-id {
  color: inherit;
}

[data-style='burichan'] .markup-quote {
  color: #789922;
}

[data-style='burichan'] .markup-spoiler {
  border-radius: 2px;

  color: #000000;
  background-color: #000000;
}

[data-style='burichan'] .markup-banmessage {
  color: #ff0000;
}

[data-style='burichan'] .post-backlinks,
[data-style='burichan'] .post-truncated,
[data-style='burichan'] .post-omitted {
  font-style: italic;
  color: #707070;
}

[data-style='burichan'] .ae-post.is-thread {
  background-color: #eef2ff;
}

[data-style='burichan'] .ae-post.is-reply {
  background-color: #d6daf0;
  border-radius: 2px;
}

[data-style='burichan'] .post-capcode.is-admin {
  color: #ff0000;
}

[data-style='burichan'] .post-capcode.is-mod {
  color: #800080;
}

[data-style='burichan'] .js-floater {
  background-color: #eef2ff;
}

/***************************************************************************
 * Courier Style
 */

[data-style='courier'] a {
  color: #0000ff;
}

[data-style='courier'] a:hover {
  color: #ff0000;
}

[data-style='courier'] .ae-page {
  color: #000000;
  background-color: #c1c1c1;

  font-family: serif;
}

[data-style='courier'] .ae-field-label {
  padding-left: 0;
}

[data-style='courier'] .post-subject {
  color: #8b0000;
}

[data-style='courier'] .post-name {
  color: #006400;
}

[data-style='courier'] .post-tripcode {
  color: #008000;
}

[data-style='courier'] .post-id {
  color: inherit;
}

[data-style='courier'] .markup-quote {
  color: #008000;
}

[data-style='courier'] .markup-spoiler {
  color: #000000;
  background-color: #000000;
}

[data-style='courier'] .markup-banmessage {
  color: #ff0000;
}

[data-style='courier'] .post-backlinks,
[data-style='courier'] .post-truncated,
[data-style='courier'] .post-omitted {
  font-size: var(--ae-font-size-s);
}

[data-style='courier'] .ae-post.is-thread {
  background-color: #c1c1c1;
}

[data-style='courier'] .ae-post.is-reply {
  background-color: #fefefe;
}

[data-style='courier'] .post-capcode.is-admin {
  color: #ff0000;
}

[data-style='courier'] .post-capcode.is-mod {
  color: #800080;
}

[data-style='courier'] .js-floater {
  background-color: #ffffee;
}

/***************************************************************************
 * Nightshift Style
 */

[data-style='nightshift'] {
  color-scheme: dark light;
}

[data-style='nightshift'] a {
  color: #d0cdc8;
}

[data-style='nightshift'] a:hover {
  color: #a19b91;
}

[data-style='nightshift'] .ae-page {
  color: #d0cdc8;
  background-color: #212121;

  font-family: 'Tahoma', sans-serif;

  color-scheme: dark light;
}

[data-style='nightshift'] .ae-page-headr {
  font-size: var(--ae-font-size-s);
}

[data-style='nightshift'] .ae-hr {
  height: 1px;

  border: none;
  background-color: #303030;
}

[data-style='nightshift'] .ae-mode-bar.is-regular {
  font-size: var(--ae-font-size-s);
  color: #ffffff;
  background-color: #303030;
}

[data-style='nightshift'] .ae-mode-bar.is-success {
  font-size: var(--ae-font-size-s);
  color: #ffffff;
  background-color: #00a67d;
}

[data-style='nightshift'] .ae-field-label {
  font-size: var(--ae-font-size-s);

  background-color: #303030;
}

[data-style='nightshift'] .ae-post-header {
  font-size: var(--ae-font-size-s);
}

[data-style='nightshift'] .post-name {
  font-weight: 400;
}

[data-style='nightshift'] .post-tripcode {
  color: #02a87f;
}

[data-style='nightshift'] .post-id {
  color: inherit;
}

[data-style='nightshift'] .markup-quote {
  color: #02a87f;
}

[data-style='nightshift'] .markup-spoiler {
  border-radius: 2px;

  color: #d0cdc8;
  background-color: #d0cdc8;
}

[data-style='nightshift'] .markup-banmessage {
  color: #f22c3d;
}

[data-style='nightshift'] .post-backlinks,
[data-style='nightshift'] .post-truncated,
[data-style='nightshift'] .post-omitted {
  font-size: var(--ae-font-size-s);
  color: #a19b91;
}

[data-style='nightshift'] .ae-post.is-thread {
  background-color: #212121;
}

[data-style='nightshift'] .ae-post.is-reply {
  background-color: #303030;
  border-radius: 6px;
}

[data-style='nightshift'] .post-capcode.is-admin {
  color: #f22c3d;
}

[data-style='nightshift'] .post-capcode.is-mod {
  color: #c8306f;
}

[data-style='nightshift'] .js-floater {
  background-color: #212121;
  border-color: #212121;

  border-radius: 6px;
}
