* {
  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;
}

.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;
}

/* ---- 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;
}

.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;
  }
}
