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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: #f5f5f5;
  min-height: 100vh;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.ie-warning {
  background-color: #fff3cd;
  border: 1px solid #ffeeba;
  color: #856404;
  padding: 12px;
  text-align: center;
  margin-bottom: 20px;
  border-radius: 8px;
}

.container {
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.title-section {
  text-align: center;
  margin-bottom: 30px;
}

.title {
  font-size: 28px;
  font-weight: 700;
  color: #333;
  margin-bottom: 10px;
}

.title .version-btn {
  font-size: 10px;
  color: #999;
  font-weight: normal;
  margin-left: 10px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s ease;
}

.title .version-btn:hover {
  color: #666;
}

.subtitle-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
}

.subtitle {
  font-size: 16px;
  color: #666;
}

.rule-link-btn {
  font-size: 11px;
  color: #e67e22;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
  transition: all 0.2s ease;
}

.rule-link-btn:hover {
  color: #f5a062;
}

.main-card {
  display: flex;
  gap: 30px;
  background: white;
  border-radius: 16px;
  padding: 30px;
  margin-bottom: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.input-column {
  flex: 1;
  padding-right: 20px;
}

.result-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.unit-selector {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.unit-btn {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #E0E0E0;
  border-radius: 10px;
  background: white;
  font-size: 14px;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  transition: all 0.3s ease;
}

.unit-btn:hover {
  border-color: #EA4335;
}

.unit-btn[data-unit="cm"]:hover {
  border-color: #34A853;
}

.unit-btn.active {
  border-color: #EA4335;
  background: #EA4335;
  color: white;
}

.unit-btn[data-unit="cm"].active {
  border-color: #34A853;
  background: #34A853;
}

.input-section {
  margin-bottom: 20px;
}

.label {
  display: block;
  font-size: 14px;
  color: #666;
  margin-bottom: 8px;
}

.input-box {
  width: 100%;
  height: 60px;
  border: 2px solid #E0E0E0;
  border-radius: 12px;
  padding: 0 20px;
  font-size: 18px;
  font-family: 'SF Mono', 'Monaco', 'Consolas', 'Liberation Mono', monospace;
  letter-spacing: 0.5px;
  background: #FAFAFA;
  transition: all 0.3s ease;
}

.input-box:focus {
  outline: none;
  border-color: #444;
  background: white;
}

.convert-hint {
  margin-top: 12px;
  padding: 12px;
  background: #FFF8E7;
  border-radius: 8px;
  border-left: 4px solid #e67e22;
  min-height: 0;
  display: none;
}

.convert-hint:empty {
  display: none;
}

.convert-hint.has-content {
  display: block;
}

.hint-content {
  font-size: 13px;
  line-height: 1.6;
  color: #666;
}

.hint-content p {
  margin-bottom: 6px;
}

.hint-content p:last-child {
  margin-bottom: 0;
}

.original-value {
  color: #e74c3c;
  font-weight: 500;
}

.converted-value {
  color: #27ae60;
  font-weight: 500;
}

.warning-message {
  color: #e67e22;
  font-weight: 500;
}

.btn-row {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.btn-primary {
  background: #4285F4;
  color: white;
  border: none;
  padding: 14px 32px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(66, 133, 244, 0.3);
}

.btn-primary:hover {
  background: #3367D6;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(66, 133, 244, 0.4);
}

.btn-secondary {
  background: #F0F0F0;
  color: #666;
  border: none;
  padding: 14px 32px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  background: #E0E0E0;
  color: #333;
}

.card {
  background: white;
  border-radius: 16px;
  padding: 25px;
  margin-bottom: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.error-card {
  border-left: 4px solid #E53935;
}

.error-message {
  color: #E53935;
  font-size: 14px;
}

.result-box {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.result-header {
  margin-bottom: 15px;
}

.result-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.result-item {
  margin-bottom: 15px;
}

.result-item:last-child {
  margin-bottom: 0;
}

.unit {
  font-size: 12px;
  color: #999;
  margin-bottom: 8px;
  display: block;
}

.result-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.value {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  font-family: 'SF Mono', 'Monaco', 'Consolas', 'Liberation Mono', monospace;
}

.copy-btn {
  background: #F5F5F5;
  color: #666;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.copy-btn:hover {
  background: #E8F5E9;
  color: #34A853;
}

.history-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 200px;
  overflow: hidden;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.history-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.clear-history-btn {
  font-size: 12px;
  color: #999;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s ease;
}

.clear-history-btn:hover {
  color: #E53935;
}

.history-list {
  max-height: none;
  overflow-y: auto;
  flex: 1;
  align-content: flex-start;
}

.history-list::-webkit-scrollbar {
  width: 6px;
}

.history-list::-webkit-scrollbar-thumb {
  background: #d0d0d0;
  border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb:hover {
  background: #b0b0b0;
}

.history-list::-webkit-scrollbar-track {
  background: transparent;
}

.history-list {
  -ms-overflow-style: auto;
  scrollbar-width: thin;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: #F0F0F0;
  border-radius: 12px;
  font-size: 14px;
  color: #444;
  width: calc(100% - 20px);
  margin: 0 auto 10px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.history-item:hover {
  background: #E8F5E9;
  transform: translateX(5px);
}

.history-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-left span.history-value {
  font-family: 'SF Mono', 'Monaco', 'Consolas', 'Liberation Mono', monospace;
  font-size: 14px;
  color: #333;
}

.history-left .unit-tag {
  font-size: 11px;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
}

.unit-tag.inch {
  background: #EA4335;
}

.unit-tag.cm {
  background: #34A853;
}

.history-time {
  font-size: 12px;
  color: #999;
}

.empty-history {
  text-align: center;
  color: #999;
  padding: 20px;
}

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal-overlay.show {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 16px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  border-bottom: 1px solid #E0E0E0;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: #333;
}

.modal-body {
  padding: 25px;
}

.rule-intro {
  margin-bottom: 25px;
}

.rule-intro h3 {
  font-size: 15px;
  font-weight: 600;
  color: #333;
  margin-bottom: 10px;
}

.rule-intro p {
  font-size: 14px;
  line-height: 1.7;
  color: #666;
  margin-bottom: 8px;
}

.rule-intro p:last-child {
  margin-bottom: 0;
}

.rule-table-section {
  margin-bottom: 25px;
}

.rule-table-section h3 {
  font-size: 15px;
  font-weight: 600;
  color: #333;
  margin-bottom: 15px;
}

.rule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.rule-table th,
.rule-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #E0E0E0;
}

.rule-table th {
  background: #FAFAFA;
  font-weight: 600;
  color: #333;
}

.rule-table tbody tr:hover {
  background: #FAFAFA;
}

.rule-example {
  margin-top: 25px;
}

.rule-example h3 {
  font-size: 15px;
  font-weight: 600;
  color: #333;
  margin-bottom: 15px;
}

.example-item {
  background: #FAFAFA;
  border-radius: 12px;
  padding: 20px;
}

.example-title {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin-bottom: 15px;
}

.example-explanation {
  font-size: 13px;
  line-height: 1.8;
  color: #666;
}

.example-explanation p {
  margin-bottom: 8px;
}

.example-explanation p:last-child {
  margin-bottom: 0;
}

.example-explanation .note {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #DDD;
  color: #999;
}

@media (max-width: 768px) {
  .main-card {
    flex-direction: column;
    gap: 20px;
  }

  .input-column {
    padding-right: 0;
    border-right: none;
    padding-bottom: 20px;
    border-bottom: 1px solid #E0E0E0;
  }

  .result-column {
    padding-left: 0;
  }

  .title {
    font-size: 24px;
  }

  .btn-row {
    flex-direction: column;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
  }
}