/* asciiart.cc — in-browser ASCII art generator page. */

.gen-page {
  direction: ltr;
  text-align: left;
  max-width: 1180px;
}

/* Hero */
.gen-hero {
  margin: 0 0 22px;
}
.gen-hero h1 {
  margin: 0 0 10px;
  font-size: 26px;
  line-height: 1.3;
  font-weight: 600;
  color: #263646;
}
.gen-lead {
  margin: 0;
  max-width: 780px;
  font-size: 15px;
  line-height: 1.7;
  color: #6b7c93;
}

/* Tabs */
.gen-tabs {
  display: inline-flex;
  gap: 4px;
  margin: 0 0 20px;
  padding: 4px;
  border-radius: 8px;
  background-color: #edf4f9;
}
.gen-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border: 0;
  border-radius: 6px;
  background-color: transparent;
  color: #5b7288;
  font-family: lato, arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s, box-shadow 0.15s;
}
.gen-tab svg {
  width: 17px;
  height: 17px;
  flex: none;
}
.gen-tab:hover {
  color: #1bb1dc;
}
.gen-tab.is-active {
  background-color: #fff;
  color: #1bb1dc;
  box-shadow: 0 2px 8px rgba(0, 64, 128, 0.12);
}
.gen-tab:focus-visible {
  outline: 2px solid #1bb1dc;
  outline-offset: 2px;
}

/* Layout */
.gen-grid {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.gen-card {
  box-sizing: border-box;
  background-color: #fff;
  border-radius: 6px;
  padding: 20px;
  box-shadow: 0 10px 29px 0 rgba(68, 88, 144, 0.1);
}
.gen-card h2 {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #899bb3;
}

.gen-page [hidden] {
  display: none !important;
}

/* File input: visually hidden but still focusable */
.gen-file {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Drop zone */
.gen-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 232px;
  padding: 22px;
  border: 2px dashed #d8e6f1;
  border-radius: 6px;
  background-color: #fbfdff;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}
.gen-drop:hover,
.gen-drop.is-drag {
  border-color: #1bb1dc;
  background-color: #f4fbff;
}
.gen-file:focus-visible + .gen-drop {
  outline: 2px solid #1bb1dc;
  outline-offset: 2px;
}

.gen-drop-icon {
  display: block;
  width: 42px;
  height: 42px;
  margin: 0 auto 12px;
  color: #9fc3dd;
}
.gen-drop-title {
  display: block;
  margin-bottom: 7px;
  font-size: 15px;
  line-height: 1.4;
  font-weight: 600;
  color: #35506b;
}
.gen-drop-hint {
  display: block;
  font-size: 12px;
  line-height: 1.6;
  color: #899bb3;
}
.gen-drop-paste {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.6;
  color: #a8b7c7;
}

.gen-preview {
  width: 100%;
}
.gen-preview-img {
  display: block;
  max-width: 100%;
  max-height: 260px;
  width: auto;
  height: auto;
  margin: 0 auto 14px;
  border-radius: 4px;
  background-color: #fff;
  background-image: repeating-conic-gradient(#eef3f8 0 25%, #fff 0 50%);
  background-size: 16px 16px;
}
.gen-filename {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: #899bb3;
  overflow-wrap: anywhere;
}

/* Text source */
.gen-textarea {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-height: 150px;
  max-height: 340px;
  padding: 12px 14px;
  border: 1px solid #e0eaf3;
  border-radius: 4px;
  background-color: #fff;
  color: #263646;
  font-family: lato, arial, "PingFang SC", "Hiragino Sans", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  outline: none;
  resize: vertical;
  -webkit-user-select: text;
  user-select: text;
  transition: border-color 0.15s;
}
.gen-textarea:focus {
  border-color: #1bb1dc;
}
.gen-textarea::placeholder {
  color: #b3c1cf;
}
.gen-text-meta {
  margin-top: 6px;
  color: #a8b7c7;
  font-size: 12px;
  line-height: 1.4;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.gen-text-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 18px;
}
.gen-page.is-text .gen-text-card {
  grid-column: 1 / -1;
}
.gen-note {
  margin: 16px 0 0;
  color: #899bb3;
  font-size: 12px;
  line-height: 1.7;
}
.gen-warning {
  margin: 8px 0 0;
  color: #c26a2e;
  font-size: 12px;
  line-height: 1.6;
}

/* Buttons */
.gen-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid #dbe7f0;
  border-radius: 5px;
  background-color: #fff;
  color: #35506b;
  font-family: lato, arial, sans-serif;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}
.gen-btn:hover {
  border-color: #1bb1dc;
  color: #1bb1dc;
}
.gen-btn:focus-visible {
  outline: 2px solid #1bb1dc;
  outline-offset: 2px;
}
.gen-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.gen-btn:disabled:hover {
  border-color: #dbe7f0;
  color: #35506b;
}
.gen-btn-primary {
  border-color: #1bb1dc;
  background-color: #1bb1dc;
  color: #fff;
}
.gen-btn-primary:hover {
  border-color: #159ac1;
  background-color: #159ac1;
  color: #fff;
}
.gen-btn-primary:disabled:hover {
  border-color: #1bb1dc;
  background-color: #1bb1dc;
  color: #fff;
}
.gen-btn-change {
  min-height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

/* Controls */
.gen-controls {
  display: grid;
  gap: 18px;
}
.gen-control {
  min-width: 0;
}
.gen-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #35506b;
}
.gen-value {
  min-width: 34px;
  padding: 2px 8px;
  border-radius: 20px;
  background-color: #eef9fe;
  color: #1bb1dc;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
}

.gen-range {
  display: block;
  width: 100%;
  height: 20px;
  margin: 0;
  accent-color: #1bb1dc;
  cursor: pointer;
}

.gen-select,
.gen-input {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid #e0eaf3;
  border-radius: 4px;
  background-color: #fff;
  color: #263646;
  font-family: lato, arial, sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.gen-select {
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23899bb3' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.gen-select:focus-visible,
.gen-input:focus-visible {
  border-color: #1bb1dc;
}
.gen-input {
  margin-top: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.gen-toggles {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
}
.gen-switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: #35506b;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.gen-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.gen-track {
  position: relative;
  flex: none;
  width: 40px;
  height: 22px;
  border-radius: 22px;
  background-color: #dce7f1;
  transition: background-color 0.2s;
}
.gen-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: #fff;
  box-shadow: 0 1px 3px rgba(0, 64, 128, 0.25);
  transition: transform 0.2s;
}
.gen-switch input:checked + .gen-track {
  background-color: #1bb1dc;
}
.gen-switch input:checked + .gen-track::after {
  transform: translateX(18px);
}
.gen-switch input:focus-visible + .gen-track {
  outline: 2px solid #1bb1dc;
  outline-offset: 2px;
}

/* Output */
.gen-output-card {
  margin-top: 20px;
  padding: 0;
  overflow: hidden;
}
.gen-output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-bottom: 1px solid #eef3f8;
}
.gen-output-meta {
  min-width: 0;
}
.gen-output-head h2 {
  margin: 0 0 3px;
}
.gen-stats {
  min-height: 18px;
  font-size: 12px;
  line-height: 1.5;
  color: #899bb3;
  font-variant-numeric: tabular-nums;
}
.gen-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.gen-output-body {
  box-sizing: border-box;
  max-height: 72vh;
  padding: 18px 20px;
  overflow: auto;
  background-color: #fff;
  text-align: left;
}
.gen-output-body.is-color {
  background-color: #fff;
}

.gen-pre {
  display: block;
  width: max-content;
  min-width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #263646;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 10px;
  line-height: 1.02;
  font-weight: 400;
  letter-spacing: 0;
  white-space: pre;
  -webkit-user-select: text;
  user-select: text;
}
.gen-output-body.is-color .gen-pre {
  width: max-content;
  min-width: 0;
  padding: 14px 16px;
  border-radius: 4px;
  background-color: #0f172a;
  color: #e8eef7;
}

.gen-page.is-text .gen-pre {
  width: max-content;
  min-width: 0;
  margin-left: auto;
  margin-right: auto;
  font-size: 13px;
  line-height: 1.05;
}

.gen-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 180px;
  padding: 30px 20px;
  color: #a8b7c7;
  font-size: 14px;
  text-align: center;
}
.gen-empty-icon {
  width: 40px;
  height: 40px;
  color: #c6d6e4;
}

/* Toast */
.gen-toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: 1000;
  padding: 10px 18px;
  border-radius: 6px;
  background-color: #263646;
  color: #fff;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 0.25s, transform 0.25s;
}
.gen-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.gen-toast.is-error {
  background-color: #d64545;
}

