/* ==========================================================================
   kraken.moe — site stylesheet
   --------------------------------------------------------------------------
   Two visual sources are combined here:

   1. Puzzle Pirates' "yoweb" web pages (page background #C5C7AE, panel fill
      #CDCEB5, panel edge #B3AD86, muted labels #958A5F, links #306292,
      Arial). The rope strips (header.png / footer.png) and the ornate panel
      caps (tableheader.png, crewtableheader.png) are yoweb's own artwork,
      copied into assets/yoweb/.

   2. The in-game window chrome — dark navy + gold value boxes, tabbed panel
      tops, "Display:" / "Search:" toolbars, and the yellow row highlight.
      Those live in the "in-game window" section near the bottom.
   ========================================================================== */

:root {
  --bg:        #C5C7AE;   /* page background              */
  --bg-alt:    #C3C4AA;   /* slightly darker bg (headers) */
  --panel:     #CDCEB5;   /* panel fill                   */
  --panel-2:   #D6D7C1;   /* raised element               */
  --edge:      #B3AD86;   /* 1px border                   */
  --edge-soft: #C0C0A4;   /* row separator                */
  --label:     #958A5F;   /* small caps / field labels    */
  --link:      #306292;
  --link-vis:  #6A818B;
  --ink:       #000000;
  --ok:        #3E6B3E;
  --warn:      #8A5A1F;
  --dead:      #7A3A3A;

  --navy:      #132844;   /* in-game tooltip / value box  */
  --navy-edge: #0A1A2E;
  --gold:      #F2E28A;
  --row-sel:   #EFE79A;   /* in-game selected-row yellow  */

  --col:       890px;     /* centre column width */
  --gap:       16px;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 13px/1.45 Arial, Helvetica, sans-serif;
}

a         { color: var(--link); }
a:visited { color: var(--link-vis); }
a:hover   { color: #1B3F63; }

img { border: 0; }

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--col);
  margin: 0 auto;
  padding: 10px 10px 40px;
}

.cols      { display: grid; grid-template-columns: 208px 1fr; gap: var(--gap); align-items: start; }
.cols-wide { display: grid; grid-template-columns: 1fr 208px; gap: var(--gap); align-items: start; }
.cols-3    { display: grid; grid-template-columns: 208px 1fr 208px; gap: var(--gap); align-items: start; }
.grid-3    { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.grid-2    { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); }
.stack     { display: grid; gap: var(--gap); }
@media (max-width: 720px) {
  .cols, .cols-wide, .cols-3, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   Masthead — rope rules + centred logo + nav
   -------------------------------------------------------------------------- */
.masthead { text-align: center; }

.rope {
  height: 18px;
  background: url("yoweb/header.png") repeat-x center center;
  background-size: auto 18px;
}
.rope-foot {
  height: 18px;
  background: url("yoweb/footer.png") repeat-x center center;
  background-size: auto 18px;
}

.brand { display: inline-block; margin: 6px 0 2px; }
.brand img { display: block; width: 100%; max-width: 330px; height: auto; }

.mainnav {
  padding: 6px 0 4px;
  font-size: 13px;
  letter-spacing: .01em;
}
.mainnav a { margin: 0 7px; }
.mainnav a.here { font-weight: bold; text-decoration: none; color: var(--ink); }
.mainnav .sep { color: var(--label); }

/* --------------------------------------------------------------------------
   Page heading
   -------------------------------------------------------------------------- */
.page-title {
  margin: 14px 0 4px;
  font-size: 21px;
  font-weight: bold;
  text-align: center;
}
.page-sub {
  margin: 0 0 14px;
  text-align: center;
  font-size: 11px;
  color: var(--label);
}

/* --------------------------------------------------------------------------
   Panels — the yoweb box: 1px dark edge, lighter fill
   -------------------------------------------------------------------------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--edge);
  padding: 8px 10px;
}
.panel + .panel { margin-top: 10px; }
.panel-flush { padding: 0; }
.panel-head {
  margin: -8px -10px 8px;
  padding: 4px 10px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--edge);
  font-weight: bold;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #4A452C;
}
.panel-note {
  background: #D9D2AE;
  border-color: #C4B98A;
}
.panel h2, .panel h3 { margin: 0 0 8px; }

/* ornate cap artwork sitting on top of a panel (yoweb table headers) */
.capped { text-align: center; }
.capped > img.cap { display: block; margin: 0 auto -2px; position: relative; z-index: 1; }
.capped > .panel { text-align: left; }

/* small label row (yoweb's #958A5F italic labels) */
.label {
  color: var(--label);
  font-size: 11px;
  font-style: italic;
}
.muted  { color: #5B5640; }
.tiny   { font-size: 11px; }
.center { text-align: center; }
.right  { text-align: right; }
.nowrap { white-space: nowrap; }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.tbl caption {
  caption-side: top;
  text-align: left;
  font-size: 11px;
  color: var(--label);
  font-style: italic;
  padding-bottom: 4px;
}
table.tbl th {
  text-align: left;
  font-weight: bold;
  text-decoration: underline;      /* yoweb underlines its column heads */
  padding: 4px 6px;
  border-bottom: 1px solid var(--edge);
  white-space: nowrap;
  background: var(--bg-alt);
}
table.tbl td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--edge-soft);
  vertical-align: top;
}
table.tbl tbody tr:nth-child(even) td { background: rgba(197, 199, 174, .55); }
table.tbl tbody tr:hover td { background: var(--row-sel); }   /* in-game yellow */
table.tbl tr.sel td { background: var(--row-sel); }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl td.ctr, table.tbl th.ctr { text-align: center; }
table.tbl .rowhead { font-weight: bold; }
table.tbl tr.total td { border-top: 2px solid var(--edge); font-weight: bold; }

