* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: #333;
  background: #fff;
}

.hidden {
  display: none !important;
}

.site-header {
  text-align: center;
  padding: 18px 16px 4px;
}

.site-header h1 {
  margin: 0 0 4px;
  font-size: 26px;
}

.tagline {
  margin: 0;
  color: #777;
  font-size: 14px;
}

main {
  max-width: 1500px;
  margin: 0 auto;
  padding: 12px 16px;
}

/* ---- Result view ---- */

.result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.diff-summary {
  font-size: 14px;
  color: #555;
}

.diff-summary.identical {
  color: #3c763d;
}

.diff-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.diff-nav button {
  border: 1px solid #ccc;
  background: #f7f7f7;
  border-radius: 4px;
  padding: 2px 8px;
  cursor: pointer;
  font-size: 12px;
  color: #b8860b;
}

.diff-nav button:hover:enabled {
  background: #eee;
}

.diff-nav button:disabled {
  opacity: 0.4;
  cursor: default;
}

#diff-position {
  font-size: 13px;
  color: #777;
  min-width: 48px;
}

.view-toggle {
  display: flex;
}

.view-toggle button {
  border: 1px solid #ccc;
  background: #f7f7f7;
  padding: 3px 12px;
  cursor: pointer;
  font-size: 12px;
  color: #555;
}

.view-toggle button:first-child {
  border-radius: 4px 0 0 4px;
}

.view-toggle button:last-child {
  border-radius: 0 4px 4px 0;
  border-left: none;
}

.view-toggle button:hover {
  background: #eee;
}

.view-toggle button.active {
  background: #5cb85c;
  border-color: #4cae4c;
  color: #fff;
}

.result-panels {
  display: flex;
  gap: 12px;
}

.result-panel {
  flex: 1 1 50%;
  min-width: 0;
}

.panel-title {
  font-size: 13px;
  font-weight: bold;
  color: #777;
  margin-bottom: 4px;
}

.diff-output {
  border: 1px solid #bbb;
  border-radius: 3px;
  font-family: "Courier New", Courier, monospace;
  font-size: 14px;
  line-height: 1.45;
  overflow-x: auto;
  background: #fff;
}

.diff-row {
  display: flex;
  white-space: pre-wrap;
  word-break: break-word;
}

.gutter {
  flex: 0 0 34px;
  text-align: right;
  padding: 0 6px 0 2px;
  color: #3c763d;
  background: #dff0d8;
  border-right: 1px solid #d6e9c6;
  user-select: none;
}

.row-content {
  flex: 1 1 auto;
  padding: 0 6px;
  min-width: 0;
}

.diff-row-changed .row-content {
  background: #fbfbfb;
}

.diff-row-empty .row-content {
  background: #f0f0f0;
}

.diff-row-empty .gutter {
  background: #eee;
  border-right-color: #ddd;
  color: transparent;
}

.word-changed {
  background: #a3c3ea;
  border-radius: 2px;
}

.diff-row-current .row-content {
  background: #fff6d9;
}

.diff-row-current .word-changed {
  background: #7fa9e0;
}

/* ---- Aligned (pyaliner-style) view ---- */

.aligned-output {
  border: 1px solid #1a1e23;
  border-radius: 3px;
  background: #22272e;
  color: #c9d1d9;
  font-family: "Courier New", Courier, monospace;
  font-size: 14px;
  line-height: 1.5;
  padding: 12px 14px;
  overflow-x: auto;
}

.aligned-pair {
  margin-bottom: 1.4em;
}

.aligned-pair:last-child {
  margin-bottom: 0;
}

.aligned-line {
  white-space: pre;
}

.aligned-changed-top {
  color: #45b8e8;
  font-weight: bold;
}

.aligned-changed-bottom {
  color: #e8683f;
  font-weight: bold;
}

.aligned-gap {
  color: #768390;
}

.aligned-pair.diff-row-current {
  background: rgba(255, 246, 217, 0.12);
  border-radius: 3px;
}

/* ---- Action buttons ---- */

.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 0;
}

.actions-left {
  display: flex;
  gap: 8px;
}

.actions button {
  font-size: 14px;
  padding: 8px 16px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}

.actions button:hover {
  background: #f2f2f2;
}

.compare-btn {
  background: #5cb85c !important;
  border-color: #4cae4c !important;
  color: #fff;
  font-size: 18px !important;
  padding: 10px 28px !important;
}

.compare-btn:hover {
  background: #449d44 !important;
}

/* ---- Input view ---- */

.input-panels {
  display: flex;
  gap: 12px;
}

.input-panels textarea {
  flex: 1 1 50%;
  min-width: 0;
  height: 360px;
  padding: 10px;
  border: 1px solid #bbb;
  border-radius: 3px;
  font-family: "Courier New", Courier, monospace;
  font-size: 14px;
  color: #2e7d32;
  resize: vertical;
}

.input-panels textarea:focus {
  outline: none;
  border-color: #5cb85c;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Informational content ---- */

.info-section {
  max-width: 760px;
  margin: 48px auto 0;
  padding-top: 8px;
  border-top: 1px solid #eee;
  font-size: 15px;
  line-height: 1.6;
  color: #444;
}

.info-section h2 {
  font-size: 20px;
  margin: 28px 0 8px;
  color: #333;
}

.info-section h3 {
  font-size: 16px;
  margin: 18px 0 4px;
  color: #333;
}

.info-section p {
  margin: 0 0 12px;
}

.info-section ul {
  margin: 0 0 12px;
  padding-left: 22px;
}

.info-section li {
  margin-bottom: 4px;
}

.example-figure {
  margin: 0 0 24px;
}

.example-figure img {
  max-width: 100%;
  height: auto;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.example-figure figcaption {
  margin-top: 6px;
  font-size: 13px;
  color: #777;
  line-height: 1.5;
}

.site-footer {
  text-align: center;
  color: #999;
  font-size: 12px;
  padding: 16px;
}

@media (max-width: 700px) {
  .result-panels,
  .input-panels {
    flex-direction: column;
  }

  .actions {
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
  }
}
