:root {
  color-scheme: light;
  font-family: "Inter", "Microsoft YaHei", system-ui, sans-serif;
  background: #f3f7f6;
  color: #102432;
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: #00665d; }
[hidden] { display: none !important; }

.sne-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
  padding: .75rem max(1.25rem, calc((100% - 72rem) / 2));
  border-bottom: 1px solid #cddbd9;
  background: #fff;
}

.sne-nav nav, .sne-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem 1.25rem; }
.sne-nav a { text-decoration: none; }
.sne-nav a:hover { text-decoration: underline; }
.sne-brand { color: #102432; font-weight: 750; }
.sne-main { width: min(100% - 2.5rem, 67.5rem); margin: clamp(1.65rem, 5vw, 3.5rem) auto; }
.sne-main h1 { font-size: clamp(1.85rem, 5vw, 2.7rem); line-height: 1.15; margin: 0; }
.sne-intro { margin: .65rem 0 1.25rem; font-size: 1.08rem; }
.sne-panel { padding: clamp(1rem, 4vw, 1.5rem); border: 1px solid #ccdcd9; border-radius: 1rem; background: #fff; }
.sne-result h2, .sne-panel h2 { font-size: 1.15rem; font-weight: 700; margin: 0; }
.sne-panel p { margin: .55rem 0 1rem; line-height: 1.55; color: #425868; }
.sne-panel .sne-rules { margin: 0 0 .8rem; }
.sne-upload { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .75rem; }
.sne-file-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.sne-panel input, .sne-panel select {
  display: block;
  width: 100%;
  min-width: 0;
  padding: .7rem;
  border: 1px solid #9fb6b1;
  border-radius: .5rem;
  color: #102432;
  background: #f5f9f8;
  font: inherit;
}

input::file-selector-button {
  padding: .45rem .75rem;
  margin-inline-end: .8rem;
  border: 1px solid #9fb6b1;
  border-radius: .35rem;
  background: #fff;
  color: #143936;
  font: inherit;
  cursor: pointer;
}

.sne-actions { margin-top: 1rem; }
.sne-button, .sne-button:visited {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: .55rem 1rem;
  border: 1px solid #00665d;
  border-radius: .5rem;
  background: #00665d;
  color: #fff;
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

.sne-button:hover { background: #00524b; }
.sne-button.secondary { background: #fff; color: #00665d; }
.sne-button.secondary:hover { background: #e8f3f0; }
.sne-button:disabled { border-color: #c9d6d4; background: #e9eeed; color: #405957; cursor: default; }
:focus-visible { outline: 3px solid #087b70; outline-offset: 3px; }
progress { display: block; width: 100%; height: .6rem; margin-top: 1rem; accent-color: #00665d; }
.sne-panel .sne-status { margin: .75rem 0 0; }
.sne-status:empty { display: none; }
.sne-panel .sne-status[data-error="true"] { color: #98251e; }
.sne-result { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid #ccdcd9; }
.sne-result input { margin-top: .75rem; }
.sne-result p { margin: .65rem 0 0; }
.sne-subtle { font-size: .88rem; color: #425868; }
.sne-subtle:empty { display: none; }
.sne-history { margin-top: 1rem; }
.sne-history-tabs { gap: .45rem; margin: .9rem 0 .75rem; }
.sne-history-tabs .sne-button { min-height: 2.35rem; padding: .35rem .8rem; }
.sne-history-tabs .sne-button[aria-pressed="true"] { background: #00665d; color: #fff; }
.sne-history-list { list-style: none; padding: 0; margin: .6rem 0 0; }
.sne-history-list li {
  display: flex; align-items: center; justify-content: space-between; gap: .55rem 1rem;
  padding: .7rem 0; border-bottom: 1px solid #d9e5e3; overflow-wrap: anywhere;
}
.sne-history-list li:last-child { border-bottom: 0; }
.sne-history-list p { margin: .15rem 0 0; font-size: .82rem; }
.sne-row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; }
.sne-row-actions .sne-button { min-height: 2.25rem; padding: .28rem .65rem; font-size: .84rem; }
.sne-dialog {
  color: inherit; width: min(59rem, calc(100% - 1.5rem)); max-height: calc(100dvh - 1.5rem);
  overflow: auto; padding: 1rem 1.25rem;
}
#share-dialog { width: min(34rem, calc(100% - 1.5rem)); }
.sne-dialog::backdrop { background: rgb(12 32 38 / 47%); }
.sne-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.sne-dialog label:not(.sne-check) { display: grid; gap: .35rem; font-size: .9rem; }
.sne-dialog input, .sne-dialog select { padding: .45rem .6rem; }
.sne-dialog .sne-status { margin-bottom: .6rem; }
.sne-export-grid, .sne-filter-grid, .sne-inline { display: grid; gap: .55rem; align-items: end; }
.sne-export-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sne-inline { grid-template-columns: minmax(0, 1fr) auto; margin: .65rem 0; }
.sne-check { display: flex; align-items: start; gap: .4rem; min-width: 0; overflow-wrap: anywhere; font-size: .88rem; }
.sne-panel .sne-check input { width: 1rem; height: 1rem; margin: .13rem 0 0; accent-color: #00665d; flex: 0 0 1rem; }
.sne-options {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: .45rem;
  padding: .6rem; max-height: 13rem; overflow-y: auto; border: 1px solid #ccdcd9; border-radius: .5rem; background: #f5f9f8;
}
.sne-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; margin-top: .6rem; }
.sne-filter-grid summary { cursor: pointer; padding: .55rem; border: 1px solid #ccdcd9; border-radius: .4rem; }
.sne-plot { width: 100%; height: clamp(20rem, 42vw, 25rem); margin: .7rem 0 0; }
.sne-table-scroll { overflow: auto; max-height: 19rem; margin: .7rem 0 0; border: 1px solid #ccdcd9; border-radius: .5rem; }
.sne-table-scroll table { border-collapse: collapse; font-size: .82rem; min-width: 100%; }
.sne-table-scroll td, .sne-table-scroll th { padding: .35rem .65rem; text-align: left; border-bottom: 1px solid #d9e5e3; white-space: nowrap; }
.sne-table-scroll th { position: sticky; top: 0; background: #e9f2f0; }

@media (max-width: 44rem) {
  .sne-export-grid { grid-template-columns: 1fr; }
  .sne-history-list li { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 32rem) {
  .sne-main { width: calc(100% - 1.5rem); }
  .sne-upload { grid-template-columns: minmax(0, 1fr); }
  .sne-dialog { padding: .85rem; }
  #share-form { grid-template-columns: minmax(0, 1fr); }
}