/* Responsive */
@media screen and (max-width: 1080px) {
  .gen-page {
    padding-left: 12px;
    padding-right: 12px;
  }
  .gen-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .gen-drop {
    min-height: 200px;
  }
  .gen-output-body {
    max-height: none;
  }
}

@media screen and (max-width: 640px) {
  .gen-tabs {
    display: flex;
    width: 100%;
    box-sizing: border-box;
  }
  .gen-tab {
    flex: 1;
    justify-content: center;
    padding: 9px 8px;
    font-size: 13px;
  }
  .gen-tab svg {
    width: 15px;
    height: 15px;
  }
  .gen-textarea {
    min-height: 130px;
  }
  .gen-text-options {
    grid-template-columns: minmax(0, 1fr);
  }
  .gen-hero h1 {
    font-size: 21px;
  }
  .gen-lead {
    font-size: 14px;
  }
  .gen-card {
    padding: 16px;
  }
  .gen-output-head,
  .gen-output-body {
    padding-left: 14px;
    padding-right: 14px;
  }
  .gen-output-head {
    align-items: flex-start;
  }
  .gen-pre,
  .gen-page.is-text .gen-pre {
    font-size: 7px;
  }
  .gen-actions {
    width: 100%;
  }
  .gen-btn {
    flex: 1 1 auto;
  }
  .gen-preview-img {
    max-height: 220px;
  }
}
