@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #008080;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 11px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
  cursor: default;
  -webkit-font-smoothing: none;
}

.win98-window {
  background: #c0c0c0;
  border-top: 2px solid #ffffff;
  border-left: 2px solid #ffffff;
  border-right: 2px solid #404040;
  border-bottom: 2px solid #404040;
  box-shadow: inset 1px 1px 0 #dfdfdf, inset -1px -1px 0 #808080, 1px 1px 0 #000;
  max-width: 640px;
  width: 100%;
  position: relative;
}

.title-bar {
  background: linear-gradient(90deg, #000080, #1084d0);
  padding: 3px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.title-bar-text {
  color: #ffffff;
  font-weight: bold;
  font-size: 11px;
  padding-left: 3px;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.title-bar-controls {
  display: flex;
  gap: 2px;
}

.title-btn {
  width: 16px;
  height: 14px;
  background: #c0c0c0;
  border-top: 1px solid #ffffff;
  border-left: 1px solid #ffffff;
  border-right: 1px solid #404040;
  border-bottom: 1px solid #404040;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-family: 'Segoe UI', Tahoma, sans-serif;
}

.title-btn:active {
  border-top: 1px solid #404040;
  border-left: 1px solid #404040;
  border-right: 1px solid #ffffff;
  border-bottom: 1px solid #ffffff;
}

.window-body {
  display: flex;
  min-height: 400px;
}

.sidebar {
  width: 164px;
  min-width: 164px;
  background: linear-gradient(180deg, #000080 0%, #0055aa 30%, #0078c8 60%, #00a5e0 100%);
  padding: 20px 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  overflow: hidden;
}

.sidebar-logo {
  font-family: 'VT323', monospace;
  color: rgba(255,255,255,0.85);
  font-size: 22px;
  text-align: center;
  margin-top: 20px;
  line-height: 1.3;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.sidebar-logo span {
  display: block;
  font-size: 14px;
  color: rgba(255,255,255,0.6);
  margin-top: 4px;
}

.sidebar-cloud {
  position: absolute;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
}

.sidebar-cloud-1 {
  width: 120px;
  height: 40px;
  bottom: 80px;
  left: -20px;
}

.sidebar-cloud-2 {
  width: 90px;
  height: 30px;
  bottom: 40px;
  right: -15px;
}

.sidebar-cloud-3 {
  width: 140px;
  height: 50px;
  bottom: 120px;
  left: 10px;
}

.main-content {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.content-title {
  font-size: 13px;
  font-weight: bold;
  margin-bottom: 12px;
  color: #000;
}

.content-text {
  font-size: 11px;
  color: #000;
  margin-bottom: 12px;
  line-height: 1.5;
}

.key-input-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 12px 0;
  flex-wrap: wrap;
  justify-content: center;
}

.key-input {
  width: 62px;
  height: 22px;
  border-top: 2px solid #808080;
  border-left: 2px solid #808080;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  background: #ffffff;
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  text-align: center;
  letter-spacing: 2px;
  text-transform: uppercase;
  outline: none;
  padding: 0 2px;
}

.key-input:focus {
  background: #ffffcc;
}

.key-dash {
  font-size: 14px;
  font-weight: bold;
  color: #000;
  user-select: none;
}

.divider {
  height: 2px;
  background: #808080;
  border-bottom: 1px solid #ffffff;
  margin: 12px 0;
}

.button-row {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.win98-btn {
  min-width: 75px;
  height: 23px;
  background: #c0c0c0;
  border-top: 2px solid #ffffff;
  border-left: 2px solid #ffffff;
  border-right: 2px solid #404040;
  border-bottom: 2px solid #404040;
  font-family: 'Segoe UI', Tahoma, sans-serif;
  font-size: 11px;
  cursor: pointer;
  padding: 0 12px;
  outline: none;
  box-shadow: inset 1px 1px 0 #dfdfdf, inset -1px -1px 0 #808080;
}

.win98-btn:active {
  border-top: 2px solid #404040;
  border-left: 2px solid #404040;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  box-shadow: inset 1px 1px 0 #808080, inset -1px -1px 0 #dfdfdf;
  padding: 1px 11px 0 13px;
}

.win98-btn:focus {
  outline: 1px dotted #000;
  outline-offset: -4px;
}

.win98-btn-primary {
  font-weight: bold;
}

.win98-btn:disabled {
  color: #808080;
  text-shadow: 1px 1px 0 #ffffff;
  cursor: default;
}

.status-bar {
  background: #c0c0c0;
  border-top: 2px solid #808080;
  display: flex;
  align-items: center;
  padding: 2px 4px;
  font-size: 11px;
  gap: 4px;
}

.status-section {
  border-top: 1px solid #808080;
  border-left: 1px solid #808080;
  border-right: 1px solid #ffffff;
  border-bottom: 1px solid #ffffff;
  padding: 1px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-left {
  flex: 1;
}

.status-right {
  min-width: 120px;
  text-align: right;
}

.resize-grip {
  width: 12px;
  height: 12px;
  position: relative;
  margin-left: 2px;
  flex-shrink: 0;
}

.resize-grip::before {
  content: '';
  position: absolute;
  right: 0;
  bottom: 0;
  width: 10px;
  height: 10px;
  background:
    linear-gradient(135deg,
      transparent 30%,
      #808080 30%, #808080 40%,
      transparent 40%, transparent 55%,
      #808080 55%, #808080 65%,
      transparent 65%, transparent 80%,
      #808080 80%, #808080 90%,
      transparent 90%
    );
}

/* Results panel */
.results-panel {
  border-top: 2px solid #808080;
  border-left: 2px solid #808080;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  background: #ffffff;
  padding: 10px;
  margin: 10px 0;
  font-size: 11px;
}

.result-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.result-icon {
  font-size: 16px;
  flex-shrink: 0;
  line-height: 1;
}

.result-label {
  font-weight: bold;
  min-width: 80px;
  color: #000;
}

.result-value {
  color: #000080;
  font-weight: bold;
}

.result-valid {
  color: #008000;
}

.result-invalid {
  color: #cc0000;
}

.segment-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 10px;
}

.segment-table th,
.segment-table td {
  border: 1px solid #c0c0c0;
  padding: 3px 6px;
  text-align: left;
}

.segment-table th {
  background: #c0c0c0;
  font-weight: bold;
}

.segment-table td {
  font-family: 'Courier New', monospace;
}

.trivia-box {
  background: #ffffcc;
  border: 1px solid #cccc99;
  padding: 6px 8px;
  margin-top: 8px;
  font-size: 10px;
  font-style: italic;
  color: #666600;
}

.trivia-box strong {
  font-style: normal;
  color: #333300;
}

/* History panel */
.history-panel {
  margin-top: 8px;
}

.history-header {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
  font-size: 11px;
  color: #000;
  margin-bottom: 4px;
}

.history-header:hover {
  text-decoration: underline;
}

.history-list {
  border-top: 2px solid #808080;
  border-left: 2px solid #808080;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  background: #ffffff;
  max-height: 120px;
  overflow-y: auto;
  font-size: 10px;
}

.history-item {
  padding: 2px 6px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Courier New', monospace;
}

.history-item:hover {
  background: #000080;
  color: #ffffff;
}

.history-item:hover .history-type {
  color: #ffffff;
}

.history-type {
  font-family: 'Segoe UI', Tahoma, sans-serif;
  font-size: 10px;
  color: #808080;
}

.history-empty {
  padding: 8px;
  text-align: center;
  color: #808080;
  font-style: italic;
}

/* Easter egg */
.clippy-bubble {
  position: relative;
  background: #ffffcc;
  border: 2px solid #000;
  padding: 10px 12px;
  margin: 10px 0;
  font-size: 11px;
  line-height: 1.5;
  border-radius: 0;
}

.clippy-bubble::before {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 30px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 10px solid #000;
}

.clippy-bubble::after {
  content: '';
  position: absolute;
  bottom: -7px;
  left: 32px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid #ffffcc;
}

.clippy-face {
  font-size: 28px;
  text-align: left;
  margin-top: 4px;
  line-height: 1;
}

/* Tooltip */
.tooltip-container {
  position: relative;
  display: inline-flex;
}

.tooltip {
  display: none;
  position: absolute;
  background: #ffffe1;
  border: 1px solid #000;
  padding: 2px 6px;
  font-size: 11px;
  white-space: nowrap;
  z-index: 999;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 4px;
  pointer-events: none;
}

.tooltip-container:hover .tooltip {
  display: block;
}

/* Footer link */
.berrry-link {
  color: #808080;
  text-decoration: none;
  font-size: 10px;
}

.berrry-link:hover {
  text-decoration: underline;
  color: #000080;
}

/* Hourglass cursor */
.loading {
  cursor: wait !important;
}

.loading * {
  cursor: wait !important;
}

/* Scrollbar styling */
.history-list::-webkit-scrollbar {
  width: 16px;
}

.history-list::-webkit-scrollbar-track {
  background: #c0c0c0;
  border: 1px solid #808080;
}

.history-list::-webkit-scrollbar-thumb {
  background: #c0c0c0;
  border-top: 2px solid #ffffff;
  border-left: 2px solid #ffffff;
  border-right: 2px solid #404040;
  border-bottom: 2px solid #404040;
}

/* Responsive */
@media (max-width: 580px) {
  body {
    padding: 8px;
    align-items: flex-start;
  }

  .sidebar {
    display: none;
  }

  .key-input {
    width: 50px;
    font-size: 11px;
  }

  .win98-window {
    max-width: 100%;
  }

  .title-bar-text {
    font-size: 10px;
  }

  .button-row {
    justify-content: center;
  }
}

/* Copy button confirmation */
.copy-confirm {
  color: #008000;
  font-size: 10px;
  margin-left: 4px;
  animation: fadeIn 0.2s;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}