/* stacked field-list table (label / value) */
table.fields { width: 100%; border-collapse: collapse; font-size: 13px; }
table.fields th {
  text-align: left;
  font-weight: normal;
  color: var(--label);
  font-size: 11px;
  font-style: italic;
  padding: 3px 6px 3px 0;
  white-space: nowrap;
  vertical-align: top;
  width: 40%;
}
table.fields td { padding: 3px 0; vertical-align: top; }

/* --------------------------------------------------------------------------
   Badges / pills
   -------------------------------------------------------------------------- */
.tag {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--edge);
  background: var(--panel-2);
  font-size: 10px;
  font-weight: bold;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #4A452C;
  white-space: nowrap;
}
.tag-auction { background: #C9D6E2; border-color: #8FA6BC; color: #24425E; }
.tag-buy     { background: #CFDCC4; border-color: #97AE86; color: #2F4A28; }
.tag-done    { background: #DCD6BC; border-color: #BFB489; color: #4A452C; }
.tag-new     { background: #E4D3B8; border-color: #C3A87A; color: #6A4A18; }
.tag-closed  { background: #D8C9C9; border-color: #B99A9A; color: #6A3A3A; }
.tag-pos     { background: #CFDCC4; border-color: #97AE86; color: #2F4A28; }
.tag-neg     { background: #DCC6C6; border-color: #B99A9A; color: #6A2A2A; }
.tag-pending { background: #E4D3B8; border-color: #C3A87A; color: #6A4A18; }
.tag-abandon { background: #D8C9C9; border-color: #B99A9A; color: #6A3A3A; }

/* entity chips (rank / reputation) */
.chip { white-space: nowrap; }
.chip img { vertical-align: -6px; margin-right: 3px; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-block;
  font: bold 12px Arial, Helvetica, sans-serif;
  color: var(--ink);
  text-decoration: none;
  background: linear-gradient(#DEDEC9, #C6C7AD);
  border: 1px solid var(--edge);
  border-radius: 2px;
  padding: 4px 11px;
  cursor: pointer;
}
.btn:hover  { background: linear-gradient(#E9E9D6, #D2D3BB); color: var(--ink); }
.btn:active { background: linear-gradient(#C6C7AD, #DEDEC9); }
.btn-primary {
  background: linear-gradient(#4C7CA8, #306292);
  border-color: #24506F;
  color: #FFFFFF;
}
.btn-primary:hover { background: linear-gradient(#5A8CB8, #3A6E9E); color: #FFFFFF; }
.btn-danger { background: linear-gradient(#A85C5C, #8C4444); border-color: #6E3131; color: #FFF; }
.btn-danger:hover { background: linear-gradient(#B76A6A, #9A4E4E); color: #FFF; }
.btn-sm  { font-size: 11px; padding: 2px 7px; }
.btn-lg  { font-size: 14px; padding: 7px 18px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
input[type="text"], input[type="password"], input[type="number"],
input[type="search"], input[type="email"], select, textarea {
  font: 13px Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: #FFFFFF;
  border: 1px solid var(--edge);
  padding: 3px 5px;
  border-radius: 1px;
  max-width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 1px solid #7D94A8; }
input[type="radio"], input[type="checkbox"] { vertical-align: -1px; }
textarea { width: 100%; min-height: 76px; resize: vertical; }

.form-row { margin-bottom: 9px; }
.form-row > label.field-label {
  display: block;
  font-size: 11px;
  font-style: italic;
  color: var(--label);
  margin-bottom: 2px;
}
.form-hint { font-size: 11px; color: #6B6549; margin-top: 3px; }
.fieldset {
  border: 1px solid var(--edge);
  background: rgba(214, 215, 193, .5);
  padding: 8px 10px 10px;
  margin: 0 0 12px;
}
.fieldset > legend {
  font-weight: bold;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #4A452C;
  padding: 0 5px;
}

/* filter bar */
.filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.filters .form-row { margin: 0; }

/* --------------------------------------------------------------------------
   In-game window chrome
   -------------------------------------------------------------------------- */

/* panel tabs (the "Buy/Sell Commodities | Market Bidding" strip) */
.tabs {
  display: flex;
  gap: 2px;
  padding-left: 8px;
  margin-bottom: -1px;
  position: relative;
  z-index: 2;
}
.tabs .tab {
  display: inline-block;
  font: bold 12px Arial, Helvetica, sans-serif;
  color: var(--ink);
  text-decoration: none;
  background: linear-gradient(#D6D7C1, #BEBFA3);
  border: 1px solid var(--edge);
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  padding: 4px 13px;
}
.tabs .tab:hover { background: linear-gradient(#E4E5D2, #CDCEB4); }
.tabs .tab.on {
  background: var(--panel);
  padding-bottom: 5px;
  margin-bottom: -1px;
}

/* inline "Display:  Search:  Sort by: ( ) ( )" control strip */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  padding: 6px 9px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--edge);
  font-size: 12px;
}
.toolbar .grp { display: flex; align-items: center; gap: 6px; }
.toolbar .grp > b { font-weight: bold; }
.toolbar label { font-size: 12px; white-space: nowrap; }
.toolbar input[type="search"], .toolbar input[type="text"] { padding: 2px 5px; }

/* dark navy inset box holding an amount (the game's coin read-outs) */
.valuebox {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--navy);
  color: var(--gold);
  border: 1px solid var(--navy-edge);
  border-radius: 2px;
  padding: 2px 8px;
  font: bold 12px Arial, Helvetica, sans-serif;
  font-variant-numeric: tabular-nums;
}
.valuebox img.poe { width: 15px; height: 13px; margin: 0; }
.valuebox-lg { font-size: 14px; padding: 3px 10px; }

/* --------------------------------------------------------------------------
   Pirate name colours
   --------------------------------------------------------------------------
   Modelled on Puzzle Pirates' own name colouring: brand-new pirates show
   bright green, veterans yellow, with a yellow-green in between. Tier follows
   confirmed trade count, with override tiers for poor reputation, bans and
   staff.

   NOTE ON SPECIFICITY: these selectors are deliberately doubled up
   (`a.pname.pname-reg`) because every pirate name is a link, and a plain
   `.pname-reg` class would lose to `a:visited` — which is what made every name
   render dark blue. Keep the doubled form if you add tiers.

   The outline is eight opaque 1px offsets rather than a blurred shadow, so it
   reads as the game's hard pixel stroke with no soft glow. For a 2px stroke,
   duplicate each offset at 2px.
   -------------------------------------------------------------------------- */
.pname {
  position: relative;
  font-weight: bold;
  text-decoration: none;
  text-shadow:
    -1px -1px 0 #000,  0 -1px 0 #000,  1px -1px 0 #000,
    -1px  0   0 #000,                  1px  0   0 #000,
    -1px  1px 0 #000,  0  1px 0 #000,  1px  1px 0 #000;
}
a.pname:hover { text-decoration: underline; }

a.pname.pname-new,    .pname-new    { color: #4AE000; }   /*   0-4 trades */
a.pname.pname-mid,    .pname-mid    { color: #9BD400; }   /*   5-9 trades */
a.pname.pname-reg,    .pname-reg    { color: #CFCF00; }   /*    10+ trades */
a.pname.pname-warn,   .pname-warn   { color: #E07B1F; }   /* net -1 / -2  */
a.pname.pname-bad,    .pname-bad    { color: #C02020; }   /* net -3 or worse */
a.pname.pname-banned, .pname-banned {
  color: #8A8A8A;
  text-decoration: line-through;
}
a.pname.pname-staff,  .pname-staff  { color: #E0799E; }   /* kraken staff */

/* reputation tooltip — dark in-game panel, no outline bleed */
.pname[data-rep]:hover::after {
  content: attr(data-rep);
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translateX(-50%);
  margin-bottom: 5px;
  white-space: nowrap;
  background: var(--navy);
  color: var(--gold);
  border: 1px solid var(--navy-edge);
  border-radius: 2px;
  padding: 3px 8px;
  font: bold 11px/1.35 Arial, Helvetica, sans-serif;
  text-shadow: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
  z-index: 60;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Pieces of eight
   --------------------------------------------------------------------------
   Displayed at the sprite's native 19x16. Do NOT set image-rendering:
   pixelated here — the source is 19x16, so any downscale with nearest-neighbour
   sampling throws pixels away and the coin turns to mush.
   -------------------------------------------------------------------------- */
img.poe {
  width: 19px;
  height: 16px;
  vertical-align: -3px;
  margin-left: 3px;
}

/* --------------------------------------------------------------------------
   Reputation score (running +/-)
   -------------------------------------------------------------------------- */
.rep-score {
  font-size: 26px;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.rep-score.positive { color: var(--ok); }
.rep-score.negative { color: var(--dead); }

/* --------------------------------------------------------------------------
   Buttons: nav call-to-action + signed-in/out states
   -------------------------------------------------------------------------- */
.mainnav a.nav-cta {
  display: inline-block;
  background: linear-gradient(#4C7CA8, #306292);
  border: 1px solid #24506F;
  border-radius: 2px;
  color: #FFFFFF;
  font-weight: bold;
  padding: 2px 10px;
  text-decoration: none;
}
.mainnav a.nav-cta:hover {
  background: linear-gradient(#5A8CB8, #3A6E9E);
  color: #FFFFFF;
}
.mainnav a.nav-cta.here { background: linear-gradient(#3A6E9E, #24506F); }

/* Create Listing / Trades / My Profile / bell appear only when signed in */
.auth-only, .guest-only { display: none; }
html.signed-in .auth-only { display: inline; }
html:not(.signed-in) .guest-only { display: inline; }

/* --------------------------------------------------------------------------
   Notification bell + dropdown
   -------------------------------------------------------------------------- */
.notif { display: inline-block; position: relative; vertical-align: -2px; }
.notif > summary {
  list-style: none;
  cursor: pointer;
  display: inline-block;
  position: relative;
  margin: 0 4px;
  padding: 1px 4px;
  border: 1px solid transparent;
  border-radius: 2px;
}
.notif > summary::-webkit-details-marker { display: none; }
.notif[open] > summary { background: var(--bg-alt); border-color: var(--edge); }
.notif .bell { width: 14px; height: 14px; fill: #4A452C; vertical-align: -2px; }
.notif .count {
  display: inline-block;
  min-width: 15px;
  padding: 0 4px;
  margin-left: 3px;
  background: #8C4444;
  color: #FFFFFF;
  border-radius: 8px;
  font: bold 10px/15px Arial, Helvetica, sans-serif;
  text-align: center;
  vertical-align: 1px;
}
.notif .drop {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 70;
  width: 306px;
  margin-top: 5px;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--edge);
  box-shadow: 0 3px 10px rgba(0, 0, 0, .3);
}
.notif .drop .drop-head {
  padding: 4px 9px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--edge);
  font-weight: bold;
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #4A452C;
}
.notif .drop ul { margin: 0; padding: 0; list-style: none; max-height: 292px; overflow-y: auto; }
.notif .drop li {
  padding: 6px 9px;
  border-bottom: 1px solid var(--edge-soft);
  font-size: 12px;
  line-height: 1.4;
}
.notif .drop li:last-child { border-bottom: 0; }
.notif .drop li.unread { background: #DCD8B6; }
.notif .drop .when { display: block; font-size: 10px; color: var(--label); margin-top: 1px; }
.notif .drop .drop-foot {
  padding: 5px 9px;
  border-top: 1px solid var(--edge);
  text-align: center;
  font-size: 11px;
  background: var(--bg-alt);
}

/* --------------------------------------------------------------------------
   Misc
   -------------------------------------------------------------------------- */
.rule-shim { height: 1px; background: var(--edge); margin: 10px 0; }
.kv-inline { font-size: 12px; color: #4A452C; }
.kv-inline b { color: var(--ink); }

.price      { font-weight: bold; font-variant-numeric: tabular-nums; }
.price-big  { font-size: 17px; font-weight: bold; font-variant-numeric: tabular-nums; }
.positive   { color: var(--ok); }
.negative   { color: var(--dead); }
.strike     { text-decoration: line-through; color: #6B6549; }

.spark { display: inline-block; vertical-align: middle; }
.spark i {
  display: inline-block;
  width: 3px;
  margin-right: 1px;
  background: #6E86A0;
  vertical-align: bottom;
}

.pager { margin-top: 10px; text-align: center; font-size: 12px; }
.pager a, .pager span { margin: 0 4px; }
.pager .current { font-weight: bold; color: var(--ink); }

/* portrait frame (yoweb portraittop / left / right / bottom) */
.portrait { width: 196px; margin: 0 auto; }
.portrait .p-top, .portrait .p-bottom { display: block; margin: 0 auto; }
.portrait .p-mid { display: flex; justify-content: center; align-items: stretch; }
.portrait .p-mid > img { display: block; }
.portrait .p-img {
  width: 174px;
  min-height: 255px;
  background: #B9BBA1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #6B6549;
  font-size: 11px;
}

/* footer */
.site-foot {
  margin-top: 26px;
  text-align: center;
  font-size: 11px;
  color: #55503A;
}
.site-foot .links { margin-bottom: 6px; }
.site-foot .legal { max-width: 620px; margin: 8px auto 0; line-height: 1.5; }

/* empty-state */
.empty {
  padding: 18px 10px;
  text-align: center;
  color: #6B6549;
  font-style: italic;
  font-size: 12px;
}

/* honour-system notice */
.honour {
  background: #DCD6BC;
  border: 1px solid #C4B98A;
  padding: 8px 10px;
  font-size: 12px;
}
.honour b { color: #5A4514; }

/* demo affordance for reviewing states without a backend */
.demo-toggle {
  margin: 16px auto 0;
  text-align: center;
  font-size: 11px;
  color: #6B6549;
}
.demo-toggle a { margin: 0 4px; }
.demo-toggle .on { font-weight: bold; color: var(--ink); text-decoration: none; }

/* sign-in step chips */
.steps { display: flex; gap: 6px; justify-content: center; margin: 0 0 14px; }
.steps .step {
  font-size: 11px;
  padding: 2px 9px;
  border: 1px solid var(--edge);
  background: var(--panel-2);
  color: #6B6549;
}
.steps .step.on { background: #306292; border-color: #24506F; color: #FFFFFF; font-weight: bold; }
.steps .step.done { background: #CFDCC4; border-color: #97AE86; color: #2F4A28; }

/* big one-time verification code */
.codebox {
  font: bold 24px/1.2 "Courier New", Courier, monospace;
  letter-spacing: .16em;
  text-align: center;
  background: var(--navy);
  color: var(--gold);
  border: 1px solid var(--navy-edge);
  border-radius: 2px;
  padding: 12px 10px;
  margin: 6px 0;
}
